OrganizationFactory.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Tests\Fixture\Factory\Organization;
  3. use App\Entity\Organization\Organization;
  4. use App\Tests\Fixture\Factory\Person\PersonRepository;
  5. use Zenstruck\Foundry\RepositoryProxy;
  6. use Zenstruck\Foundry\ModelFactory;
  7. use Zenstruck\Foundry\Proxy;
  8. /**
  9. * @extends ModelFactory<Organization>
  10. *
  11. * @phpstan-method Organization|Proxy create(array|callable $attributes = [])
  12. * @phpstan-method static Organization|Proxy createOne(array $attributes = [])
  13. * @phpstan-method static Organization|Proxy find(object|array|mixed $criteria)
  14. * @phpstan-method static Organization|Proxy findOrCreate(array $attributes)
  15. * @phpstan-method static Organization|Proxy first(string $sortedField = 'id')
  16. * @phpstan-method static Organization|Proxy last(string $sortedField = 'id')
  17. * @phpstan-method static Organization|Proxy random(array $attributes = [])
  18. * @phpstan-method static Organization|Proxy randomOrCreate(array $attributes = []))
  19. * @phpstan-method static OrganizationRepository|RepositoryProxy repository()
  20. * @phpstan-method static Organization[]|Proxy[] all()
  21. * @phpstan-method static Organization[]|Proxy[] createMany(int $number, array|callable $attributes = [])
  22. * @phpstan-method static Organization[]&Proxy[] createSequence(iterable|callable $sequence)
  23. * @phpstan-method static Organization[]|Proxy[] findBy(array $attributes)
  24. * @phpstan-method static Organization[]|Proxy[] randomRange(int $min, int $max, array $attributes = []))
  25. * @phpstan-method static Organization[]|Proxy[] randomSet(int $number, array $attributes = []))
  26. */
  27. class OrganizationFactory extends ModelFactory
  28. {
  29. /**
  30. * @see https://github.com/zenstruck/foundry#factories-as-services
  31. */
  32. public function __construct()
  33. {
  34. parent::__construct();
  35. }
  36. /**
  37. * @see https://github.com/zenstruck/foundry#model-factories
  38. *
  39. * @todo add your default values here
  40. */
  41. protected function getDefaults(): array
  42. {
  43. return [];
  44. }
  45. /**
  46. * @see https://github.com/zenstruck/foundry#initialization
  47. */
  48. protected function initialize(): self
  49. {
  50. return $this
  51. // ->afterInstantiate(function(Post $post) {})
  52. ;
  53. }
  54. protected static function getClass(): string
  55. {
  56. return Organization::class;
  57. }
  58. }