<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use App\Entity\Skoda;
use App\Entity\Doc;
use App\Entity\Loc;
use App\Entity\Operator;
use App\Entity\NoticeOznamenie;
use App\Entity\NoticePodnet;
/**
* @ORM\Table(name="es_notice")
* @ORM\Entity(repositoryClass="App\Repository\NoticeRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Notice{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* Many notices have one report. This is the owning side.
* @ORM\ManyToMany(targetEntity="Skoda", inversedBy="notices")
* @ORM\JoinTable(name="es_skoda_notice",
* joinColumns={@ORM\JoinColumn(name="notice_id", referencedColumnName="id", unique=true)},
* inverseJoinColumns={@ORM\JoinColumn(name="report_id", referencedColumnName="id")}
* )
*/
private $skody;
/**
* @ORM\OneToMany(targetEntity="Doc", mappedBy="notice", cascade={"persist"}, orphanRemoval=true)
*/
protected $docs;
/**
* @ORM\OneToMany(targetEntity="Loc", mappedBy="notice", cascade={"persist"}, orphanRemoval=true)
*/
protected $locs;
/**
* @ORM\OneToMany(targetEntity="Operator", mappedBy="notice", cascade={"persist"}, orphanRemoval=true)
*/
protected $operators;
/**
* @ORM\OneToOne(targetEntity="NoticeOznamenie", mappedBy="notice", cascade={"persist"})
*/
protected $oznamenie;
/**
* @ORM\OneToOne(targetEntity="NoticePodnet", mappedBy="notice", cascade={"persist"})
*/
protected $podnet;
/**
* @ORM\Column(name="nazov", type="string", length=255)
*/
protected $nazov;
/**
* @ORM\Column(name="n_type", type="string", length=255)
*/
protected $type;
/**
* @ORM\Column(name="user_id", type="integer", nullable=true)
*/
protected $userId;
/**
* @ORM\Column(name="cis_spis", type="string", length=255, nullable=true)
*/
protected $cisloSpisu;
/**
* @ORM\Column(name="vysledok", type="string", length=255, nullable=true)
*/
protected $vysledok;
/**
* @ORM\Column(name="stav", type="string", length=255, nullable=true)
*/
protected $stav;
/**
* @ORM\Column(name="n_public", type="boolean")
*/
protected $public = false;
/**
* @ORM\Column(name="n_created", type="datetime")
*/
protected $created;
/**
* @ORM\Column(name="n_edited", type="datetime")
*/
protected $edited;
/**
* Constructor
*/
public function __construct()
{
$this->skody = new ArrayCollection();
$this->locs = new ArrayCollection();
$this->docs = new ArrayCollection();
$this->operators = new ArrayCollection();
}
/**
* Add report
*
* @param Report $report
*
* @return Notice
*/
//public function addReport(Report $report)
public function setSkoda(Skoda $skoda)
{
//$this->reports[] = $report;
$this->skody[0] = $skoda;
return $this;
}
/**
* Remove skoda
*
* @param Report $skoda
*/
public function removeSkoda(Skoda $skoda)
{
$this->skody->removeElement($skoda);
}
/**
* Get skody
*
* @return Collection
*/
public function getSkody()
{
return $this->skody;
}
/**
* Get skoda
*
* @return one skoda
*/
public function getSkoda()
{
return $this->skody[0];
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set nazov
*
* @param string $nazov
*
* @return Notice
*/
public function setNazov($nazov)
{
$this->nazov = $nazov;
return $this;
}
/**
* Get nazov
*
* @return string
*/
public function getNazov()
{
return $this->nazov;
}
/**
* Add loc
*
* @param Loc $loc
*
* @return Notice
*/
public function addLoc(Loc $loc)
{
$loc->setNotice($this);
$this->locs[] = $loc;
return $this;
}
/**
* Remove loc
*
* @param Loc $loc
*/
public function removeLoc(Loc $loc)
{
$this->locs->removeElement($loc);
}
/**
* Get locs
*
* @return ArrayCollection
*/
public function getLocs()
{
return $this->locs;
}
/**
* Add doc
*
* @param Doc $doc
*
* @return Notice
*/
public function addDoc(Doc $doc)
{
$doc->setNotice($this);
$this->docs[] = $doc;
return $this;
}
/**
* Remove doc
*
* @param Doc $doc
*/
public function removeDoc(Doc $doc)
{
$this->docs->removeElement($doc);
}
/**
* Get docs
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getDocs()
{
return $this->docs;
}
/**
* Add operator
*
* @param Operator $operator
*
* @return Notice
*/
public function addOperator(Operator $operator)
{
$operator->setNotice($this);
$operator->setType($this->getType());
$this->operators[] = $operator;
return $this;
}
/**
* Remove operator
*
* @param Operator $operator
*/
public function removeOperator(Operator $operator)
{
$this->operators->removeElement($operator);
}
/**
* Get operators
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getOperators()
{
return $this->operators;
}
/**
* @ORM\PrePersist()
*/
public function preCreated() {
$this->created = new \DateTime('now');
}
/**
* @ORM\PrePersist()
* @ORM\PreUpdate()
*/
public function preEdited() {
$this->edited = new \DateTime('now');
}
/**
* Set created
*
* @param \DateTime $created
*
* @return notice
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set edited
*
* @param \DateTime $edited
*
* @return Notice
*/
public function setEdited($edited)
{
$this->edited = $edited;
return $this;
}
/**
* Get edited
*
* @return \DateTime
*/
public function getEdited()
{
return $this->edited;
}
/**
* Set type
*
* @param string $type
*
* @return Notice
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Set userId
*
* @param integer $userId
*
* @return Notice
*/
public function setUserId($userId)
{
$this->userId = $userId;
return $this;
}
/**
* Get userId
*
* @return integer
*/
public function getUserId()
{
return $this->userId;
}
/**
* Add skoda
*
* @param \App\Entity\Skoda $skoda
*
* @return Notice
*/
public function addSkoda(Skoda $skoda)
{
$this->skody[] = $skoda;
return $this;
}
/**
* Set oznamenie
*
* @param \App\Entity\NoticeOznamenie $oznamenie
*
* @return Notice
*/
public function setOznamenie(NoticeOznamenie $oznamenie = null)
{
if($oznamenie)
{
$oznamenie->setNotice($this);
}
$this->oznamenie = $oznamenie;
return $this;
}
/**
* Get oznamenie
*
* @return \App\Entity\NoticeOznamenie
*/
public function getOznamenie()
{
return $this->oznamenie;
}
/**
* Set podnet
*
* @param \App\Entity\NoticePodnet $podnet
*
* @return Notice
*/
public function setPodnet(NoticePodnet $podnet = null)
{
if($podnet)
{
$podnet->setNotice($this);
}
$this->podnet = $podnet;
return $this;
}
/**
* Get podnet
*
* @return \App\Entity\NoticePodnet
*/
public function getPodnet()
{
return $this->podnet;
}
/**
* Set vysledok
*
* @param string $vysledok
*
* @return Notice
*/
public function setVysledok($vysledok)
{
$this->vysledok = $vysledok;
return $this;
}
/**
* Get vysledok
*
* @return string
*/
public function getVysledok()
{
return $this->vysledok;
}
/**
* Set stav
*
* @param string $stav
*
* @return Notice
*/
public function setStav($stav)
{
$this->stav = $stav;
return $this;
}
/**
* Get stav
*
* @return string
*/
public function getStav()
{
return $this->stav;
}
/**
* Set public
*
* @param boolean $public
*
* @return Notice
*/
public function setPublic($public)
{
$this->public = $public;
return $this;
}
/**
* Get public
*
* @return boolean
*/
public function getPublic()
{
return $this->public;
}
/**
* Set cisloSpisu
*
* @param string $cisloSpisu
*
* @return Notice
*/
public function setCisloSpisu($cisloSpisu)
{
$this->cisloSpisu = $cisloSpisu;
return $this;
}
/**
* Get cisloSpisu
*
* @return string
*/
public function getCisloSpisu()
{
return $this->cisloSpisu;
}
}