<?phpnamespace JF\JuridicusBundle\Entity;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * ProtokollGesetz * * @ORM\Entity * @UniqueEntity(fields={"sortierung","protokoll_infothek_pruefer"}, message="Dieser Eintrag existiert bereits.") */class ProtokollGesetz extends ProtokollGesetzBase{ const CLASSNAME = __CLASS__; /** * @var Gesetz */ private $gesetz; /** * @Assert\IsFalse( * groups = {"admin"}, * message = "Die Kombination aus Paragraph und Gesetz darf nicht leer sein." * ) * changedFrom Assert\False */ public function isEmpty() { return empty($this->paragraph) && empty($this->gesetz); } /** * @Assert\IsFalse( * groups = {"finish"}, * message = "Paragraph und Gesetz müssen ausgewählt werden." * ) * changedFrom Assert\False */ public function isIncomplete() { return empty($this->paragraph) ^ empty($this->gesetz); } /** * @var \JF\JuridicusBundle\Entity\ProtokollInfothekPruefer * @Assert\NotNull(message = "Der Prüfer darf nicht leer sein.") */ protected $protokoll_infothek_pruefer; /** * Set protokoll_infothek_pruefer * * @param \JF\JuridicusBundle\Entity\ProtokollInfothekPruefer $protokollInfothekPruefer * @return ProtokollGesetz */ public function setProtokollInfothekPruefer(ProtokollInfothekPruefer $protokollInfothekPruefer = null) { $this->protokoll_infothek_pruefer = $protokollInfothekPruefer; return $this; } /** * Get protokoll_infothek_pruefer * * @return \JF\JuridicusBundle\Entity\ProtokollInfothekPruefer */ public function getProtokollInfothekPruefer() { return $this->protokoll_infothek_pruefer; } /** * Set gesetz * * @param \JF\JuridicusBundle\Entity\Gesetz $gesetz * @return ProtokollGesetzBase */ public function setGesetz(Gesetz $gesetz = null) { $this->gesetz = $gesetz; return $this; } /** * Get gesetz * * @return \JF\JuridicusBundle\Entity\Gesetz */ public function getGesetz() { return $this->gesetz; } /** * @return string */ public function getAbsoluteLink() { if ($this->gesetz && $this->paragraph) { return sprintf('https://dejure.org/%s/%s.html', $this->getGesetz()->getLink(), $this->paragraph); } else { return '#'; } } /** * * @return string */ public function getKurzbezeichnung() { if ($this->gesetz && $this->paragraph) { return sprintf('§%s %s', $this->getParagraph(), $this->getGesetz()->getExtendedKuerzel()); } else { return 'unvollständig'; } } /** * * @return string */ public function __toString() { return $this->getKurzbezeichnung(); }}