<?php
// @deprecated
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Trait\TimestampableEntity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
/**
* @see https://schema.org/Thing
*
* @author Jordi Fernandes Alves <jfadev@gmail.com>
*/
#[ORM\Entity]
#[ApiResource(
iri: 'RelatedEntity',
itemOperations: [
'get' => ['normalization_context' => ['groups' => 'related_entity:item:get']],
'put' => [
'normalization_context' => ['groups' => 'related_entity:item:put'],
'denormalization_context' => ['groups' => 'related_entity:item:put'],
],
'delete' => [],
],
collectionOperations: [
'get' => [
'normalization_context' => ['groups' => 'related_entity:collection:get'],
],
'post' => [
'normalization_context' => ['groups' => 'related_entity:collection:post'],
'denormalization_context' => ['groups' => 'related_entity:collection:post'],
],
],
)]
class RelatedEntity
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'NONE')]
#[ORM\Column(type: 'uuid', unique: true)]
#[ApiProperty(iri: 'https://schema.org/identifier')]
#[Groups(['related_entity:collection:get', 'related_entity:item:get'])]
private ?UuidInterface $id = null;
#[ORM\Column(type: 'string', nullable: false)]
#[Assert\NotNull]
#[Assert\Type('string')]
#[ApiProperty(iri: 'https://schema.org/Text')]
#[Groups(['related_entity:collection:get', 'related_entity:collection:post', 'related_entity:item:get', 'related_entity:item:put'])]
private ?string $entityType = null;
#[ORM\Column(type: 'string', nullable: false)]
#[Assert\NotNull]
#[Assert\Type('string')]
#[ApiProperty(iri: 'https://schema.org/Text')]
#[Groups(['related_entity:collection:get', 'related_entity:collection:post', 'related_entity:item:get', 'related_entity:item:put'])]
private ?string $entityId = null;
public function __construct()
{
$this->id = Uuid::uuid4();
}
public function getId(): ?UuidInterface
{
return $this->id;
}
public function setEntityType(?string $entityType): void
{
$this->entityType = $entityType;
}
public function getEntityType(): ?string
{
return $this->entityType;
}
public function setEntityId(?string $entityId): void
{
$this->entityId = $entityId;
}
public function getEntityId(): ?string
{
return $this->entityId;
}
}