<?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\Validator\Constraints as Assert;
use Symfony\Component\Serializer\Annotation\Groups;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
/**
* A media object, such as an image, video, audio, or text object embedded in a web page or a downloadable dataset i.e. DataDownload. Note that a creative work may have many media objects associated with it on the same web page. For example, a page about a single song (MusicRecording) may have a music video (VideoObject), and a high and low bandwidth audio stream (2 AudioObject's).
*
* @see https://schema.org/MediaObject
*
* @author Jordi Fernandes Alves <jfadev@gmail.com>
*/
#[ORM\Entity]
#[ApiResource(
iri: 'Document',
itemOperations: [
'get' => ['normalization_context' => ['groups' => 'document:item:get', 'enable_max_depth' => true]],
'put' => [
'normalization_context' => ['groups' => 'document:item:put', 'enable_max_depth' => true],
'denormalization_context' => ['groups' => 'document:item:put', 'enable_max_depth' => true],
],
'delete' => [],
],
collectionOperations: [
'get' => [
'normalization_context' => [
'groups' => ['document:collection:get', 'createdAt'],
'enable_max_depth' => true,
],
],
'post' => [
'normalization_context' => ['groups' => 'document:collection:post', 'enable_max_depth' => true],
'denormalization_context' => ['groups' => 'document:collection:post', 'enable_max_depth' => true],
],
],
)]
class Document
{
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'NONE')]
#[ORM\Column(type: 'uuid', unique: true)]
#[ApiProperty(iri: 'https://schema.org/identifier')]
#[Groups(['document:item:get', 'document:item:put', 'document:collection:get', 'document:collection:post'])]
private ?int $id = null;
/**
* Date (including time if available) when this media object was uploaded to this site.
*
* @see https://schema.org/uploadDate
*/
#[ORM\Column(type: 'datetime', nullable: false)]
#[ApiProperty(iri: 'https://schema.org/uploadDate')]
#[Assert\Type(\DateTimeInterface::class)]
#[Groups(['document:item:get', 'document:item:put', 'document:collection:get', 'document:collection:post'])]
private ?\DateTimeInterface $uploadDate = null;
public function __construct()
{
$this->id = Uuid::uuid4();
}
public function getId(): ?UuidInterface
{
return $this->id;
}
public function setUploadDate(?\DateTimeInterface $uploadDate): void
{
$this->uploadDate = $uploadDate;
}
public function getUploadDate(): ?\DateTimeInterface
{
return $this->uploadDate;
}
}