src/JuridicusBundle/Entity/Faq.php line 12

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.  * Faq
  8.  */
  9. class Faq
  10. {
  11.     const CLASSNAME __CLASS__;
  12.     
  13.     /**
  14.      * @var integer
  15.      */
  16.     private $id;
  17.     /**
  18.      * @var integer
  19.      */
  20.     private $sortierung 0;
  21.     /**
  22.      * @var string
  23.      * @Assert\NotBlank
  24.      */
  25.     private $frage;
  26.     /**
  27.      * @var string
  28.      * @Assert\NotBlank
  29.      */
  30.     private $antwort;
  31.     /**
  32.      * @var \DateTime
  33.      * @Assert\Type(\DateTimeInterface::class)
  34.      */
  35.     private $created_at;
  36.     /**
  37.      * @var \DateTime
  38.      * @Assert\Type(\DateTimeInterface::class)
  39.      */
  40.     private $updated_at;
  41.     
  42.     public function __construct()
  43.     {
  44.         $this->created_at = new \DateTime();
  45.         $this->updated_at = new \DateTime();
  46.     }
  47.     /**
  48.      * Get id
  49.      *
  50.      * @return integer 
  51.      */
  52.     public function getId()
  53.     {
  54.         return $this->id;
  55.     }
  56.     /**
  57.      * Set sortierung
  58.      *
  59.      * @param integer $sortierung
  60.      * @return Faq
  61.      */
  62.     public function setSortierung($sortierung)
  63.     {
  64.         $this->sortierung $sortierung;
  65.     
  66.         return $this;
  67.     }
  68.     /**
  69.      * Get sortierung
  70.      *
  71.      * @return integer 
  72.      */
  73.     public function getSortierung()
  74.     {
  75.         return $this->sortierung;
  76.     }
  77.     /**
  78.      * Set frage
  79.      *
  80.      * @param string $frage
  81.      * @return Faq
  82.      */
  83.     public function setFrage($frage)
  84.     {
  85.         $this->frage $frage;
  86.     
  87.         return $this;
  88.     }
  89.     /**
  90.      * Get frage
  91.      *
  92.      * @return string 
  93.      */
  94.     public function getFrage()
  95.     {
  96.         return $this->frage;
  97.     }
  98.     /**
  99.      * Set antwort
  100.      *
  101.      * @param string $antwort
  102.      * @return Faq
  103.      */
  104.     public function setAntwort($antwort)
  105.     {
  106.         $this->antwort $antwort;
  107.     
  108.         return $this;
  109.     }
  110.     /**
  111.      * Get antwort
  112.      *
  113.      * @return string 
  114.      */
  115.     public function getAntwort()
  116.     {
  117.         return $this->antwort;
  118.     }
  119.     /**
  120.      * Set created_at
  121.      *
  122.      * @param \DateTime $createdAt
  123.      * @return Faq
  124.      */
  125.     public function setCreatedAt($createdAt)
  126.     {
  127.         $this->created_at $createdAt;
  128.     
  129.         return $this;
  130.     }
  131.     /**
  132.      * Get created_at
  133.      *
  134.      * @return \DateTime 
  135.      */
  136.     public function getCreatedAt()
  137.     {
  138.         return $this->created_at;
  139.     }
  140.     /**
  141.      * Set updated_at
  142.      *
  143.      * @param \DateTime $updatedAt
  144.      * @return Faq
  145.      */
  146.     public function setUpdatedAt($updatedAt)
  147.     {
  148.         $this->updated_at $updatedAt;
  149.     
  150.         return $this;
  151.     }
  152.     /**
  153.      * Get updated_at
  154.      *
  155.      * @return \DateTime 
  156.      */
  157.     public function getUpdatedAt()
  158.     {
  159.         return $this->updated_at;
  160.     }
  161.     
  162.        
  163.     public function __toString()
  164.     {
  165.         return sprintf('FAQ Item #%d'$this->getSortierung());
  166.     }
  167.     
  168.     /**
  169.      * @param array replacements
  170.      * @return string
  171.      */
  172.     public function antwortReplace( array $replacements )
  173.     {
  174.         $body $this->antwort;
  175.         
  176.         if ( isset( $replacements['host'] ) )
  177.         {
  178.             $body str_replace('[HOST]'sprintf'<a href="http://%1$s">%1$s</a>'$replacements['host'] ), $body);
  179.         }
  180.         if ( isset( $replacements['anzahl_pruefer'] ) )
  181.         {
  182.             $body str_replace('[ANZAHL_PRUEFER]',$replacements['anzahl_pruefer'], $body);
  183.         }                                                                
  184.         return $body;
  185.     }
  186. }