Fix config

This commit is contained in:
Jérémy Guillot
2024-06-03 18:09:16 +02:00
parent bddcdd6823
commit 41a1a8c44c
5 changed files with 2 additions and 195 deletions

View File

@@ -11,6 +11,7 @@
"ext-curl": "*",
"ext-iconv": "*",
"api-platform/core": "^3.2",
"doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.11",
"doctrine/doctrine-migrations-bundle": "^3.3",
"doctrine/orm": "^2.17",

2
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "46418bba7f81de1bb030e3321a5fb4c9",
"content-hash": "7f30c3ed2e16470ab82ad4fd0ca8b987",
"packages": [
{
"name": "api-platform/core",

View File

@@ -27,10 +27,6 @@ services:
tags:
- { name: kernel.event_listener, event: kernel.exception, method: onKernelException }
App\Service\DataLakeClient:
arguments:
$baseUrl: '%env(DATA_LAKE_BASE_URL)%'
GuzzleHttp\Client:
class: GuzzleHttp\Client
arguments:

View File

@@ -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()
);
}
}
}

View File

@@ -75,32 +75,14 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
private ?array $accessTokenScopes = null;
#[ORM\ManyToOne(inversedBy: 'employees')]
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
#[Groups(['user:read'])]
private ?Company $company = null;
#[Groups(['user:write'])]
#[SerializedName('password')]
#[Assert\NotBlank(groups: ['postValidation'])]
private ?string $plainPassword = null;
#[ORM\OneToMany(mappedBy: 'ownedBy', targetEntity: Project::class)]
#[Groups(['user:read'])]
private Collection $projects;
#[ORM\OneToMany(mappedBy: 'postedBy', targetEntity: Comment::class)]
private Collection $comments;
#[ORM\OneToMany(mappedBy: 'createdBy', targetEntity: Folder::class)]
private Collection $folders;
public function __construct()
{
$this->apiTokens = new ArrayCollection();
$this->projects = new ArrayCollection();
$this->comments = new ArrayCollection();
$this->folders = new ArrayCollection();
}
public function getId(): ?int
@@ -250,18 +232,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
$this->accessTokenScopes = $scopes;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): static
{
$this->company = $company;
return $this;
}
public function getPlainPassword(): ?string
{
return $this->plainPassword;
@@ -271,94 +241,4 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface
{
$this->plainPassword = $plainPassword;
}
/**
* @return Collection<int, Project>
*/
public function getProjects(): Collection
{
return $this->projects;
}
public function addProject(Project $project): static
{
if (!$this->projects->contains($project)) {
$this->projects->add($project);
$project->setOwnedBy($this);
}
return $this;
}
public function removeProject(Project $project): static
{
if ($this->projects->removeElement($project)) {
// set the owning side to null (unless already changed)
if ($project->getOwnedBy() === $this) {
$project->setOwnedBy(null);
}
}
return $this;
}
/**
* @return Collection<int, Comment>
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): static
{
if (!$this->comments->contains($comment)) {
$this->comments->add($comment);
$comment->setPostedBy($this);
}
return $this;
}
public function removeComment(Comment $comment): static
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getPostedBy() === $this) {
$comment->setPostedBy(null);
}
}
return $this;
}
/**
* @return Collection<int, Folder>
*/
public function getFolders(): Collection
{
return $this->folders;
}
public function addFolder(Folder $folder): static
{
if (!$this->folders->contains($folder)) {
$this->folders->add($folder);
$folder->setCreatedBy($this);
}
return $this;
}
public function removeFolder(Folder $folder): static
{
if ($this->folders->removeElement($folder)) {
// set the owning side to null (unless already changed)
if ($folder->getCreatedBy() === $this) {
$folder->setCreatedBy(null);
}
}
return $this;
}
}