- Portage des fonctionnalités de la branche main
- Ajout de node et npm dans la Dockerfile - Ajout des Factories et Fixtures - Ajout de npm-install dans Make install
This commit is contained in:
69
src/Factory/MangaFactory.php
Normal file
69
src/Factory/MangaFactory.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Factory;
|
||||
|
||||
use App\Entity\Manga;
|
||||
use App\Repository\MangaRepository;
|
||||
use Zenstruck\Foundry\ModelFactory;
|
||||
use Zenstruck\Foundry\Proxy;
|
||||
use Zenstruck\Foundry\RepositoryProxy;
|
||||
|
||||
/**
|
||||
* @extends ModelFactory<Manga>
|
||||
*
|
||||
* @method Manga|Proxy create(array|callable $attributes = [])
|
||||
* @method static Manga|Proxy createOne(array $attributes = [])
|
||||
* @method static Manga|Proxy find(object|array|mixed $criteria)
|
||||
* @method static Manga|Proxy findOrCreate(array $attributes)
|
||||
* @method static Manga|Proxy first(string $sortedField = 'id')
|
||||
* @method static Manga|Proxy last(string $sortedField = 'id')
|
||||
* @method static Manga|Proxy random(array $attributes = [])
|
||||
* @method static Manga|Proxy randomOrCreate(array $attributes = [])
|
||||
* @method static MangaRepository|RepositoryProxy repository()
|
||||
* @method static Manga[]|Proxy[] all()
|
||||
* @method static Manga[]|Proxy[] createMany(int $number, array|callable $attributes = [])
|
||||
* @method static Manga[]|Proxy[] createSequence(iterable|callable $sequence)
|
||||
* @method static Manga[]|Proxy[] findBy(array $attributes)
|
||||
* @method static Manga[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
|
||||
* @method static Manga[]|Proxy[] randomSet(int $number, array $attributes = [])
|
||||
*/
|
||||
final class MangaFactory 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 [
|
||||
'slug' => self::faker()->text(255),
|
||||
'title' => self::faker()->text(255),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
|
||||
*/
|
||||
protected function initialize(): self
|
||||
{
|
||||
return $this
|
||||
// ->afterInstantiate(function(Manga $manga): void {})
|
||||
;
|
||||
}
|
||||
|
||||
protected static function getClass(): string
|
||||
{
|
||||
return Manga::class;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user