- 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:
Jérémy Guillot
2024-06-03 19:41:24 +02:00
parent 41a1a8c44c
commit 291e85338a
53 changed files with 11825 additions and 18 deletions

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Factory;
use App\Entity\Chapter;
use App\Repository\ChapterRepository;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
/**
* @extends ModelFactory<Chapter>
*
* @method Chapter|Proxy create(array|callable $attributes = [])
* @method static Chapter|Proxy createOne(array $attributes = [])
* @method static Chapter|Proxy find(object|array|mixed $criteria)
* @method static Chapter|Proxy findOrCreate(array $attributes)
* @method static Chapter|Proxy first(string $sortedField = 'id')
* @method static Chapter|Proxy last(string $sortedField = 'id')
* @method static Chapter|Proxy random(array $attributes = [])
* @method static Chapter|Proxy randomOrCreate(array $attributes = [])
* @method static ChapterRepository|RepositoryProxy repository()
* @method static Chapter[]|Proxy[] all()
* @method static Chapter[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Chapter[]|Proxy[] createSequence(iterable|callable $sequence)
* @method static Chapter[]|Proxy[] findBy(array $attributes)
* @method static Chapter[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static Chapter[]|Proxy[] randomSet(int $number, array $attributes = [])
*/
final class ChapterFactory 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 [
'manga' => MangaFactory::new(),
'number' => self::faker()->randomNumber(2),
'pages' => [],
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
protected function initialize(): self
{
return $this
// ->afterInstantiate(function(Chapter $chapter): void {})
;
}
protected static function getClass(): string
{
return Chapter::class;
}
}

View 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;
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Factory;
use App\Entity\Page;
use App\Repository\PageRepository;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
/**
* @extends ModelFactory<Page>
*
* @method Page|Proxy create(array|callable $attributes = [])
* @method static Page|Proxy createOne(array $attributes = [])
* @method static Page|Proxy find(object|array|mixed $criteria)
* @method static Page|Proxy findOrCreate(array $attributes)
* @method static Page|Proxy first(string $sortedField = 'id')
* @method static Page|Proxy last(string $sortedField = 'id')
* @method static Page|Proxy random(array $attributes = [])
* @method static Page|Proxy randomOrCreate(array $attributes = [])
* @method static PageRepository|RepositoryProxy repository()
* @method static Page[]|Proxy[] all()
* @method static Page[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Page[]|Proxy[] createSequence(iterable|callable $sequence)
* @method static Page[]|Proxy[] findBy(array $attributes)
* @method static Page[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static Page[]|Proxy[] randomSet(int $number, array $attributes = [])
*/
final class PageFactory 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 [
'chapter' => ChapterFactory::new(),
'imageLocalUrl' => self::faker()->text(255),
'imageUrl' => self::faker()->text(255),
'number' => self::faker()->randomNumber(2),
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
protected function initialize(): self
{
return $this
// ->afterInstantiate(function(Page $page): void {})
;
}
protected static function getClass(): string
{
return Page::class;
}
}

View File

@@ -0,0 +1,71 @@
<?php
namespace App\Factory;
use App\Entity\Source;
use App\Repository\SourceRepository;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
/**
* @extends ModelFactory<Source>
*
* @method Source|Proxy create(array|callable $attributes = [])
* @method static Source|Proxy createOne(array $attributes = [])
* @method static Source|Proxy find(object|array|mixed $criteria)
* @method static Source|Proxy findOrCreate(array $attributes)
* @method static Source|Proxy first(string $sortedField = 'id')
* @method static Source|Proxy last(string $sortedField = 'id')
* @method static Source|Proxy random(array $attributes = [])
* @method static Source|Proxy randomOrCreate(array $attributes = [])
* @method static SourceRepository|RepositoryProxy repository()
* @method static Source[]|Proxy[] all()
* @method static Source[]|Proxy[] createMany(int $number, array|callable $attributes = [])
* @method static Source[]|Proxy[] createSequence(iterable|callable $sequence)
* @method static Source[]|Proxy[] findBy(array $attributes)
* @method static Source[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static Source[]|Proxy[] randomSet(int $number, array $attributes = [])
*/
final class SourceFactory 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 [
'baseUrl' => self::faker()->text(255),
'createdAt' => \DateTimeImmutable::createFromMutable(self::faker()->dateTime()),
'isActive' => self::faker()->boolean(),
'updatedAt' => \DateTimeImmutable::createFromMutable(self::faker()->dateTime()),
];
}
/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
protected function initialize(): self
{
return $this
// ->afterInstantiate(function(Source $source): void {})
;
}
protected static function getClass(): string
{
return Source::class;
}
}

View File

@@ -54,7 +54,6 @@ final class UserFactory extends ModelFactory
'roles' => [],
'firstName' => self::faker()->randomElement(self::FIRST_NAMES),
'lastName' => self::faker()->randomElement(self::LAST_NAMES),
'company' => CompanyFactory::randomOrCreate(),
];
}