src/Entity/CookingTricks.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\traits\HasImage;
  4. use App\Entity\traits\HasSlug;
  5. use App\Entity\traits\Timestapable;
  6. use App\Repository\CookingTricksRepository;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Doctrine\ORM\Mapping\PrePersist;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. #[ORM\Entity(repositoryClassCookingTricksRepository::class)]
  13. class CookingTricks
  14. {
  15.     use Timestapable;
  16.     use HasImage;
  17.     use HasSlug;
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     #[Groups(["user_info"])]
  22.     private ?int $id null;
  23.     #[ORM\ManyToOne(inversedBy'cookingTricks')]
  24.     #[Groups(["user_info"])]
  25.     private ?User $user null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     #[Assert\NotNull(message'Le Champ titre est requis')]
  28.     #[Assert\NotBlank(message'Le Champ titre est requis')]
  29.     #[Groups(["user_info"])]
  30.     private ?string $title null;
  31.     #[ORM\Column(length255)]
  32.     #[Groups(["user_info"])]
  33.     private ?string $name null;
  34.     #[ORM\Column(length255)]
  35.     #[Groups(["user_info"])]
  36.     private ?string $email null;
  37.     #[ORM\Column(length255)]
  38.     #[Groups(["user_info"])]
  39.     private ?string $phone_number null;
  40.     #[ORM\Column(typeTypes::TEXT)]
  41.     #[Assert\NotNull(message'Champ Contenu est requis')]
  42.     #[Assert\NotBlank(message'Ce Champ est requis')]
  43.     #[Groups(["user_info"])]
  44.     private ?string $body null;
  45.     #[ORM\Column(nullabletrue)]
  46.     #[Groups(["user_info"])]
  47.     private ?bool $isActive null;
  48.     #[ORM\Column(length255nullabletrue)]
  49.     #[Groups(["user_info"])]
  50.     private ?string $PE null;
  51.     #[ORM\ManyToOne(inversedBy'cookingTricks')]
  52.     #[Groups(["user_info"])]
  53.     private ?CookingTricksCategory $cookingTricksCategory null;
  54.     #[ORM\Column(length255)]
  55.     #[Groups(["user_info"])]
  56.     private ?string $slug null;
  57.     #[Groups(["user_info"])]
  58.     private ?string $imageMiniature null;
  59.     public function getId(): ?int
  60.     {
  61.         return $this->id;
  62.     }
  63.     #[PrePersist]
  64.     public function addCreatedAt()
  65.     {
  66.         $this->setCreatedAt(new \DateTimeImmutable());
  67.         $this->setUpdatedAt(new \DateTimeImmutable());
  68.     }
  69.     public function getUser($need false)
  70.     {
  71.         if ($need == true) {
  72.             return $this->user;
  73.         }
  74.         return null;
  75.     }
  76.     public function setUser(?User $user): self
  77.     {
  78.         $this->user $user;
  79.         return $this;
  80.     }
  81.     public function getName(): ?string
  82.     {
  83.         return $this->name;
  84.     }
  85.     public function setName(string $name): self
  86.     {
  87.         $this->name $name;
  88.         return $this;
  89.     }
  90.     public function getEmail(): ?string
  91.     {
  92.         return $this->email;
  93.     }
  94.     public function setEmail(string $email): self
  95.     {
  96.         $this->email $email;
  97.         return $this;
  98.     }
  99.     public function getBody(): ?string
  100.     {
  101.         return $this->body;
  102.     }
  103.     public function setBody(string $body): self
  104.     {
  105.         $this->body $body;
  106.         return $this;
  107.     }
  108.     public function isIsActive(): ?bool
  109.     {
  110.         return $this->isActive;
  111.     }
  112.     public function setIsActive(?bool $isActive): self
  113.     {
  114.         $this->isActive $isActive;
  115.         return $this;
  116.     }
  117.     public function getPE(): ?string
  118.     {
  119.         return $this->PE;
  120.     }
  121.     public function setPE(string $PE): self
  122.     {
  123.         $this->PE $PE;
  124.         return $this;
  125.     }
  126.     public function getCookingTricksCategory(): ?CookingTricksCategory
  127.     {
  128.         return $this->cookingTricksCategory;
  129.     }
  130.     public function setCookingTricksCategory(?CookingTricksCategory $cookingTricksCategory): self
  131.     {
  132.         $this->cookingTricksCategory $cookingTricksCategory;
  133.         return $this;
  134.     }
  135.     /**
  136.      * Get the value of phone_number
  137.      */
  138.     public function getPhoneNumber()
  139.     {
  140.         return $this->phone_number;
  141.     }
  142.     /**
  143.      * Set the value of phone_number
  144.      *
  145.      * @return  self
  146.      */
  147.     public function setPhoneNumber($phone_number)
  148.     {
  149.         $this->phone_number $phone_number;
  150.         return $this;
  151.     }
  152.     public function getTitle()
  153.     {
  154.         return $this->title;
  155.     }
  156.     public function setTitle($title)
  157.     {
  158.         $this->title $title;
  159.         return $this;
  160.     }
  161.     public function getUrl()
  162.     {
  163.         return $this->url;
  164.     }
  165.     public function getSlug(): ?string
  166.     {
  167.         return $this->slug;
  168.     }
  169.     public function setSlug(string $slug): self
  170.     {
  171.         $this->slug $slug;
  172.         return $this;
  173.     }
  174.     public function getImageMiniature()
  175. {
  176.         return $this->imageMiniature;
  177.     }
  178.     public function setImageMiniature($imageMiniature)
  179. {
  180.         $this->imageMiniature $imageMiniature;
  181.         return $this;
  182.     }
  183. }