Supprime toutes les couches pré-DDD pour ne garder que l'architecture hexagonale (src/Domain/), les entités Doctrine et le front Vue.js SPA. Supprimé : - src/Controller/ (9 controllers Twig, garde SecurityController) - src/Service/, src/Message/, src/MessageHandler/ (services et messages legacy) - src/Manager/, src/Twig/, src/Form/ (UI legacy) - src/Event/, src/EventListener/, src/EventSubscriber/QueueStatusSubscriber - src/Client/MangadexClient.php (doublon du Domain) - src/Interface/, src/Factory/, src/DataFixtures/, src/Scheduler/MainSchedule - templates/ (tous sauf vue/ et base retiré — SecurityController = pur JSON) - assets/controllers/ (20 Stimulus controllers), app.js, bootstrap.js, controllers.json Modifié : - config/routes.yaml : suppression du chargement des controllers legacy - config/packages/messenger.yaml : suppression des routes legacy - config/services.yaml : suppression des bindings legacy + entrées Domain\Import fantômes - webpack.config.js : suppression entry 'app' et enableStimulusBridge - src/Entity/Chapter.php : suppression #[Broadcast] (Turbo Streams legacy) Déplacé : - src/Factory/*.php → tests/Factory/ (namespace App\Tests\Factory)
72 lines
2.6 KiB
PHP
72 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\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' => 'https://placehold.co/770x1090',
|
|
'imageUrl' => 'https://placehold.co/770x1090',
|
|
'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;
|
|
}
|
|
}
|