<?phpnamespace JF\JuridicusBundle\Entity;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * Export */class Export extends InitModeEntity{ const CLASSNAME = __CLASS__; /** * @var integer */ private $id; /** * @var integer * @Assert\Type(type="integer") * @Assert\NotNull * @Assert\Range(min="1") */ private $anzahl; /** * @var \DateTime * @Assert\Type(\DateTimeInterface::class) */ private $created_at; /** * @var \JF\JuridicusBundle\Entity\Partner * @Assert\Valid */ private $partner; /** * @var \Doctrine\Common\Collections\Collection */ private $kunden; /** * @var integer */ private $examen; /** * Constructor */ public function __construct() { $this->kunden = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set created_at * * @param \DateTime $createdAt * @return Export */ public function setCreatedAt($createdAt) { $this->created_at = $createdAt; return $this; } /** * Get created_at * * @return \DateTime */ public function getCreatedAt() { return $this->created_at; } /** * Get created_at * * @return \DateTime */ public function getListString() { return sprintf( '%d Kunden am %s', $this->anzahl, $this->created_at ? $this->created_at->format('d.m.Y H:i:s') : '(Datum unbekannt)' ); } /** * Set partner [OWNING SIDE] * * @param \JF\JuridicusBundle\Entity\Partner $partner * @return Export */ public function setPartner(\JF\JuridicusBundle\Entity\Partner $partner = null) { $this->partner = $partner; return $this; } /** * Get partner * * @return \JF\JuridicusBundle\Entity\Partner */ public function getPartner() { return $this->partner; } /** * Add kunden [OWNINGS SIDE] * * @param \JF\JuridicusBundle\Entity\Kunde $kunden * @return Export */ public function addKunden(\JF\JuridicusBundle\Entity\Kunde $kunden = NULL) { $this->kunden[] = $kunden; $kunden->addExporte($this); return $this; } /** * Remove kunden * * @param \JF\JuridicusBundle\Entity\Kunde $kunden */ public function removeKunden(\JF\JuridicusBundle\Entity\Kunde $kunden) { $this->kunden->removeElement($kunden); $kunden->removeExporte($this); } /** * Get kunden * * @return \Doctrine\Common\Collections\Collection */ public function getKunden() { return $this->kunden; } /** * Set anzahl * * @param integer $anzahl * @return Export */ public function setAnzahl($anzahl) { $this->anzahl = $anzahl; return $this; } /** * Get anzahl * * @return integer */ public function getAnzahl() { return $this->anzahl; } /** * @ORM\PrePersist */ public function setCreatedAtValue() { if (!$this->init_mode AND !isset($this->created_at)) { $this->setCreatedAt(new \DateTime()); } } /** * Set examen * * @param integer $examen * @return Export */ public function setExamen($examen) { $this->examen = $examen; return $this; } /** * Get examen * * @return integer */ public function getExamen() { return $this->examen; } public function __toString() { if (isset($this->id)) { if (isset($this->created_at)) { return sprintf('%s - %s', $this->created_at->format('d.m.Y H:i:s'), $this->getPartner()->getName()); } else { return $this->getPartner()->getName(); } } return 'Neuer Export'; }}