- toogle chapter visibility
- delete chapter cbz
- preferred ContentSource.php and modal
- minor fixes
This commit is contained in:
Jérémy Guillot
2024-07-21 22:21:04 +02:00
parent fafff5014c
commit c56f72b813
17 changed files with 474 additions and 82 deletions

View File

@@ -45,6 +45,9 @@ class Chapter
#[ORM\Column(length: 255, nullable: true)]
private ?string $cbzPath = null;
#[ORM\Column]
private ?bool $visible = true;
public function __construct()
{
$this->pagesLink = new ArrayCollection();
@@ -194,4 +197,16 @@ class Chapter
return $this;
}
public function isVisible(): ?bool
{
return $this->visible;
}
public function setVisible(bool $visible): static
{
$this->visible = $visible;
return $this;
}
}

View File

@@ -118,4 +118,13 @@ class ContentSource
return $this;
}
public function getCleanBaseUrl(): string
{
return preg_replace(
'/^(https?:\/\/)?(www\.)?|\/+$/',
'',
$this->baseUrl
);
}
}

View File

@@ -62,10 +62,14 @@ class Manga
#[ORM\Column(type: Types::JSON, nullable: true)]
private ?array $AlternativeSlugs = null;
#[ORM\ManyToMany(targetEntity: ContentSource::class)]
private Collection $preferredSources;
public function __construct()
{
$this->chapters = new ArrayCollection();
$this->createdAt = new \DateTimeImmutable();
$this->preferredSources = new ArrayCollection();
}
public function getId(): ?int
@@ -280,4 +284,38 @@ class Manga
return $this;
}
/**
* @return Collection<int, ContentSource>
*/
public function getPreferredSources(): Collection
{
return $this->preferredSources;
}
public function addPreferredSource(ContentSource $preferredSource): static
{
if (!$this->preferredSources->contains($preferredSource)) {
$this->preferredSources->add($preferredSource);
}
return $this;
}
public function removePreferredSource(ContentSource $preferredSource): static
{
$this->preferredSources->removeElement($preferredSource);
return $this;
}
public function setPreferredSources(array $sources): self
{
$this->preferredSources->clear();
foreach ($sources as $source) {
$this->addPreferredSource($source);
}
return $this;
}
}