- 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

100
src/Entity/Manga.php Normal file
View File

@@ -0,0 +1,100 @@
<?php
namespace App\Entity;
use App\Repository\MangaRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MangaRepository::class)]
class Manga
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $title = null;
#[ORM\OneToMany(mappedBy: 'manga', targetEntity: Chapter::class, orphanRemoval: true)]
private Collection $chapters;
#[ORM\Column(length: 255)]
private ?string $slug = null;
public function __construct()
{
$this->chapters = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
/**
* @return Collection<int, Chapter>
*/
public function getChapters(): Collection
{
return $this->chapters;
}
public function getChapterByNumber(float $number): ?Chapter
{
foreach ($this->chapters as $chapter) {
if ($chapter->getNumber() === $number) {
return $chapter;
}
}
return null;
}
public function addChapter(Chapter $chapter): self
{
if (!$this->chapters->contains($chapter)) {
$this->chapters->add($chapter);
$chapter->setManga($this);
}
return $this;
}
public function removeChapter(Chapter $chapter): self
{
if ($this->chapters->removeElement($chapter)) {
// set the owning side to null (unless already changed)
if ($chapter->getManga() === $this) {
$chapter->setManga(null);
}
}
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
}