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