<?phpnamespace App\Entity\Core;use Doctrine\DBAL\Types\Types;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Validator\Constraints as Assert;use Doctrine\ORM\Mapping as ORM;use Vich\UploaderBundle\Mapping\Annotation as Vich;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\HttpFoundation\File\UploadedFile;use Vich\UploaderBundle\Entity\File as EmbeddedFile;/** * Ebook * * @ORM\Table("core_ebook") * @ORM\Entity(repositoryClass="App\Repository\Core\EbookRepository") * @ORM\HasLifecycleCallbacks() * @Vich\Uploadable */class Ebook{ /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @var string * * @ORM\Column(name="created_at", type="date", nullable=true) */ private $createdAt; /** * @var string * * @ORM\Column(name="updated_at", type="date", nullable=true) */ private $updatedAt; /** * @var string * * @ORM\Column(name="title", type="string", length=255, nullable=true) */ private $title; /** * @var string * * @ORM\Column(name="description", type="text", nullable=true) */ private $description; /** * @var string * * @ORM\Column(name="description_form", type="text", nullable=true) */ private $descriptionForm; /** * @var string * * @ORM\Column(name="short_title", type="string", length=255, nullable=true) */ private $shortTitle; /** * @var string * * @ORM\Column(name="short_description", type="string", length=255, nullable=true) */ private $shortDescription; /** * NOTE: This is not a mapped field of entity metadata, just a simple property. * * @Vich\UploadableField(mapping="ebooks_files", fileNameProperty="image.name", size="image.size", mimeType="image.mimeType", originalName="image.originalName", dimensions="image.dimensions") * * @var File|null */ private $imageFile; /** * @ORM\Embedded(class="Vich\UploaderBundle\Entity\File") * * @var EmbeddedFile */ private $image; /** * @var string * * @ORM\Column(name="html", type="text", nullable=true) */ private $html; /** * @var string * * @ORM\Column(name="javascript", type="text", nullable=true) */ private $javascript; /** * @var string * * @ORM\Column(name="valide", type="boolean", nullable=true) */ private $valide; /** * @var string * * @ORM\Column(name="subtitle", type="text", nullable=true) */ private $subtitle; /** * @var string * * @ORM\Column(name="title_download", type="text", nullable=true) */ private $titleDownload; /** * @var string * * @ORM\Column(name="description_download", type="text", nullable=true) */ private $descriptionDownload; /** * @var string * * @ORM\Column(name="button_download", type="text", nullable=true) */ private $buttonDownload; public function __construct() { $this->image = new \Vich\UploaderBundle\Entity\File(); } /** * @ORM\PrePersist */ public function setCreatedAtValue(): void { $this->setCreatedAt(new \DateTime("now")); $this->setUpdatedAt(new \DateTime("now")); } /** * @ORM\PreUpdate */ public function setUpdatedAtValue(): void { $this->setUpdatedAt(new \DateTime("now")); } public function __toString() { return (string)$this->title; } /** * If manually uploading a file (i.e. not using Symfony Form) ensure an instance * of 'UploadedFile' is injected into this setter to trigger the update. If this * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter * must be able to accept an instance of 'File' as the bundle will inject one here * during Doctrine hydration. * * @param File|UploadedFile|null $imageFile */ public function setImageFile(?File $imageFile = null) { $this->imageFile = $imageFile; if (null !== $imageFile) { // It is required that at least one field changes if you are using doctrine // otherwise the event listeners won't be called and the file is lost $this->setUpdatedAt(new \DateTime("now")); } } public function getImageFile(): ?File { return $this->imageFile; } public function setImage(EmbeddedFile $image): void { $this->image = $image; } public function getImage(): ?EmbeddedFile { return $this->image; } public function getId(): ?int { return $this->id; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(?\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function getTitle(): ?string { return $this->title; } public function setTitle(?string $title): self { $this->title = $title; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } public function getDescriptionForm(): ?string { return $this->descriptionForm; } public function setDescriptionForm(?string $descriptionForm): self { $this->descriptionForm = $descriptionForm; return $this; } public function getShortTitle(): ?string { return $this->shortTitle; } public function setShortTitle(?string $shortTitle): self { $this->shortTitle = $shortTitle; return $this; } public function getShortDescription(): ?string { return $this->shortDescription; } public function setShortDescription(?string $shortDescription): self { $this->shortDescription = $shortDescription; return $this; } public function getHtml(): ?string { return $this->html; } public function setHtml(?string $html): self { $this->html = $html; return $this; } public function getValide(): ?bool { return $this->valide; } public function setValide(?bool $valide): self { $this->valide = $valide; return $this; } public function getSubtitle(): ?string { return $this->subtitle; } public function setSubtitle(?string $subtitle): self { $this->subtitle = $subtitle; return $this; } public function getTitleDownload(): ?string { return $this->titleDownload; } public function setTitleDownload(?string $titleDownload): self { $this->titleDownload = $titleDownload; return $this; } public function getDescriptionDownload(): ?string { return $this->descriptionDownload; } public function setDescriptionDownload(?string $descriptionDownload): self { $this->descriptionDownload = $descriptionDownload; return $this; } public function getButtonDownload(): ?string { return $this->buttonDownload; } public function setButtonDownload(?string $buttonDownload): self { $this->buttonDownload = $buttonDownload; return $this; } public function getjavascript(): ?string { return $this->javascript; } public function setJavascript(?string $javascript): self { $this->javascript = $javascript; return $this; } public function isValide(): ?bool { return $this->valide; }}