83 lines
1.8 KiB
PHP
83 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\PxeBootFileRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: PxeBootFileRepository::class)]
|
|
class PxeBootFile extends AbstractEntity
|
|
{
|
|
use SynchronizedTrait;
|
|
|
|
#[ORM\ManyToOne]
|
|
private ?PxeTemplate $template = null;
|
|
|
|
/**
|
|
* @var Collection<int, Client>
|
|
*/
|
|
#[ORM\OneToMany(mappedBy: 'pxeBootFile', targetEntity: Client::class)]
|
|
private Collection $clients;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->clients = new ArrayCollection();
|
|
}
|
|
|
|
public function getTemplate(): ?PxeTemplate
|
|
{
|
|
return $this->template;
|
|
}
|
|
|
|
public function setTemplate(?PxeTemplate $template): static
|
|
{
|
|
$this->template = $template;
|
|
|
|
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->setPxeBootFile($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->getPxeBootFile() === $this) {
|
|
$client->setPxeBootFile(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setClients(array $clients): static
|
|
{
|
|
$this->clients->clear();
|
|
|
|
foreach ($clients as $client){
|
|
$this->addClient($client);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|