Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * @ORM\Entity(repositoryClass="App\Repository\BookRepository")
- * @ORM\Table(name="books")
- * @ORM\HasLifecycleCallbacks
- */
- class Book
- {
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer", options={"unsigned":true})
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=32)
- */
- private $slug;
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- *
- * @Assert\NotBlank(message="Please, upload the product brochure as a Image file.")
- * @Assert\File(mimeTypes={ "image/jpeg" })
- */
- private $cover;
- /**
- * @ORM\Column(type="string", length=32)
- */
- private $name;
- /**
- * @ORM\Column(type="text")
- */
- private $description;
- /**
- * @ORM\Column(type="date")
- */
- private $released_at;
- /**
- * @ORM\Column(type="datetime")
- */
- private $created_at;
- /**
- * @ORM\Column(type="datetime", nullable=true)
- */
- private $updated_at;
- public function getId()
- {
- return $this->id;
- }
- public function getSlug(): ?string
- {
- return $this->slug;
- }
- public function setSlug(string $slug): self
- {
- $this->slug = $slug;
- return $this;
- }
- public function getCover()
- {
- return $this->cover;
- }
- public function setCover($cover): self
- {
- $this->cover = $cover;
- return $this;
- }
- public function getName(): ?string
- {
- return $this->name;
- }
- public function setName(string $name): self
- {
- $this->name = $name;
- return $this;
- }
- public function getDescription(): ?string
- {
- return $this->description;
- }
- public function setDescription(string $description): self
- {
- $this->description = $description;
- return $this;
- }
- public function getReleasedAt(): ?\DateTimeInterface
- {
- return $this->released_at;
- }
- public function setReleasedAt(\DateTimeInterface $released_at): self
- {
- $this->released_at = $released_at;
- return $this;
- }
- public function getCreatedAt(): ?\DateTimeInterface
- {
- return $this->created_at;
- }
- public function setCreatedAt(\DateTimeInterface $created_at): self
- {
- $this->created_at = $created_at;
- return $this;
- }
- public function getUpdatedAt(): ?\DateTimeInterface
- {
- return $this->updated_at;
- }
- public function setUpdatedAt(?\DateTimeInterface $updated_at): self
- {
- $this->updated_at = $updated_at;
- return $this;
- }
- /**
- *
- * @ORM\PrePersist
- * @ORM\PreUpdate
- */
- public function updatedTimestamps()
- {
- $this->setUpdatedAt(new \DateTime('now'));
- $this->setCreatedAt($this->getCreatedAt() ?? new \DateTime('now'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement