src/JuridicusBundle/Entity/PdfProtokollJuridicus.php line 18

Open in your IDE?
  1. <?php
  2. namespace JF\JuridicusBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. /**
  7. * PdfProtokollJuridicus
  8. *
  9. * Pdf-Protkollmappe zu einem Prüfer/Examen aus dem alten Juridicus-Bestand
  10. *
  11. * @author Jürgen Feichtinger <j.feichtinger@arcor.de>
  12. *
  13. * @ORM\Entity
  14. * @UniqueEntity(fields={"pruefer","examen"}, message="Die Kombination aus Prüfer und Examen wird bereits verwendet.")
  15. */
  16. class PdfProtokollJuridicus extends Pdf
  17. {
  18. const CLASSNAME = __CLASS__;
  19. /**
  20. * @var integer
  21. * @Assert\Type(type="integer")
  22. */
  23. private $anzahl_protokolle;
  24. /**
  25. * @var \JF\JuridicusBundle\Entity\Pruefer
  26. * @Assert\Valid()
  27. */
  28. private $pruefer;
  29. /**
  30. * @var integer
  31. * @Assert\NotNull()
  32. * @Assert\Type(type="integer")
  33. * @Assert\Range(min="1",max="2")
  34. */
  35. private $examen;
  36. /**
  37. * @var \DateTime
  38. */
  39. private $created_at;
  40. /**
  41. * Set anzahl_protokolle
  42. *
  43. * @param integer $anzahlProtokolle
  44. * @return PdfProtokollJuridicus
  45. */
  46. public function setAnzahlProtokolle($anzahlProtokolle)
  47. {
  48. $this->anzahl_protokolle = $anzahlProtokolle;
  49. return $this;
  50. }
  51. /**
  52. * Get anzahl_protokolle
  53. *
  54. * @return integer
  55. */
  56. public function getAnzahlProtokolle()
  57. {
  58. return $this->anzahl_protokolle;
  59. }
  60. /**
  61. * Set pruefer [OWNING SIDE]
  62. *
  63. * @param \JF\JuridicusBundle\Entity\Pruefer $pruefer
  64. * @return PdfProtokollJuridicus
  65. */
  66. public function setPruefer(Pruefer $pruefer = null)
  67. {
  68. $this->pruefer = $pruefer;
  69. return $this;
  70. }
  71. /**
  72. * Get pruefer
  73. *
  74. * @return \JF\JuridicusBundle\Entity\Pruefer
  75. */
  76. public function getPruefer()
  77. {
  78. return $this->pruefer;
  79. }
  80. /**
  81. * Set examen
  82. *
  83. * @param integer $examen
  84. * @return PdfProtokollJuridicus
  85. */
  86. public function setExamen($examen)
  87. {
  88. $this->examen = $examen;
  89. return $this;
  90. }
  91. /**
  92. * Get examen
  93. *
  94. * @return integer
  95. */
  96. public function getExamen()
  97. {
  98. return $this->examen;
  99. }
  100. /**
  101. * Get dir
  102. *
  103. * @return string
  104. */
  105. public function getDir()
  106. {
  107. return realpath( __DIR__ . '/../../../../app/files/pdf/juridicus_old' );
  108. }
  109. /**
  110. * Set created_at
  111. *
  112. * @param \DateTime $createdAt
  113. * @return PdfProtokollJuridicus
  114. */
  115. public function setCreatedAt(\DateTime $createdAt = null)
  116. {
  117. $this->created_at = $createdAt;
  118. return $this;
  119. }
  120. /**
  121. * Get created_at
  122. *
  123. * @return \DateTime
  124. */
  125. public function getCreatedAt()
  126. {
  127. return $this->created_at;
  128. }
  129. /**
  130. * Get Prüfungsamt
  131. *
  132. * @return JF\JuridicusBundle\Entity\Pruefungsamt | null
  133. */
  134. public function getPruefungsamt()
  135. {
  136. if (!$this->id) {
  137. return null;
  138. }
  139. foreach ($this->getPruefer()->getPruefungsaemter() as $pa) {
  140. if ($pa->getExamen() == $this->examen) {
  141. return $pa;
  142. }
  143. }
  144. return null;
  145. }
  146. /**
  147. * String Representation
  148. *
  149. * @return string
  150. */
  151. public function __toString()
  152. {
  153. if ($this->id) {
  154. return sprintf('%s - %s.Examen', $this->getPruefer()->getFullText(), $this->examen);
  155. }
  156. return 'Neue Protokollmappe';
  157. }
  158. }