| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace App\Tests\Fixture\Factory\Person;
- use App\Entity\Person\Person;
- use Zenstruck\Foundry\RepositoryProxy;
- use Zenstruck\Foundry\ModelFactory;
- use Zenstruck\Foundry\Proxy;
- /**
- * @extends ModelFactory<Person>
- *
- * @phpstan-method Person|Proxy create(array|callable $attributes = [])
- * @phpstan-method static Person|Proxy createOne(array $attributes = [])
- * @phpstan-method static Person|Proxy find(object|array|mixed $criteria)
- * @phpstan-method static Person|Proxy findOrCreate(array $attributes)
- * @phpstan-method static Person|Proxy first(string $sortedField = 'id')
- * @phpstan-method static Person|Proxy last(string $sortedField = 'id')
- * @phpstan-method static Person|Proxy random(array $attributes = [])
- * @phpstan-method static Person|Proxy randomOrCreate(array $attributes = []))
- * @phpstan-method static PersonRepository|RepositoryProxy repository()
- * @phpstan-method static Person[]|Proxy[] all()
- * @phpstan-method static Person[]|Proxy[] createMany(int $number, array|callable $attributes = [])
- * @phpstan-method static Person[]&Proxy[] createSequence(iterable|callable $sequence)
- * @phpstan-method static Person[]|Proxy[] findBy(array $attributes)
- * @phpstan-method static Person[]|Proxy[] randomRange(int $min, int $max, array $attributes = []))
- * @phpstan-method static Person[]|Proxy[] randomSet(int $number, array $attributes = []))
- */
- class PersonFactory extends ModelFactory
- {
- /**
- * @see https://github.com/zenstruck/foundry#factories-as-services
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * @see https://github.com/zenstruck/foundry#model-factories
- *
- * @todo add your default values here
- */
- protected function getDefaults(): array
- {
- return [];
- }
- /**
- * @see https://github.com/zenstruck/foundry#initialization
- */
- protected function initialize(): self
- {
- return $this
- // ->afterInstantiate(function(Post $post) {})
- ;
- }
- protected static function getClass(): string
- {
- return Person::class;
- }
- }
|