src/Entity/Forum/Group.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Forum;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Traits\CreatedUpdatedTrait;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use JMS\Serializer\Annotation\Exclude;
  8. use JMS\Serializer\Annotation as JMS;
  9. use JMS\Serializer\Annotation as Serializer;
  10. use Symfony\Component\HttpFoundation\File\File;
  11. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  12. /**
  13.  * @ORM\Table(name="v_forum_group")
  14.  * @ORM\Entity(repositoryClass="App\Repository\Forum\GroupRepository")
  15.  * @Vich\Uploadable
  16.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
  17.  */
  18. class Group
  19. {
  20.     /**
  21.      * @ORM\Id()
  22.      * @ORM\GeneratedValue()
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\Column(type="string", length=255)
  28.      */
  29.     private $name;
  30.     /**
  31.      * @var string
  32.      * @Gedmo\Slug(fields={"name"}, updatable=false)
  33.      * @ORM\Column(type="string", length=255)
  34.      */
  35.     private $slug;
  36.     /**
  37.      * @ORM\Column(type="text", nullable=true)
  38.      */
  39.     private $description;
  40.     /**
  41.      * @ORM\Column(type="text", nullable=true)
  42.      */
  43.     private $disclaimers;
  44.     /**
  45.      * @ORM\Column(type="boolean")
  46.      */
  47.     private $suggested false;
  48.     /**
  49.      * @ORM\Column(type="boolean")
  50.      */
  51.     private $enabled true;
  52.     /**
  53.      * @ORM\Column(name="deleted_at", type="datetime", nullable=true)
  54.      */
  55.     private $deletedAt;
  56.     /**
  57.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  58.      *
  59.      * @Vich\UploadableField(mapping="forum_files", fileNameProperty="image")
  60.      *
  61.      * @var File
  62.      * @Exclude
  63.      */
  64.     private $imageFile;
  65.     /**
  66.      * @ORM\Column(name="image", type="string", length=255, nullable=true)
  67.      *
  68.      * @var string
  69.      */
  70.     private $image;
  71.     use CreatedUpdatedTrait;
  72.     public function __toString()
  73.     {
  74.         return (string) $this->name;
  75.     }
  76.     public function getId(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     /**
  81.      * @return mixed
  82.      */
  83.     public function getName()
  84.     {
  85.         return $this->name;
  86.     }
  87.     /**
  88.      * @param mixed $name
  89.      */
  90.     public function setName($name): void
  91.     {
  92.         $this->name $name;
  93.     }
  94.     /**
  95.      * @return string
  96.      */
  97.     public function getSlug(): string
  98.     {
  99.         return $this->slug;
  100.     }
  101.     /**
  102.      * @param string $slug
  103.      */
  104.     public function setSlug(string $slug): void
  105.     {
  106.         $this->slug $slug;
  107.     }
  108.     /**
  109.      * @return mixed
  110.      */
  111.     public function getDescription()
  112.     {
  113.         return $this->description;
  114.     }
  115.     /**
  116.      * @param mixed $description
  117.      */
  118.     public function setDescription($description): void
  119.     {
  120.         $this->description $description;
  121.     }
  122.     /**
  123.      * @return mixed
  124.      */
  125.     public function getDisclaimers()
  126.     {
  127.         return $this->disclaimers;
  128.     }
  129.     /**
  130.      * @param mixed $disclaimers
  131.      */
  132.     public function setDisclaimers($disclaimers): void
  133.     {
  134.         $this->disclaimers $disclaimers;
  135.     }
  136.     /**
  137.      * @return bool
  138.      */
  139.     public function isSuggested(): ?bool
  140.     {
  141.         return $this->suggested;
  142.     }
  143.     /**
  144.      * @param bool $suggested
  145.      */
  146.     public function setSuggested(?bool $suggested): void
  147.     {
  148.         $this->suggested $suggested;
  149.     }
  150.     /**
  151.      * @return bool
  152.      */
  153.     public function isEnabled(): ?bool
  154.     {
  155.         return $this->enabled;
  156.     }
  157.     /**
  158.      * @param bool $enabled
  159.      */
  160.     public function setEnabled(?bool $enabled): void
  161.     {
  162.         $this->enabled $enabled;
  163.     }
  164.     /**
  165.      * @return mixed
  166.      */
  167.     public function getDeletedAt()
  168.     {
  169.         return $this->deletedAt;
  170.     }
  171.     /**
  172.      * @param mixed $deletedAt
  173.      */
  174.     public function setDeletedAt($deletedAt): void
  175.     {
  176.         $this->deletedAt $deletedAt;
  177.     }
  178.     /**
  179.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  180.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  181.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  182.      * must be able to accept an instance of 'File' as the bundle will inject one here
  183.      * during Doctrine hydration.
  184.      *
  185.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $file
  186.      */
  187.     public function setImageFile(File $file null)
  188.     {
  189.         $this->imageFile $file;
  190.         if ($file) {
  191.             // It is required that at least one field changes if you are using doctrine
  192.             // otherwise the event listeners won't be called and the file is lost
  193.             $this->updated = new \DateTime('now');
  194.         }
  195.     }
  196.     /**
  197.      * @return File
  198.      */
  199.     public function getImageFile()
  200.     {
  201.         return $this->imageFile;
  202.     }
  203.     /**
  204.      * @param string $image
  205.      */
  206.     public function setImage($image)
  207.     {
  208.         $this->image $image;
  209.     }
  210.     /**
  211.      * @return string
  212.      */
  213.     public function getImage()
  214.     {
  215.         return $this->image;
  216.     }
  217. }