src/Entity/Evento.php line 36
<?phpnamespace App\Entity;use Ramsey\Uuid\Uuid;use App\Trait\UuidTrait;use ApiPlatform\Metadata\Get;use ApiPlatform\Metadata\Put;use App\Trait\BlameableTrait;use ApiPlatform\Metadata\Post;use Doctrine\DBAL\Types\Types;use ApiPlatform\Metadata\Patch;use ApiPlatform\Metadata\Delete;use Doctrine\ORM\Mapping as ORM;use App\Trait\TimestampableTrait;use App\Repository\EventoRepository;use ApiPlatform\Metadata\ApiResource;use ApiPlatform\Metadata\GetCollection;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ArrayCollection;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: EventoRepository::class)]#[ApiResource(operations: [new GetCollection(),new Post(validationContext: ['groups' => ['Default', 'evento:create']], denormalizationContext: ['groups' => ['evento:create']]),new Get(),new Put(denormalizationContext: ['groups' => ['evento:update']]),new Patch(denormalizationContext: ['groups' => ['evento:update']]),new Delete(),],normalizationContext: ['groups' => ['evento:read', 'uuid']],)]class Evento{use BlameableTrait;use TimestampableTrait;use UuidTrait;public const TIPO_MANUAL = 'evento.manual';public const TIPO_AUTOMATICO = 'evento.automatico';#[Assert\NotNull(groups: ['evento:create'])]#[Groups(['evento:read','evento:create', 'evento:update'])]#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $desde = null;#[Assert\NotNull(groups: ['evento:create'])]#[Groups(['evento:read', 'evento:create', 'evento:update'])]#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $hasta = null;#[Groups(['evento:read', 'evento:create', 'evento:update'])]#[ORM\ManyToMany(targetEntity: User::class)]private Collection $users;#[Assert\NotNull(groups: ['evento:create'])]#[Groups(['evento:read', 'evento:create', 'evento:update'])]#[ORM\Column(length: 255)]private ?string $titulo = null;#[Groups(['evento:read', 'evento:create', 'evento:update'])]#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $descripcion = null;#[Groups(['evento:read'])]#[ORM\Column(length: 255)]private ?string $tipo = null;#[Groups(['evento:read', 'evento:create', 'evento:update'])]#[ORM\Column(length: 255, nullable: true)]private ?string $modulo = null;#[Groups(['evento:read', 'evento:create', 'evento:update'])]#[ORM\Column(length: 255, nullable: true)]private ?string $refUuid = null;#[ORM\ManyToOne(inversedBy: 'eventos')]#[ORM\JoinColumn(nullable: false)]private ?Empresa $empresa = null;public function __construct(){$this->users = new ArrayCollection();$this->uuid = Uuid::uuid4()->toString();}public function getDesde(): ?\DateTimeInterface{return $this->desde;}public function setDesde(\DateTimeInterface $desde): self{$this->desde = $desde;return $this;}public function getHasta(): ?\DateTimeInterface{return $this->hasta;}public function setHasta(\DateTimeInterface $hasta): self{$this->hasta = $hasta;return $this;}/*** @return Collection<int, User>*/public function getUsers(): Collection{return $this->users;}public function addUser(User $user): self{if (!$this->users->contains($user)) {$this->users->add($user);}return $this;}public function removeUser(User $user): self{$this->users->removeElement($user);return $this;}public function getTitulo(): ?string{return $this->titulo;}public function setTitulo(string $titulo): self{$this->titulo = $titulo;return $this;}public function getDescripcion(): ?string{return $this->descripcion;}public function setDescripcion(?string $descripcion): self{$this->descripcion = $descripcion;return $this;}public function getTipo(): ?string{return $this->tipo;}public function setTipo(string $tipo): self{$this->tipo = $tipo;return $this;}public function getModulo(): ?string{return $this->modulo;}public function setModulo(?string $modulo): self{$this->modulo = $modulo;return $this;}public function getRefUuid(): ?string{return $this->refUuid;}public function setRefUuid(?string $refUuid): self{$this->refUuid = $refUuid;return $this;}public function getEmpresa(): ?Empresa{return $this->empresa;}public function setEmpresa(?Empresa $empresa): self{$this->empresa = $empresa;return $this;}}