src/Aviatur/ContentBundle/Entity/Content.php line 22

Open in your IDE?
  1. <?php
  2. namespace Aviatur\ContentBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * Content.
  8.  *
  9.  * @ORM\Table(name="content", indexes={@ORM\Index(name="IDX_31780935A76ED395", columns={"user_id"})})
  10.  * @ORM\Entity(repositoryClass="Aviatur\ContentBundle\Entity\ContentRepository")
  11.  * @UniqueEntity(
  12.  *    fields={"url"},
  13.  *    message="la url ya esta asignada a otro artículo."
  14.  * )
  15.  *
  16.  * @ORM\HasLifecycleCallbacks()
  17.  * 
  18.  */
  19. class Content
  20. {
  21.     /**
  22.      * @var int
  23.      *
  24.      * @ORM\Column(name="id", type="integer", nullable=false)
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue(strategy="IDENTITY")
  27.      */
  28.     private $id;
  29.     /**
  30.      * @var string
  31.      *
  32.      * @ORM\Column(name="title", type="string", length=50, nullable=false)
  33.      * @Assert\Length(
  34.      *      min = 2,
  35.      *      minMessage = "La Cantidad de Caracteres en el campo Titulo es Inferior a la Permitida"
  36.      * )
  37.      * @Assert\NotNull()
  38.      */
  39.     private $title;
  40.     /**
  41.      * @var string
  42.      *
  43.      * @ORM\Column(name="keywords", type="string", length=50, nullable=true)
  44.      * * @Assert\Length(
  45.      *      max = 50,
  46.      *      minMessage = "La Cantidad de Caracteres en el campo palabra clave es Superior a la Permitida"
  47.      * )
  48.      * @Assert\NotNull()
  49.      */
  50.     private $keywords;
  51.     /**
  52.      * @var string
  53.      *
  54.      * @ORM\Column(name="url", type="string", length=50, nullable=false)
  55.      * @Assert\NotNull()
  56.      */
  57.     private $url;
  58.     /**
  59.      * @var string
  60.      *
  61.      * @ORM\Column(name="description", type="text", nullable=false)
  62.      * @Assert\NotNull(message="Debe escribir la descripción del artículo")
  63.      * @Assert\NotNull()
  64.      */
  65.     private $description;
  66.     /**
  67.      * @var string
  68.      *
  69.      * @ORM\Column(name="text", type="text", nullable=false)
  70.      */
  71.     private $text;
  72.     /**
  73.      * @var \DateTime
  74.      *
  75.      * @ORM\Column(name="publicationStartDate", type="datetime", nullable=false)
  76.      */
  77.     private $publicationstartdate;
  78.     /**
  79.      * @var \DateTime
  80.      *
  81.      * @ORM\Column(name="publicationEndDate", type="datetime", nullable=false)
  82.      */
  83.     private $publicationenddate;
  84.     /**
  85.      * @var \DateTime
  86.      *
  87.      * @ORM\Column(name="creationDate", type="datetime", nullable=false)
  88.      */
  89.     private $creationdate;
  90.     /**
  91.      * @ORM\Column(name="isActive", type="boolean", nullable=true)
  92.      */
  93.     private bool $isactive false;
  94.     /**
  95.      *
  96.      * @ORM\ManyToOne(targetEntity="Aviatur\CustomerBundle\Entity\Customer", inversedBy="content")
  97.      * @ORM\JoinColumns({
  98.      *   @ORM\JoinColumn(name="user_id", referencedColumnName="id")
  99.      * })
  100.      */
  101.     private ?\Aviatur\CustomerBundle\Entity\Customer $user null;
  102.     /**
  103.      *
  104.      * @ORM\ManyToOne(targetEntity="Aviatur\AgencyBundle\Entity\Agency", inversedBy="content")
  105.      * @ORM\JoinColumns({
  106.      *   @ORM\JoinColumn(name="agency_id", referencedColumnName="id")
  107.      * })
  108.      */
  109.     private ?\Aviatur\AgencyBundle\Entity\Agency $agency null;
  110.     /**
  111.      * @ORM\OneToMany(targetEntity="Aviatur\ContentBundle\Entity\HistoricalContent", mappedBy="content", cascade={"all"})
  112.      */
  113.     private $historicalContent;
  114.      /**
  115.      * @ORM\Column(name="userCreate", type="integer", nullable=true)
  116.      */
  117.     private $usercreate;
  118.     /**
  119.      * Constructor.
  120.      */
  121.     public function __construct()
  122.     {
  123.         $this->historicalContent = new \Doctrine\Common\Collections\ArrayCollection();
  124.     }
  125.     /**
  126.      * Get id.
  127.      *
  128.      * @return int
  129.      */
  130.     public function getId()
  131.     {
  132.         return $this->id;
  133.     }
  134.     /**
  135.      * Set keywords.
  136.      *
  137.      * @param string $keywords
  138.      *
  139.      * @return Content
  140.      */
  141.     public function setKeywords($keywords)
  142.     {
  143.         $this->keywords $keywords;
  144.         return $this;
  145.     }
  146.     /**
  147.      * Get keywords.
  148.      *
  149.      * @return string
  150.      */
  151.     public function getKeywords()
  152.     {
  153.         return $this->keywords;
  154.     }
  155.     /**
  156.      * Set descriptionkeywords.
  157.      *
  158.      * @param string $descriptionkeywords
  159.      *
  160.      * @return Content
  161.      */
  162.     public function setDescriptionkeywords($descriptionkeywords)
  163.     {
  164.         $this->descriptionkeywords $descriptionkeywords;
  165.         return $this;
  166.     }
  167.     /**
  168.      * Get descriptionkeywords.
  169.      *
  170.      * @return string
  171.      */
  172.     public function getDescriptionkeywords()
  173.     {
  174.         return $this->descriptionkeywords;
  175.     }
  176.     /**
  177.      * Set title.
  178.      *
  179.      * @param string $title
  180.      *
  181.      * @return Content
  182.      */
  183.     public function setTitle($title)
  184.     {
  185.         $this->title $title;
  186.         return $this;
  187.     }
  188.     /**
  189.      * Get title.
  190.      *
  191.      * @return string
  192.      */
  193.     public function getTitle()
  194.     {
  195.         return $this->title;
  196.     }
  197.     /**
  198.      * Set url.
  199.      *
  200.      * @param string $url
  201.      *
  202.      * @return Content
  203.      */
  204.     public function setUrl($url)
  205.     {
  206.         $this->url $url;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get url.
  211.      *
  212.      * @return string
  213.      */
  214.     public function getUrl()
  215.     {
  216.         return $this->url;
  217.     }
  218.     /**
  219.      * Set description.
  220.      *
  221.      * @param string $description
  222.      *
  223.      * @return Content
  224.      */
  225.     public function setDescription($description)
  226.     {
  227.         $this->description $description;
  228.         return $this;
  229.     }
  230.     /**
  231.      * Get description.
  232.      *
  233.      * @return string
  234.      */
  235.     public function getDescription()
  236.     {
  237.         return $this->description;
  238.     }
  239.     /**
  240.      * Set text.
  241.      *
  242.      * @param string $text
  243.      *
  244.      * @return Content
  245.      */
  246.     public function setText($text)
  247.     {
  248.         $this->text $text;
  249.         return $this;
  250.     }
  251.     /**
  252.      * Get text.
  253.      *
  254.      * @return string
  255.      */
  256.     public function getText()
  257.     {
  258.         return $this->text;
  259.     }
  260.     /**
  261.      * Set publicationstartdate.
  262.      *
  263.      * @param \DateTime $publicationstartdate
  264.      *
  265.      * @return Content
  266.      */
  267.     public function setPublicationstartdate($publicationstartdate)
  268.     {
  269.         $this->publicationstartdate $publicationstartdate;
  270.         return $this;
  271.     }
  272.     /**
  273.      * Get publicationstartdate.
  274.      *
  275.      * @return \DateTime
  276.      */
  277.     public function getPublicationstartdate()
  278.     {
  279.         return $this->publicationstartdate;
  280.     }
  281.     /**
  282.      * Set publicationenddate.
  283.      *
  284.      * @param \DateTime $publicationenddate
  285.      *
  286.      * @return Content
  287.      */
  288.     public function setPublicationenddate($publicationenddate)
  289.     {
  290.         $this->publicationenddate $publicationenddate;
  291.         return $this;
  292.     }
  293.     /**
  294.      * Get publicationenddate.
  295.      *
  296.      * @return \DateTime
  297.      */
  298.     public function getPublicationenddate()
  299.     {
  300.         return $this->publicationenddate;
  301.     }
  302.     /**
  303.      * Set creationdate.
  304.      *
  305.      * @param \DateTime $creationdate
  306.      *
  307.      * @return Content
  308.      */
  309.     public function setCreationdate($creationdate)
  310.     {       
  311.         $this->creationdate $creationdate;
  312.         return $this;
  313.     }
  314.     /**
  315.      * @ORM\PrePersist
  316.      */
  317.     public function setCreationdateValue(): void
  318.     {
  319.         if ($this->creationdate === null) {
  320.             $this->creationdate = new \DateTime();
  321.         }
  322.     }
  323.     /**
  324.      * Set isactive.
  325.      *
  326.      * @param bool $isactive
  327.      *
  328.      * @return AdminFee
  329.      */
  330.     public function setIsactive($isactive)
  331.     {
  332.         $this->isactive $isactive;
  333.         return $this;
  334.     }
  335.     /**
  336.      * Get isactive.
  337.      *
  338.      * @return bool
  339.      */
  340.     public function getIsactive()
  341.     {
  342.         return $this->isactive;
  343.     }
  344.     public function getIsActiveText(): string
  345.     {
  346.         return $this->isactive 'Activo' 'Inactivo';
  347.     }
  348.      public function __toString()
  349.     {
  350.         return $this->title;
  351.     }
  352.     /**
  353.      * Get creationdate.
  354.      *
  355.      * @return \DateTime
  356.      */
  357.     public function getCreationdate()
  358.     {
  359.         return $this->creationdate;
  360.     }
  361.     /**
  362.      * Set user.
  363.      *
  364.      * @param \Aviatur\CustomerBundle\Entity\Customer $user
  365.      *
  366.      * @return Content
  367.      */
  368.     public function setUser(\Aviatur\CustomerBundle\Entity\Customer $user null)
  369.     {
  370.         $this->user $user;
  371.         return $this;
  372.     }
  373.     /**
  374.      * Get user.
  375.      *
  376.      * @return \Aviatur\CustomerBundle\Entity\Customer
  377.      */
  378.     public function getUser()
  379.     {
  380.         return $this->user;
  381.     }
  382.     /**
  383.      * Set agency.
  384.      *
  385.      * @param \Aviatur\AgencyBundle\Entity\Agency $agency
  386.      *
  387.      * @return Content
  388.      */
  389.     public function setAgency(\Aviatur\AgencyBundle\Entity\Agency $agency null)
  390.     {
  391.         $this->agency $agency;
  392.         return $this;
  393.     }
  394.     /**
  395.      * Get agency.
  396.      *
  397.      * @return \Aviatur\AgencyBundle\Entity\Agency
  398.      */
  399.     public function getAgency()
  400.     {
  401.         return $this->agency;
  402.     }
  403.     /**
  404.      * Add historicalContent.
  405.      *
  406.      * @return Content
  407.      */
  408.     public function addHistoricalContent(\Aviatur\ContentBundle\Entity\HistoricalContent $historicalContent)
  409.     {
  410.         $this->historicalContent[] = $historicalContent;
  411.         return $this;
  412.     }
  413.     /**
  414.      * Remove historicalContent.
  415.      */
  416.     public function removeHistoricalContent(\Aviatur\ContentBundle\Entity\HistoricalContent $historicalContent)
  417.     {
  418.         $this->historicalContent->removeElement($historicalContent);
  419.     }
  420.     /**
  421.      * Get historicalContent.
  422.      *
  423.      * @return \Doctrine\Common\Collections\Collection
  424.      */
  425.     public function getHistoricalContent()
  426.     {
  427.         return $this->historicalContent;
  428.     }
  429.     public function getUserCreate(){
  430.         return $this->usercreate;
  431.     }
  432.     public function setUserCreate($usercreate){
  433.         $this->usercreate $usercreate;
  434.         return $this;
  435.     }
  436. }