AccessFactory.php 2.1 KB

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