src/JuridicusBundle/Entity/Dienststellung.php line 16

Open in your IDE?
  1. <?php
  2. namespace JF\JuridicusBundle\Entity;
  3. use JF\JuridicusBundle\Utils\Juridicus;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. /**
  8.  * Dienststellung
  9.  * 
  10.  * @ORM\Entity
  11.  * @UniqueEntity("name") 
  12.  */
  13. class Dienststellung
  14. {
  15.     const CLASSNAME __CLASS__;
  16.     
  17.     private static $default_alias_map = array(
  18.     );
  19.     public static function getDefaultAliases()
  20.     {
  21.         return self::$default_alias_map;        
  22.     }   
  23.     
  24.     /**
  25.      * @var integer
  26.      */
  27.     private $id;
  28.     /**
  29.      * @var string
  30.      * @Assert\NotBlank
  31.      * @Assert\Length(max="64")
  32.      */
  33.     private $name;
  34.     /**
  35.      * @var string
  36.      * @Assert\Length(max="64")
  37.      */
  38.     private $slug;
  39.     /**
  40.      * @var \Doctrine\Common\Collections\Collection
  41.      */
  42.     private $aliases;
  43.     /**
  44.      * @var \JF\JuridicusBundle\Entity\Dienststellung
  45.      * @Assert\Valid
  46.      */
  47.     private $alias_for;
  48.    /**
  49.      * @var \Doctrine\Common\Collections\Collection
  50.      */
  51.     private $pruefer;
  52.     /**
  53.      * Constructor
  54.      */
  55.     public function __construct()
  56.     {
  57.         $this->aliases = new \Doctrine\Common\Collections\ArrayCollection();
  58.         $this->pruefer = new \Doctrine\Common\Collections\ArrayCollection();        
  59.     }
  60.     
  61.     /**
  62.      * Get id
  63.      *
  64.      * @return integer 
  65.      */
  66.     public function getId()
  67.     {
  68.         return $this->id;
  69.     }
  70.     /**
  71.      * Set name
  72.      *
  73.      * @param string $name
  74.      * @return Dienststellung
  75.      */
  76.     public function setName($name)
  77.     {
  78.         $this->name $name;
  79.     
  80.         return $this;
  81.     }
  82.     /**
  83.      * Get name
  84.      *
  85.      * @return string 
  86.      */
  87.     public function getName()
  88.     {
  89.         return $this->name;
  90.     }
  91.     
  92.     /**
  93.      * Get visible name
  94.      *
  95.      * @return string 
  96.      */
  97.     public function getVisibleName()
  98.     {
  99.         if (isset($this->alias_for))
  100.         {
  101.             return $this->alias_for->getName();
  102.         }
  103.         return $this->getName();
  104.     }
  105.     /**
  106.      * Set slug
  107.      *
  108.      * @param string $slug
  109.      * @return Dienststellung
  110.      */
  111.     public function setSlug($slug)
  112.     {
  113.         $this->slug $slug;
  114.     
  115.         return $this;
  116.     }
  117.     /**
  118.      * Get slug
  119.      *
  120.      * @return string 
  121.      */
  122.     public function getSlug()
  123.     {
  124.         return $this->slug;
  125.     }
  126.     /**
  127.      * Add aliases [INVERSE SIDE]
  128.      *
  129.      * @param \JF\JuridicusBundle\Entity\Dienststellung $aliases
  130.      * @return Dienststellung
  131.      */
  132.     public function addAliase(\JF\JuridicusBundle\Entity\Dienststellung $aliases)
  133.     {
  134.         $this->aliases[] = $aliases;
  135.     
  136.         return $this;
  137.     }
  138.     /**
  139.      * Remove aliases [INVERSE SIDE]
  140.      *
  141.      * @param \JF\JuridicusBundle\Entity\Dienststellung $aliases
  142.      */
  143.     public function removeAliase(\JF\JuridicusBundle\Entity\Dienststellung $aliases)
  144.     {
  145.         $this->aliases->removeElement($aliases);
  146.     }
  147.     /**
  148.      * Get aliases
  149.      *
  150.      * @return \Doctrine\Common\Collections\Collection 
  151.      */
  152.     public function getAliases()
  153.     {
  154.         return $this->aliases;
  155.     }
  156.     /**
  157.      * Set alias_for [OWNING SIDE]
  158.      *
  159.      * @param \JF\JuridicusBundle\Entity\Dienststellung $aliasFor
  160.      * @return Dienststellung
  161.      */
  162.     public function setAliasFor(\JF\JuridicusBundle\Entity\Dienststellung $aliasFor null)
  163.     {
  164.         $this->alias_for $aliasFor;  
  165.     
  166.         return $this;
  167.     }
  168.     /**
  169.      * Get alias_for [OWNING SIDE]
  170.      *
  171.      * @return \JF\JuridicusBundle\Entity\Dienststellung 
  172.      */
  173.     public function getAliasFor()
  174.     {
  175.         return $this->alias_for;
  176.     }
  177.     
  178.     /**
  179.      * @ORM\PrePersist
  180.      * @ORM\PreUpdate
  181.      */
  182.     public function setSlugValue()
  183.     {
  184.         $this->slug strtolower(Juridicus::slugify$this->name ));
  185.         return $this;
  186.     }      
  187.     
  188.     /**
  189.      * Compares two Dienststellung entities
  190.      * @param Dienststellung
  191.      * @return boolean
  192.      */
  193.     public function equalsDienststellung $d )
  194.     {
  195.         return $this->name == $d->name;        
  196.     }
  197.     
  198.     /**
  199.      * String Representation
  200.      * @return string
  201.      */       
  202.     public function __toString()
  203.     {
  204.         if (isset($this->name))
  205.         {
  206.             return $this->name;
  207.         }
  208.         return 'Neue Dienststellung';
  209.     }
  210.  
  211.     /**
  212.      * Add pruefer [INVERSE SIDE]
  213.      *
  214.      * @param \JF\JuridicusBundle\Entity\Pruefer $pruefer
  215.      * @return Dienststellung
  216.      */
  217.     public function addPruefer(\JF\JuridicusBundle\Entity\Pruefer $pruefer)
  218.     {
  219.         $this->pruefer[] = $pruefer;
  220.         
  221.         return $this;
  222.     }
  223.     /**
  224.      * Remove pruefer [INVERSE SIDE]
  225.      *
  226.      * @param \JF\JuridicusBundle\Entity\Pruefer $pruefer
  227.      */
  228.     public function removePruefer(\JF\JuridicusBundle\Entity\Pruefer $pruefer)
  229.     {
  230.         $this->pruefer->removeElement($pruefer);
  231.     }
  232.     /**
  233.      * Get pruefer
  234.      *
  235.      * @return \Doctrine\Common\Collections\Collection 
  236.      */
  237.     public function getPruefer()
  238.     {
  239.         return $this->pruefer;
  240.     }
  241. }