<?php
namespace App\Entity\Knowledge;
use App\Entity\MediaObject\MediaKnowledgeResponse;
use App\Repository\Knowledge\KnowledgeResponseRepository;
use Doctrine\ORM\Mapping as ORM;
use Ramsey\Uuid\Doctrine\UuidGenerator;
use Ramsey\Uuid\Uuid;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Serializer\Annotation\SerializedName;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Core\Annotation\ApiResource;
/**
* @ApiResource(
* attributes={
* "normalization_context"={"groups"={
* "Knowledge:output"
* }}
* },
* iri="http://schema.org/KnowledgeResponse",
* collectionOperations={
* "get"
* },
* itemOperations={
* "get"
* }
* )
*
* @ORM\Entity(repositoryClass=KnowledgeResponseRepository::class)
* @Vich\Uploadable()
*/
class KnowledgeResponse
{
/**
* @ORM\Id
* @ORM\Column(type="uuid", unique=true)
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
* @SerializedName("id")
* @Groups({"Knowledge:output"})
*/
private string $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"Knowledge:output"})
*/
private ?string $text;
/**
* @ORM\OneToOne(targetEntity=MediaKnowledgeResponse::class, inversedBy="knowledgeResponse", cascade={"persist", "remove"})
* @Groups({"Knowledge:output"})
*/
private ?MediaKnowledgeResponse $image = null;
public ?File $file = null;
/**
* @ORM\ManyToOne(targetEntity=Knowledge::class, inversedBy="knowledgeResponses")
*/
private ?Knowledge $knowledge;
/**
* @ORM\Column(type="integer", nullable=true)
* @Groups({"Knowledge:output"})
*/
private ?int $position = null;
public function __construct()
{
$this->id = Uuid::uuid4();
}
public function getId(): ?string
{
return $this->id;
}
public function getText(): ?string
{
return $this->text;
}
public function setText(?string $text): self
{
$this->text = $text;
return $this;
}
public function getImage(): ?MediaKnowledgeResponse
{
return $this->image;
}
public function setImage(?MediaKnowledgeResponse $image): self
{
$this->image = $image;
return $this;
}
public function getKnowledge(): ?Knowledge
{
return $this->knowledge;
}
public function setKnowledge(?Knowledge $knowledge): self
{
$this->knowledge = $knowledge;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
}