<?phpnamespace App\Entity\MediaObject;use App\Entity\Knowledge\KnowledgeResponse;use App\Repository\MediaObject\MediaKnowledgeResponseRepository;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\Serializer\Annotation\SerializedName;use Symfony\Component\Serializer\Annotation\Groups;use Vich\UploaderBundle\Mapping\Annotation as Vich;use ApiPlatform\Core\Annotation\ApiResource;/** * @ApiResource( * attributes={ * "normalization_context"={"groups"={ * "Knowledge:output" * }} * }, * iri="http://schema.org/MediaKnowledgeResponse", * collectionOperations={ * "get" * }, * itemOperations={ * "get" * } * ) * * @ORM\Entity(repositoryClass=MediaKnowledgeResponseRepository::class) * @Vich\Uploadable() */class MediaKnowledgeResponse extends MediaObject{ /** * @ORM\OneToOne(targetEntity=KnowledgeResponse::class, mappedBy="image", cascade={"persist", "remove"}) */ private ?KnowledgeResponse $knowledgeResponse; /** * @var string|null * @SerializedName("content_url") * @Groups({"Knowledge:output"}) */ private ?string $contentUrl; /** * @var File|null * @Vich\UploadableField(mapping="knowledge_response_image", fileNameProperty="filePath") */ public ?File $file; /** * @var string|null * * @ORM\Column(nullable=true) * @SerializedName("file_path") * @Groups({"Knowledge:output"}) */ public $filePath; public function getKnowledgeResponse(): ?KnowledgeResponse { return $this->knowledgeResponse; } public function setKnowledgeResponse(?KnowledgeResponse $knowledgeResponse): self { // unset the owning side of the relation if necessary if ($knowledgeResponse === null && $this->knowledgeResponse !== null) { $this->knowledgeResponse->setImage(null); } // set the owning side of the relation if necessary if ($knowledgeResponse !== null && $knowledgeResponse->getImage() !== $this) { $knowledgeResponse->setImage($this); } $this->knowledgeResponse = $knowledgeResponse; return $this; } public function getContentUrl(): ?string { return $this->contentUrl; } public function setContentUrl(?string $contentUrl): MediaKnowledgeResponse { $this->contentUrl = $contentUrl; return $this; } public function __toString(): string { return ''; }}