src/Entity/MediaObject.php line 49
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiProperty;use ApiPlatform\Metadata\ApiResource;use ApiPlatform\Metadata\Get;use ApiPlatform\Metadata\GetCollection;use ApiPlatform\Metadata\Post;use ApiPlatform\OpenApi\Model;use App\Controller\Api\CreateMediaObjectController;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\Serializer\Annotation\Groups;use Symfony\Component\Validator\Constraints as Assert;use Vich\UploaderBundle\Mapping\Annotation as Vich;#[Vich\Uploadable]#[ORM\Entity]#[ApiResource(normalizationContext: ['groups' => ['user_signature:read']],types: ['https://schema.org/MediaObject'],operations: [new Get(),new GetCollection(),new Post(controller: CreateMediaObjectController::class,deserialize: false,validationContext: ['groups' => ['Default', 'user_signature_create']],openapi: new Model\Operation(requestBody: new Model\RequestBody(content: new \ArrayObject(['multipart/form-data' => ['schema' => ['type' => 'object','properties' => ['file' => ['type' => 'string','format' => 'binary'],]]]]))))])]class MediaObject{#[ORM\Id, ORM\Column, ORM\GeneratedValue]private ?int $id = null;#[ApiProperty(types: ['https://schema.org/contentUrl'])]#[Groups(['user_signature:read'])]public ?string $contentUrl = null;#[Vich\UploadableField(mapping: "user_signature", fileNameProperty: "filePath")]#[Assert\NotNull(groups: ['user_signature_create'])]public ?File $file = null;#[ORM\Column(nullable: true)]public ?string $filePath = null;#[ORM\ManyToOne(inversedBy: 'file')]#[Assert\NotNull(groups: ['user_signature_create', 'user_signature:read'])]private ?User $user = null;#[ORM\Column(length: 255)]private ?string $type = null;public function getId(): ?int{return $this->id;}public function getUser(): ?User{return $this->user;}public function setUser(?User $user): static{$this->user = $user;return $this;}public function getType(): ?string{return $this->type;}public function setType(string $type): static{$this->type = $type;return $this;}/*** Get the value of filePath*/public function getFilePath(){return $this->filePath;}/*** Set the value of filePath** @return self*/public function setFilePath($filePath){$this->filePath = $filePath;return $this;}}