87 lines
1.8 KiB
PHP
87 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\ImageRepositoryRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: ImageRepositoryRepository::class)]
|
|
class ImageRepository extends AbstractEntity
|
|
{
|
|
use NameableTrait;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $ip = null;
|
|
|
|
#[ORM\Column(length: 255, nullable: true)]
|
|
private ?string $comments = null;
|
|
|
|
/**
|
|
* @var Collection<int, Image>
|
|
*/
|
|
#[ORM\OneToMany(mappedBy: 'repository', targetEntity: Image::class)]
|
|
private Collection $images;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->images = new ArrayCollection();
|
|
}
|
|
|
|
public function getIp(): ?string
|
|
{
|
|
return $this->ip;
|
|
}
|
|
|
|
public function setIp(string $ip): static
|
|
{
|
|
$this->ip = $ip;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getComments(): ?string
|
|
{
|
|
return $this->comments;
|
|
}
|
|
|
|
public function setComments(?string $comments): static
|
|
{
|
|
$this->comments = $comments;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Image>
|
|
*/
|
|
public function getImages(): Collection
|
|
{
|
|
return $this->images;
|
|
}
|
|
|
|
public function addImage(Image $image): static
|
|
{
|
|
if (!$this->images->contains($image)) {
|
|
$this->images->add($image);
|
|
$image->setRepository($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeImage(Image $image): static
|
|
{
|
|
if ($this->images->removeElement($image)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($image->getRepository() === $this) {
|
|
$image->setRepository(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|