191 lines
4.1 KiB
PHP
191 lines
4.1 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\CommandTaskRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: CommandTaskRepository::class)]
|
|
class CommandTask extends AbstractEntity
|
|
{
|
|
/**
|
|
* @var Collection<int, Command>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: Command::class, inversedBy: 'commandTasks')]
|
|
private Collection $commands;
|
|
|
|
/**
|
|
* @var Collection<int, CommandGroup>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: CommandGroup::class, inversedBy: 'commandTasks')]
|
|
private Collection $commandGroups;
|
|
|
|
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
|
private ?\DateTimeInterface $datetime = null;
|
|
|
|
#[ORM\Column(length: 255, nullable: true)]
|
|
private ?string $notes = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $status = null;
|
|
|
|
/**
|
|
* @var Collection<int, Client>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: Client::class)]
|
|
private Collection $clients;
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->commands = new ArrayCollection();
|
|
$this->commandGroups = new ArrayCollection();
|
|
$this->clients = new ArrayCollection();
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Command>
|
|
*/
|
|
public function getCommands(): Collection
|
|
{
|
|
return $this->commands;
|
|
}
|
|
|
|
public function setCommands(array $commands): static
|
|
{
|
|
$this->commands->clear();
|
|
|
|
foreach ($commands as $command){
|
|
$this->addCommand($command);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function addCommand(Command $command): static
|
|
{
|
|
if (!$this->commands->contains($command)) {
|
|
$this->commands->add($command);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeCommand(Command $command): static
|
|
{
|
|
$this->commands->removeElement($command);
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, CommandGroup>
|
|
*/
|
|
public function getCommandGroups(): Collection
|
|
{
|
|
return $this->commandGroups;
|
|
}
|
|
|
|
public function setCommandGroups(array $commandGroups): static
|
|
{
|
|
$this->commandGroups->clear();
|
|
|
|
foreach ($commandGroups as $commandGroup){
|
|
$this->addCommandGroup($commandGroup);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function addCommandGroup(CommandGroup $commandGroup): static
|
|
{
|
|
if (!$this->commandGroups->contains($commandGroup)) {
|
|
$this->commandGroups->add($commandGroup);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeCommandGroup(CommandGroup $commandGroup): static
|
|
{
|
|
$this->commandGroups->removeElement($commandGroup);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDatetime(): ?\DateTimeInterface
|
|
{
|
|
return $this->datetime;
|
|
}
|
|
|
|
public function setDatetime(\DateTimeInterface $datetime): static
|
|
{
|
|
$this->datetime = $datetime;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getNotes(): ?string
|
|
{
|
|
return $this->notes;
|
|
}
|
|
|
|
public function setNotes(?string $notes): static
|
|
{
|
|
$this->notes = $notes;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getStatus(): ?string
|
|
{
|
|
return $this->status;
|
|
}
|
|
|
|
public function setStatus(string $status): static
|
|
{
|
|
$this->status = $status;
|
|
|
|
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);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeClient(Client $client): static
|
|
{
|
|
$this->clients->removeElement($client);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setClients(array $clients): static
|
|
{
|
|
$this->clients->clear();
|
|
|
|
foreach ($clients as $client){
|
|
$this->addClient($client);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|