src/Entity/ContentBlock.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Traits\CreatedUpdatedTrait;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use JMS\Serializer\Annotation as Serializer;
  7. use JMS\Serializer\Annotation\Exclude;
  8. use JMS\Serializer\Annotation\ExclusionPolicy;
  9. /**
  10.  * @ORM\Table(name="v_content_block")
  11.  * @ORM\Entity(repositoryClass="App\Repository\ContentBlockRepository")
  12.  * @ORM\HasLifecycleCallbacks()
  13.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=true)
  14.  * @ExclusionPolicy("none")
  15.  */
  16. class ContentBlock
  17. {
  18.     /**
  19.      * @ORM\Id()
  20.      * @ORM\GeneratedValue()
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity="Clinic")
  26.      * @Exclude()
  27.      */
  28.     private $clinic;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity="User")
  31.      */
  32.     private $user;
  33.     /**
  34.      * @ORM\Column(type="string", length=255)
  35.      */
  36.     private $title;
  37.     /**
  38.      * @var string
  39.      * @Gedmo\Slug(fields={"title"}, updatable=false)
  40.      * @ORM\Column(type="string", length=255)
  41.      */
  42.     private $slug;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     private $image;
  47.     /**
  48.      * @ORM\Column(name="detail_image", type="string", length=255, nullable=true)
  49.      */
  50.     private $detailImage;
  51.     /**
  52.      * 
  53.      * @ORM\Column(type="string", length=255, nullable=true)
  54.      */
  55.     private $caption;
  56.     /**
  57.      * @ORM\Column(type="text", nullable=true)
  58.      */
  59.     private $content;
  60.     /**
  61.      * @ORM\Column(type="boolean")
  62.      */
  63.     private $enabled;
  64.     /**
  65.      * @ORM\Column(type="string", length=255, nullable=true)
  66.      */
  67.     private $link;
  68.      /**
  69.      * @var string
  70.      *
  71.      * @ORM\Column(name="tracking_code", type="string", length=255, nullable=true)
  72.      */
  73.     private $trackingCode;
  74.     /**
  75.      * @Gedmo\SortablePosition
  76.      * @ORM\Column(type="integer")
  77.      */
  78.     private $position=0;
  79.     /**
  80.      * @ORM\Column(type="text", nullable=true)
  81.      */
  82.     private $previewText;
  83.     /**
  84.      * @ORM\Column(name="deleted_at", type="datetime", nullable=true)
  85.      */
  86.     private $deletedAt;
  87.     /**
  88.      * @ORM\Column(name="read_time", type="integer", nullable=true)
  89.      */
  90.     private $readTime;
  91.     /**
  92.      * @ORM\Column(type="string", length=20, nullable=true)
  93.      */
  94.     private $language;
  95.     public function __construct()
  96.     {
  97.         $this->setTrackingCode('iom-cb-'.date('Ymdhis').'-'.rand(1000,9999));
  98.     }
  99.     use CreatedUpdatedTrait;
  100.     public function __toString()
  101.     {
  102.         return (string) $this->title;
  103.     }
  104.     public function getId(): ?int
  105.     {
  106.         return $this->id;
  107.     }
  108.     /**
  109.      * @return mixed
  110.      */
  111.     public function getClinic()
  112.     {
  113.         return $this->clinic;
  114.     }
  115.     /**
  116.      * @param mixed $clinic
  117.      */
  118.     public function setClinic($clinic): void
  119.     {
  120.         $this->clinic $clinic;
  121.     }
  122.     /**
  123.      * @return mixed
  124.      */
  125.     public function getUser()
  126.     {
  127.         return $this->user;
  128.     }
  129.     /**
  130.      * @param mixed $user
  131.      */
  132.     public function setUser($user): void
  133.     {
  134.         $this->user $user;
  135.     }
  136.     public function getTitle(): ?string
  137.     {
  138.         return $this->title;
  139.     }
  140.     public function setTitle(string $title): self
  141.     {
  142.         $this->title $title;
  143.         return $this;
  144.     }
  145.     /**
  146.      * @return string|null
  147.      */
  148.     public function getSlug(): ?string
  149.     {
  150.         return $this->slug;
  151.     }
  152.     /**
  153.      * @param string|null $slug
  154.      * @return ContentBlock
  155.      */
  156.     public function setSlug(?string $slug): self
  157.     {
  158.         $this->slug $slug;
  159.         return $this;
  160.     }
  161.     public function getImage(): ?string
  162.     {
  163.         return $this->image;
  164.     }
  165.     public function setImage(?string $image): self
  166.     {
  167.         $this->image $image;
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return mixed
  172.      */
  173.     public function getDetailImage()
  174.     {
  175.         return $this->detailImage;
  176.     }
  177.     /**
  178.      * @param mixed $detailImage
  179.      */
  180.     public function setDetailImage($detailImage): void
  181.     {
  182.         $this->detailImage $detailImage;
  183.     }
  184.     public function getCaption(): ?string
  185.     {
  186.         return $this->caption;
  187.     }
  188.     public function setCaption(?string $caption): self
  189.     {
  190.         $this->caption $caption;
  191.         return $this;
  192.     }
  193.     public function getContent(): ?string
  194.     {
  195.         return $this->content;
  196.     }
  197.     public function setContent(?string $content): self
  198.     {
  199.         $this->content $content;
  200.         return $this;
  201.     }
  202.     public function getEnabled(): ?bool
  203.     {
  204.         return $this->enabled;
  205.     }
  206.     public function setEnabled(?bool $enabled): self
  207.     {
  208.         $this->enabled $enabled;
  209.         return $this;
  210.     }
  211.     public function getLink(): ?string
  212.     {
  213.         return $this->link;
  214.     }
  215.     public function setLink(?string $link): self
  216.     {
  217.         $this->link $link;
  218.         return $this;
  219.     }
  220.     /**
  221.      * @return string
  222.      */
  223.     public function getTrackingCode()
  224.     {
  225.         return $this->trackingCode;
  226.     }
  227.     /**
  228.      * @param string $trackingCode
  229.      */
  230.     public function setTrackingCode(?string $trackingCode)
  231.     {
  232.         $this->trackingCode $trackingCode;
  233.     }
  234.      /**
  235.      * @return mixed
  236.      */
  237.     public function getPosition()
  238.     {
  239.         return $this->position;
  240.     }
  241.     /**
  242.      * @param mixed $position
  243.      */
  244.     public function setPosition($position): void
  245.     {
  246.         $this->position $position;
  247.     }
  248.     public function getPreviewText(): ?string
  249.     {
  250.         return $this->previewText;
  251.     }
  252.     public function setPreviewText(?string $previewText): self
  253.     {
  254.         $this->previewText $previewText;
  255.         return $this;
  256.     }
  257.     /**
  258.      * @return mixed
  259.      */
  260.     public function getDeletedAt()
  261.     {
  262.         return $this->deletedAt;
  263.     }
  264.     /**
  265.      * @param mixed $deletedAt
  266.      */
  267.     public function setDeletedAt($deletedAt): void
  268.     {
  269.         $this->deletedAt $deletedAt;
  270.         $this->updated $deletedAt;
  271.     }
  272.     /**
  273.      * @return mixed
  274.      */
  275.     public function getReadTime()
  276.     {
  277.         return $this->readTime;
  278.     }
  279.     /**
  280.      * @param mixed $readTime
  281.      */
  282.     public function setReadTime($readTime): void
  283.     {
  284.         $this->readTime $readTime;
  285.     }
  286.     /**
  287.      * @return mixed
  288.      */
  289.     public function getLanguage()
  290.     {
  291.         return $this->language;
  292.     }
  293.     /**
  294.      * @param mixed $language
  295.      */
  296.     public function setLanguage($language): void
  297.     {
  298.         $this->language $language;
  299.     }
  300. }