ogcore/src/Entity/OgRepository.php

87 lines
1.9 KiB
PHP

<?php
namespace App\Entity;
use App\Repository\OgRepositoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: OgRepositoryRepository::class)]
class OgRepository extends AbstractEntity
{
use NameableTrait;
#[ORM\Column(length: 255)]
private ?string $ipAddress = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $description = null;
/**
* @var Collection<int, Client>
*/
#[ORM\OneToMany(mappedBy: 'repository', targetEntity: Client::class)]
private Collection $clients;
public function __construct()
{
parent::__construct();
$this->clients = new ArrayCollection();
}
public function getIpAddress(): ?string
{
return $this->ipAddress;
}
public function setIpAddress(string $ipAddress): static
{
$this->ipAddress = $ipAddress;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, Client>
*/
public function getClients(): Collection
{
return $this->clients;
}
public function addClient(Client $client): static
{
if (!$this->clients->contains($client)) {
$this->clients->add($client);
$client->setRepository($this);
}
return $this;
}
public function removeClient(Client $client): static
{
if ($this->clients->removeElement($client)) {
// set the owning side to null (unless already changed)
if ($client->getRepository() === $this) {
$client->setRepository(null);
}
}
return $this;
}
}