src/JuridicusBundle/Entity/PdfProtokollmappePruefer.php line 15

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. * PdfProtokollmappePruefer
  8. *
  9. * @ORM\Entity
  10. * @UniqueEntity(fields={"pruefer","examen"}, message="Die Kombination aus Prüfer und Examen wird bereits verwendet.")
  11. */
  12. class PdfProtokollmappePruefer extends Pdf
  13. {
  14. const CLASSNAME = __CLASS__;
  15. /**
  16. * @var integer
  17. * @Assert\Type(type="integer")
  18. * @Assert\Range(min="1", max="2")
  19. */
  20. private $examen;
  21. /**
  22. * @var integer
  23. * @Assert\Type(type="integer")
  24. * @Assert\Range(min="1")
  25. */
  26. private $anzahl_protokolle;
  27. /**
  28. * @var \DateTime
  29. */
  30. private $created_at;
  31. /**
  32. * @var \DateTim
  33. */
  34. private $updated_at;
  35. /**
  36. * @var \JF\JuridicusBundle\Entity\Pruefer
  37. * @Assert\Valid
  38. */
  39. private $pruefer;
  40. /**
  41. * Set examen
  42. *
  43. * @param integer $examen
  44. * @return PdfProtokollmappePruefer
  45. */
  46. public function setExamen($examen)
  47. {
  48. $this->examen = $examen;
  49. return $this;
  50. }
  51. /**
  52. * Get examen
  53. *
  54. * @return integer
  55. */
  56. public function getExamen()
  57. {
  58. return $this->examen;
  59. }
  60. /**
  61. * Set anzahl_protokolle
  62. *
  63. * @param integer $anzahlProtokolle
  64. * @return PdfProtokollmappePruefer
  65. */
  66. public function setAnzahlProtokolle($anzahlProtokolle)
  67. {
  68. $this->anzahl_protokolle = $anzahlProtokolle;
  69. return $this;
  70. }
  71. /**
  72. *
  73. */
  74. public function getPruefungsamt()
  75. {
  76. if (empty($this->id))
  77. {
  78. return null;
  79. }
  80. foreach($this->getPruefer()->getPruefungsaemter() as $pa)
  81. {
  82. if ($pa->getExamen() == $this->examen)
  83. {
  84. return $pa;
  85. }
  86. }
  87. return null;
  88. }
  89. /**
  90. * Get anzahl_protokolle
  91. *
  92. * @return integer
  93. */
  94. public function getAnzahlProtokolle()
  95. {
  96. return $this->anzahl_protokolle;
  97. }
  98. /**
  99. * Set created_at
  100. *
  101. * @param \DateTime $createdAt
  102. * @return PdfProtokollmappePruefer
  103. */
  104. public function setCreatedAt($createdAt)
  105. {
  106. $this->created_at = $createdAt;
  107. return $this;
  108. }
  109. /**
  110. * Get created_at
  111. *
  112. * @return \DateTime
  113. */
  114. public function getCreatedAt()
  115. {
  116. return $this->created_at;
  117. }
  118. /**
  119. * Set pruefer [OWNING SIDE]
  120. *
  121. * @param \JF\JuridicusBundle\Entity\Pruefer $pruefer
  122. * @return PdfProtokollmappePruefer
  123. */
  124. public function setPruefer(\JF\JuridicusBundle\Entity\Pruefer $pruefer = null)
  125. {
  126. $this->pruefer = $pruefer;
  127. return $this;
  128. }
  129. /**
  130. * Get pruefer
  131. *
  132. * @return \JF\JuridicusBundle\Entity\Pruefer
  133. */
  134. public function getPruefer()
  135. {
  136. return $this->pruefer;
  137. }
  138. /**
  139. * Get dir
  140. *
  141. * @return string
  142. */
  143. public function getDir()
  144. {
  145. return realpath(__DIR__ . '/../../../../app/files/pdf/protokollmappe_pruefer');
  146. }
  147. /**
  148. * String Representation
  149. *
  150. * @return string
  151. */
  152. public function __toString()
  153. {
  154. if ($this->id)
  155. {
  156. return sprintf('%s - %s.Examen', $this->getPruefer()->getFullText(), $this->examen);
  157. }
  158. return 'Neue Protokollmappe';
  159. }
  160. /**
  161. * Set updated_at
  162. *
  163. * @param \DateTime $updatedAt
  164. * @return PdfProtokollmappePruefer
  165. */
  166. public function setUpdatedAt($updatedAt)
  167. {
  168. $this->updated_at = $updatedAt;
  169. return $this;
  170. }
  171. /**
  172. * Get updated_at
  173. *
  174. * @return \DateTime
  175. */
  176. public function getUpdatedAt()
  177. {
  178. return $this->updated_at;
  179. }
  180. }