- 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:
@@ -3,6 +3,9 @@
|
||||
namespace App\DataFixtures;
|
||||
|
||||
use App\Factory\ApiTokenFactory;
|
||||
use App\Factory\ChapterFactory;
|
||||
use App\Factory\MangaFactory;
|
||||
use App\Factory\PageFactory;
|
||||
use App\Factory\UserFactory;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
@@ -11,6 +14,32 @@ class AppFixtures extends Fixture
|
||||
{
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
UserFactory::createMany(20);
|
||||
ApiTokenFactory::createMany(60, function () {
|
||||
return [
|
||||
'ownedBy' => UserFactory::random()
|
||||
];
|
||||
});
|
||||
|
||||
$mangas = MangaFactory::createMany(5);
|
||||
|
||||
foreach ($mangas as $manga) {
|
||||
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$manga->addChapter(ChapterFactory::createOne([
|
||||
'manga' => $manga,
|
||||
'number' => $i
|
||||
])->object());
|
||||
}
|
||||
|
||||
foreach ($manga->getChapters() as $chapter) {
|
||||
for ($i = 1; $i <= 15; $i++) {
|
||||
$chapter->addPagesLink(PageFactory::createOne([
|
||||
'chapter' => $chapter,
|
||||
'number' => $i
|
||||
])->object());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user