src/Entity/Notice.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use App\Entity\Skoda;
  6. use App\Entity\Doc;
  7. use App\Entity\Loc;
  8. use App\Entity\Operator;
  9. use App\Entity\NoticeOznamenie;
  10. use App\Entity\NoticePodnet;
  11. /** 
  12.  * @ORM\Table(name="es_notice")
  13.  * @ORM\Entity(repositoryClass="App\Repository\NoticeRepository") 
  14.  * @ORM\HasLifecycleCallbacks()
  15.  */
  16. class Notice{
  17.     
  18.     /** 
  19.      * @ORM\Column(name="id", type="integer")     
  20.      * @ORM\Id     
  21.      * @ORM\GeneratedValue(strategy="AUTO")     
  22.      */
  23.     protected $id;
  24.     
  25.     /** 
  26.      * Many notices have one report. This is the owning side.
  27.      * @ORM\ManyToMany(targetEntity="Skoda", inversedBy="notices")
  28.      * @ORM\JoinTable(name="es_skoda_notice",
  29.      *      joinColumns={@ORM\JoinColumn(name="notice_id", referencedColumnName="id", unique=true)},
  30.      *      inverseJoinColumns={@ORM\JoinColumn(name="report_id", referencedColumnName="id")}
  31.      *      )
  32.      */
  33.     private $skody;
  34.     
  35.     /** 
  36.      * @ORM\OneToMany(targetEntity="Doc", mappedBy="notice", cascade={"persist"}, orphanRemoval=true) 
  37.      */
  38.     protected $docs;
  39.     
  40.     /** 
  41.      * @ORM\OneToMany(targetEntity="Loc", mappedBy="notice", cascade={"persist"}, orphanRemoval=true) 
  42.      */
  43.     protected $locs;
  44.     
  45.     /** 
  46.      * @ORM\OneToMany(targetEntity="Operator", mappedBy="notice", cascade={"persist"}, orphanRemoval=true) 
  47.      */
  48.     protected $operators;
  49.     
  50.     /** 
  51.      * @ORM\OneToOne(targetEntity="NoticeOznamenie", mappedBy="notice", cascade={"persist"}) 
  52.      */
  53.     protected $oznamenie;
  54.     
  55.     /** 
  56.      * @ORM\OneToOne(targetEntity="NoticePodnet", mappedBy="notice", cascade={"persist"}) 
  57.      */
  58.     protected $podnet;
  59.     
  60.     /** 
  61.      * @ORM\Column(name="nazov", type="string", length=255) 
  62.     */
  63.    protected $nazov;
  64.     
  65.     /** 
  66.      * @ORM\Column(name="n_type", type="string", length=255)     
  67.      */
  68.     protected $type;
  69.     
  70.     /** 
  71.      * @ORM\Column(name="user_id", type="integer", nullable=true)     
  72.      */
  73.     protected $userId;
  74.     
  75.     /**
  76.      *  @ORM\Column(name="cis_spis", type="string", length=255, nullable=true)    
  77.      */
  78.     protected $cisloSpisu;
  79.     
  80.     /**
  81.      *  @ORM\Column(name="vysledok", type="string", length=255, nullable=true)    
  82.      */
  83.     protected $vysledok;
  84.     
  85.     /**
  86.      *  @ORM\Column(name="stav", type="string", length=255, nullable=true)    
  87.      */
  88.     protected $stav;
  89.     
  90.     /**
  91.      *  @ORM\Column(name="n_public", type="boolean")    
  92.      */
  93.     protected $public false;
  94.     
  95.     /**
  96.      *  @ORM\Column(name="n_created", type="datetime")     
  97.      */
  98.     protected $created;
  99.     /** 
  100.      * @ORM\Column(name="n_edited", type="datetime")     
  101.      */
  102.     protected $edited;
  103.     
  104.     /**
  105.      * Constructor
  106.      */
  107.     public function __construct()
  108.     {
  109.         $this->skody = new ArrayCollection();
  110.         $this->locs = new ArrayCollection();
  111.         $this->docs = new ArrayCollection();
  112.         $this->operators = new ArrayCollection();
  113.     }
  114.        
  115.     /**
  116.      * Add report
  117.      *
  118.      * @param Report $report
  119.      *
  120.      * @return Notice
  121.      */
  122.     //public function addReport(Report $report)
  123.     public function setSkoda(Skoda $skoda)
  124.     {
  125.         //$this->reports[] = $report;
  126.         $this->skody[0] = $skoda;
  127.         return $this;
  128.     }
  129.     /**
  130.      * Remove skoda
  131.      *
  132.      * @param Report $skoda
  133.      */
  134.     public function removeSkoda(Skoda $skoda)
  135.     {
  136.         $this->skody->removeElement($skoda);
  137.     }
  138.   
  139.     
  140.     /**
  141.      * Get skody
  142.      *
  143.      * @return Collection
  144.      */
  145.     public function getSkody()
  146.     {
  147.         return $this->skody;
  148.     }
  149.     
  150.     /**
  151.      * Get skoda
  152.      *
  153.      * @return one skoda
  154.      */
  155.     public function getSkoda()
  156.     {
  157.         return $this->skody[0];
  158.     }
  159.     /**
  160.      * Get id
  161.      *
  162.      * @return integer
  163.      */
  164.     public function getId()
  165.     {
  166.         return $this->id;
  167.     }
  168.     /**
  169.      * Set nazov
  170.      *
  171.      * @param string $nazov
  172.      *
  173.      * @return Notice
  174.      */
  175.     public function setNazov($nazov)
  176.     {
  177.         $this->nazov $nazov;
  178.         return $this;
  179.     }
  180.     /**
  181.      * Get nazov
  182.      *
  183.      * @return string
  184.      */
  185.     public function getNazov()
  186.     {
  187.         return $this->nazov;
  188.     }
  189.     /**
  190.      * Add loc
  191.      *
  192.      * @param Loc $loc
  193.      *
  194.      * @return Notice
  195.      */
  196.     public function addLoc(Loc $loc)
  197.     {
  198.         $loc->setNotice($this);
  199.         $this->locs[] = $loc;
  200.         return $this;
  201.     }
  202.     /**
  203.      * Remove loc
  204.      *
  205.      * @param Loc $loc
  206.      */
  207.     public function removeLoc(Loc $loc)
  208.     {
  209.         $this->locs->removeElement($loc);
  210.     }
  211.     /**
  212.      * Get locs
  213.      *
  214.      * @return ArrayCollection
  215.      */
  216.     public function getLocs()
  217.     {
  218.         return $this->locs;
  219.     }
  220.     /**
  221.      * Add doc
  222.      *
  223.      * @param Doc $doc
  224.      *
  225.      * @return Notice
  226.      */
  227.     public function addDoc(Doc $doc)
  228.     {
  229.         $doc->setNotice($this);
  230.         $this->docs[] = $doc;
  231.         return $this;
  232.     }
  233.     /**
  234.      * Remove doc
  235.      *
  236.      * @param Doc $doc
  237.      */
  238.     public function removeDoc(Doc $doc)
  239.     {
  240.         $this->docs->removeElement($doc);
  241.     }
  242.     /**
  243.      * Get docs
  244.      *
  245.      * @return \Doctrine\Common\Collections\Collection
  246.      */
  247.     public function getDocs()
  248.     {
  249.         return $this->docs;
  250.     }
  251.     /**
  252.      * Add operator
  253.      *
  254.      * @param Operator $operator
  255.      *
  256.      * @return Notice
  257.      */
  258.     public function addOperator(Operator $operator)
  259.     {
  260.         $operator->setNotice($this);
  261.         $operator->setType($this->getType());
  262.         $this->operators[] = $operator;
  263.         return $this;
  264.     }
  265.     /**
  266.      * Remove operator
  267.      *
  268.      * @param Operator $operator
  269.      */
  270.     public function removeOperator(Operator $operator)
  271.     {
  272.         $this->operators->removeElement($operator);
  273.     }
  274.     /**
  275.      * Get operators
  276.      *
  277.      * @return \Doctrine\Common\Collections\Collection
  278.      */
  279.     public function getOperators()
  280.     {
  281.         return $this->operators;
  282.     }
  283.     
  284.     /** 
  285.      * @ORM\PrePersist()
  286.     */
  287.     public function preCreated() {
  288.         $this->created = new \DateTime('now');        
  289.     }
  290.     /** 
  291.      * @ORM\PrePersist()
  292.      * @ORM\PreUpdate() 
  293.      */
  294.     public function preEdited() {
  295.         $this->edited = new \DateTime('now');        
  296.     }
  297.     
  298.     
  299.     /**
  300.      * Set created
  301.      *
  302.      * @param \DateTime $created
  303.      *
  304.      * @return notice
  305.      */
  306.     public function setCreated($created)
  307.     {
  308.         $this->created $created;
  309.         return $this;
  310.     }
  311.     /**
  312.      * Get created
  313.      *
  314.      * @return \DateTime
  315.      */
  316.     public function getCreated()
  317.     {
  318.         return $this->created;
  319.     }
  320.     /**
  321.      * Set edited
  322.      *
  323.      * @param \DateTime $edited
  324.      *
  325.      * @return Notice
  326.      */
  327.     public function setEdited($edited)
  328.     {
  329.         $this->edited $edited;
  330.         return $this;
  331.     }
  332.     /**
  333.      * Get edited
  334.      *
  335.      * @return \DateTime
  336.      */
  337.     public function getEdited()
  338.     {
  339.         return $this->edited;
  340.     }
  341.     
  342.     
  343.     
  344.     
  345.     /**
  346.      * Set type
  347.      *
  348.      * @param string $type
  349.      *
  350.      * @return Notice
  351.      */
  352.     public function setType($type)
  353.     {
  354.         $this->type $type;
  355.         return $this;
  356.     }
  357.     /**
  358.      * Get type
  359.      *
  360.      * @return string
  361.      */
  362.     public function getType()
  363.     {
  364.         return $this->type;
  365.     }
  366.     /**
  367.      * Set userId
  368.      *
  369.      * @param integer $userId
  370.      *
  371.      * @return Notice
  372.      */
  373.     public function setUserId($userId)
  374.     {
  375.         $this->userId $userId;
  376.         return $this;
  377.     }
  378.     /**
  379.      * Get userId
  380.      *
  381.      * @return integer
  382.      */
  383.     public function getUserId()
  384.     {
  385.         return $this->userId;
  386.     }
  387.     /**
  388.      * Add skoda
  389.      *
  390.      * @param \App\Entity\Skoda $skoda
  391.      *
  392.      * @return Notice
  393.      */
  394.     public function addSkoda(Skoda $skoda)
  395.     {
  396.         $this->skody[] = $skoda;
  397.         return $this;
  398.     }
  399.     /**
  400.      * Set oznamenie
  401.      *
  402.      * @param \App\Entity\NoticeOznamenie $oznamenie
  403.      *
  404.      * @return Notice
  405.      */
  406.     public function setOznamenie(NoticeOznamenie $oznamenie null)
  407.     {
  408.         if($oznamenie)
  409.         {
  410.             $oznamenie->setNotice($this);
  411.         }
  412.         $this->oznamenie $oznamenie;
  413.         return $this;
  414.     }
  415.     /**
  416.      * Get oznamenie
  417.      *
  418.      * @return \App\Entity\NoticeOznamenie
  419.      */
  420.     public function getOznamenie()
  421.     {
  422.         return $this->oznamenie;
  423.     }
  424.     /**
  425.      * Set podnet
  426.      *
  427.      * @param \App\Entity\NoticePodnet $podnet
  428.      *
  429.      * @return Notice
  430.      */
  431.     public function setPodnet(NoticePodnet $podnet null)
  432.     {
  433.         if($podnet)
  434.         {
  435.             $podnet->setNotice($this);
  436.         }
  437.         $this->podnet $podnet;
  438.         return $this;
  439.     }
  440.     /**
  441.      * Get podnet
  442.      *
  443.      * @return \App\Entity\NoticePodnet
  444.      */
  445.     public function getPodnet()
  446.     {
  447.         return $this->podnet;
  448.     }
  449.     /**
  450.      * Set vysledok
  451.      *
  452.      * @param string $vysledok
  453.      *
  454.      * @return Notice
  455.      */
  456.     public function setVysledok($vysledok)
  457.     {
  458.         $this->vysledok $vysledok;
  459.         return $this;
  460.     }
  461.     /**
  462.      * Get vysledok
  463.      *
  464.      * @return string
  465.      */
  466.     public function getVysledok()
  467.     {
  468.         return $this->vysledok;
  469.     }
  470.     /**
  471.      * Set stav
  472.      *
  473.      * @param string $stav
  474.      *
  475.      * @return Notice
  476.      */
  477.     public function setStav($stav)
  478.     {
  479.         $this->stav $stav;
  480.         return $this;
  481.     }
  482.     /**
  483.      * Get stav
  484.      *
  485.      * @return string
  486.      */
  487.     public function getStav()
  488.     {
  489.         return $this->stav;
  490.     }
  491.     /**
  492.      * Set public
  493.      *
  494.      * @param boolean $public
  495.      *
  496.      * @return Notice
  497.      */
  498.     public function setPublic($public)
  499.     {
  500.         $this->public $public;
  501.         return $this;
  502.     }
  503.     /**
  504.      * Get public
  505.      *
  506.      * @return boolean
  507.      */
  508.     public function getPublic()
  509.     {
  510.         return $this->public;
  511.     }
  512.     /**
  513.      * Set cisloSpisu
  514.      *
  515.      * @param string $cisloSpisu
  516.      *
  517.      * @return Notice
  518.      */
  519.     public function setCisloSpisu($cisloSpisu)
  520.     {
  521.         $this->cisloSpisu $cisloSpisu;
  522.         return $this;
  523.     }
  524.     /**
  525.      * Get cisloSpisu
  526.      *
  527.      * @return string
  528.      */
  529.     public function getCisloSpisu()
  530.     {
  531.         return $this->cisloSpisu;
  532.     }
  533.     
  534. }