Fix config
This commit is contained in:
@@ -3,12 +3,6 @@
|
||||
namespace App\DataFixtures;
|
||||
|
||||
use App\Factory\ApiTokenFactory;
|
||||
use App\Factory\CommentFactory;
|
||||
use App\Factory\CompanyFactory;
|
||||
use App\Factory\DocumentFactory;
|
||||
use App\Factory\FolderFactory;
|
||||
use App\Factory\ProjectDocumentFactory;
|
||||
use App\Factory\ProjectFactory;
|
||||
use App\Factory\UserFactory;
|
||||
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
@@ -17,70 +11,6 @@ class AppFixtures extends Fixture
|
||||
{
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
CompanyFactory::createMany(5);
|
||||
UserFactory::createMany(20, function () {
|
||||
return [
|
||||
'company' => CompanyFactory::random()
|
||||
];
|
||||
});
|
||||
ApiTokenFactory::createMany(60, function () {
|
||||
return [
|
||||
'ownedBy' => UserFactory::random()
|
||||
];
|
||||
});
|
||||
$projects = ProjectFactory::createMany(100, function () {
|
||||
return [
|
||||
'ownedBy' => UserFactory::random()
|
||||
];
|
||||
});
|
||||
|
||||
$documents = DocumentFactory::createMany(100);
|
||||
|
||||
foreach ($documents as $document) {
|
||||
ProjectDocumentFactory::createMany(3, function () use ($document) {
|
||||
return [
|
||||
'document' => $document,
|
||||
'project' => ProjectFactory::random()
|
||||
];
|
||||
});
|
||||
|
||||
CommentFactory::createMany(1, function () use ($document) {
|
||||
return [
|
||||
'projectDocument' => ProjectDocumentFactory::random(),
|
||||
'postedBy' => UserFactory::random()
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
foreach ($projects as $project) {
|
||||
$projectFolder = FolderFactory::createOne([
|
||||
'label' => 'Root Folder Project ' . $project->getId(),
|
||||
'slug' => 'root-folder-project-' . $project->getId(),
|
||||
'project' => $project,
|
||||
'createdBy' => $project->getOwnedBy()
|
||||
]);
|
||||
$child = FolderFactory::createOne([
|
||||
'label' => 'Subfolder - Parent Folder: ' . $projectFolder->getId(),
|
||||
'slug' => 'subfolder-parent-folder-' . $projectFolder->getId(),
|
||||
'createdBy' => $project->getOwnedBy()
|
||||
]);
|
||||
$grandChild = FolderFactory::createOne([
|
||||
'label' => 'Subfolder - Parent Folder: ' . $child->getId(),
|
||||
'slug' => 'subfolder-parent-folder-' . $child->getId(),
|
||||
'createdBy' => $project->getOwnedBy()
|
||||
]);
|
||||
|
||||
$grandChild->addDocument(DocumentFactory::createOne()->object());
|
||||
$grandChild->addDocument(DocumentFactory::createOne()->object());
|
||||
$grandChild->addDocument(DocumentFactory::createOne()->object());
|
||||
|
||||
$child->addChild(
|
||||
$grandChild->object()
|
||||
);
|
||||
|
||||
$projectFolder->addChild(
|
||||
$child->object()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user