vendor/elcoag/symfony-process-bundle/src/Entity/Server.php line 19
<?php
namespace Elcoag\SymfonyProcessBundle\Entity;
use Symfony\Component\Serializer\Annotation\Ignore;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use ApiPlatform\Metadata\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Elcoag\SymfonyAdminlteBundle\Annotations\FieldType;
use Elcoag\SymfonyProcessBundle\Repository\ServerRepository;
#[ORM\Entity(repositoryClass: ServerRepository::class)]
#[ApiResource]
class Server
{
/**
* @var array
*
* @Assert\Type("array")
* @FieldType(type="Symfony\Component\Form\Extension\Core\Type\CollectionType", options={"row_attr":"d-none"})
*/
private array $attributes = [
'id',
'name',
'createdAt',
'updatedAt',
'actions',
];
public function getAttributes(): array
{
return $this->attributes;
}
/**
* @var ?int
*
* @Assert\Type("int")
* @FieldType(type="Symfony\Component\Form\Extension\Core\Type\HiddenType")
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
/**
* @var string
*
* @Assert\NotBlank(message="Required field")
* @Assert\Type("string")
* @FieldType(type="Symfony\Component\Form\Extension\Core\Type\TextType", options={"row_attr":"clear-left"})
*/
#[ORM\Column(length: 255)]
private ?string $name = null;
/**
* @var ?\DateTime
*
* @Assert\NotBlank(message="Required field")
* @Assert\Type("DateTime")
* @FieldType(type="Symfony\Component\Form\Extension\Core\Type\DateTimeType", options={"row_attr":"clear-left"})
*/
#[ORM\Column]
private ?\DateTime $created_at = null;
/**
* @var ?\DateTime
*
* @Assert\NotBlank(message="Required field")
* @Assert\Type("DateTime")
* @FieldType(type="Symfony\Component\Form\Extension\Core\Type\DateTimeType", options={"row_attr":"clear-left"})
*/
#[ORM\Column]
private ?\DateTime $updated_at = null;
#[ORM\OneToMany(mappedBy: 'server', targetEntity: Process::class)]
private Collection $processes;
public function __construct()
{
$this->processes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId(string $id): self
{
$this->id = $id;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getCreatedAt(): ?\DateTime
{
return $this->created_at;
}
public function setCreatedAt(\DateTime $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTime
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTime $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection<int, Process>
*/
public function getProcesses(): Collection
{
return $this->processes;
}
public function addProcess(Process $process): self
{
if (!$this->processes->contains($process)) {
$this->processes->add($process);
$process->setServer($this);
}
return $this;
}
public function removeProcess(Process $process): self
{
if ($this->processes->removeElement($process)) {
// set the owning side to null (unless already changed)
if ($process->getServer() === $this) {
$process->setServer(null);
}
}
return $this;
}
}