<?phpnamespace JF\JuridicusBundle\Entity;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;use JF\JuridicusBundle\Entity\Pruefung;/** * ProtokollHtml */class ProtokollHtml extends InitModeEntity{ const CLASSNAME = __CLASS__; /** * @var integer */ private $id; /** * @var \DateTime * @Assert\Type(\DateTimeInterface::class) */ private $datum; /** * @var integer * @Assert\Type(type="integer") * @Assert\NotNull * @Assert\Range(min="1", max="2") */ private $examen; /** * @var string * @Assert\Length(max="10") * @Assert\NotNull */ private $datum_format = ''; /** * @var string * @Assert\NotBlank */ private $html_code; /** * @var \DateTime * @Assert\Type(\DateTimeInterface::class) */ private $updated_at; /** * @var \JF\JuridicusBundle\Entity\Pruefer * @Assert\NotBlank * @Assert\Valid */ private $pruefer; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set datum * * @param \DateTime $datum * @return ProtokollHtml */ public function setDatum($datum) { $this->datum = $datum; return $this; } /** * Get datum * * @return \DateTime */ public function getDatum() { return $this->datum; } /** * Set datum_format * * @param string $datumFormat * @return ProtokollHtml */ public function setDatumFormat($datumFormat) { $this->datum_format = (string) $datumFormat; return $this; } /** * * @return string */ public function getFormattedDatum() { if ($this->datum) { return $this->datum->format($this->datum_format); } return ''; } /** * Get datum_format * * @return string */ public function getDatumFormat() { return $this->datum_format; } /** * Set examen * * @param integer $examen * @return ProtokollHtml */ public function setExamen($examen) { $this->examen = $examen; return $this; } /** * Get examen * * @return integer */ public function getExamen() { return $this->examen; } /** * Set html_code * * @param string $htmlCode * @return ProtokollHtml */ public function setHtmlCode($htmlCode) { $this->html_code = $htmlCode; return $this; } /** * Get html_code * * @return string */ public function getHtmlCode() { return $this->html_code; } /** * Set updated_at * * @param \DateTime $updatedAt * @return ProtokollHtml */ public function setUpdatedAt($updatedAt) { $this->updated_at = $updatedAt; return $this; } /** * Get updated_at * * @return \DateTime */ public function getUpdatedAt() { return $this->updated_at; } /** * Set pruefer [OWNING SIDE] * * @param \JF\JuridicusBundle\Entity\Pruefer $pruefer * @return ProtokollHtml */ public function setPruefer(\JF\JuridicusBundle\Entity\Pruefer $pruefer = null) { $this->pruefer = $pruefer; return $this; } /** * Get pruefer * * @return \JF\JuridicusBundle\Entity\Pruefer */ public function getPruefer() { return $this->pruefer; } /** * */ public function getPruefungsamt() { if (empty($this->id)) { return null; } foreach($this->getPruefer()->getPruefungsaemter() as $pa) { if ($pa->getExamen() == $this->examen) { return $pa; } } return null; } /** * string representation of the entity * * @return string */ public function __toString() { if ($this->id) { return sprintf('%s - %s.Examen', $this->getPruefer()->getFullText(), $this->examen); } return 'Neues HTML-Protokoll'; } /** * addToPdf * * @param \TCPDF $pdf */ public function addToPdf( \TCPDF & $pdf ) { $pdf->writeHTML($this->html_code, true, 0, true, 0); $pdf->lastPage(); }}