You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.5 KiB

<?php
namespace App\Factory;
use App\Entity\Fight;
use App\Repository\FightRepository;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
/**
* @extends ModelFactory<Fight>
*
* @method Fight|Proxy create(array|callable $attributes = [])
* @method static Fight|Proxy createOne(array $attributes = [])
* @method static Fight|Proxy find(object|array|mixed $criteria)
* @method static Fight|Proxy findOrCreate(array $attributes)
* @method static Fight|Proxy first(string $sortedField = 'id')
* @method static Fight|Proxy last(string $sortedField = 'id')
* @method static Fight|Proxy random(array $attributes = [])
* @method static Fight|Proxy randomOrCreate(array $attributes = [])
* @method static FightRepository|RepositoryProxy repository()
* @method static Fight[]|Proxy[] all()
* @method static Fight[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Fight[]|Proxy[] createSequence(iterable|callable $sequence)
* @method static Fight[]|Proxy[] findBy(array $attributes)
* @method static Fight[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static Fight[]|Proxy[] randomSet(int $number, array $attributes = [])
*/
final class FightFactory extends ModelFactory
{
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services
*
* @todo inject services if required
*/
public function __construct()
{
parent::__construct();
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories
*
* @todo add your default values here
*/
protected function getDefaults(): array
{
return [
'events' => [],
'startDate' => self::faker()->dateTime(),
'tournament' => TournamentFactory::new(),
'winner' => CharacterFactory::new(),
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
protected function initialize(): self
{
return $this
// ->afterInstantiate(function(Fight $fight): void {})
;
}
protected static function getClass(): string
{
return Fight::class;
}
}