src/IUTUDC/WebsiteBundle/Entity/SliderConfig.php line 14

Open in your IDE?
  1. <?php
  2. namespace IUTUDC\WebsiteBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. /**
  6.  * SliderConfig
  7.  *
  8.  * @ORM\Table(name="iutudc_websitebundle_slider_configs")
  9.  * @ORM\Entity(repositoryClass="IUTUDC\WebsiteBundle\Repository\SliderConfigRepository")
  10.  */
  11. class SliderConfig extends \Kunstmaan\ConfigBundle\Entity\AbstractConfig
  12. {
  13.     /**
  14.      * @var ArrayCollection
  15.      *
  16.      * @ORM\OneToMany(targetEntity="\IUTUDC\WebsiteBundle\Entity\SliderItem", mappedBy="sliderConfig", cascade={"persist", "remove"}, orphanRemoval=true)
  17.      **/
  18.     private $sliderItems;
  19.     
  20.     /**
  21.      * Constructor
  22.      */
  23.     public function __construct()
  24.     {
  25.         $this->sliderItems = new ArrayCollection();
  26.     }
  27.     
  28.     /**
  29.      * @param ArrayCollection $sliderItems
  30.      */
  31.     public function setSliderItems($sliderItems)
  32.     {
  33.         $this->sliderItems $sliderItems;
  34.     }
  35.     /**
  36.      * @return ArrayCollection
  37.      */
  38.     public function getSliderItems()
  39.     {
  40.         return $this->sliderItems;
  41.     }
  42.     /**
  43.      * @param \IUTUDC\WebsiteBundle\Entity\SliderItem $sliderItem
  44.      */
  45.     public function addSliderItem(\IUTUDC\WebsiteBundle\Entity\SliderItem $sliderItem)
  46.     {
  47.         if (!$this->sliderItems->contains($sliderItem)) {
  48.             $this->sliderItems[] = $sliderItem;
  49.             $sliderItem->setSliderConfig($this);
  50.         }
  51.         
  52.         return $this;
  53.     }
  54.     /**
  55.      * @param \IUTUDC\WebsiteBundle\Entity\SliderItem $sliderItem
  56.      */
  57.     public function removeSliderItem(\IUTUDC\WebsiteBundle\Entity\SliderItem $sliderItem)
  58.     {
  59.         $this->sliderItems->removeElement($sliderItem);
  60.     }
  61.     
  62.     
  63.     /**
  64.     * This function is optional. Implement it if you would like a other ROLE to access the configuration section.
  65.     **/
  66.     public function getRoles()
  67.     {
  68.         return array('ROLE_ADMIN');
  69.     }
  70.     /**
  71.      * Returns the form type to use for this configuratble entity.
  72.      *
  73.      * @return string
  74.      */
  75.     public function getDefaultAdminType()
  76.     {
  77.         return 'IUTUDC\WebsiteBundle\Form\SliderConfigAdminType';
  78.     }
  79.     
  80.     
  81.    /**
  82.     * The internal name will be used as unique id for the route etc.
  83.     *
  84.     * Use a name with no spaces but with underscores.
  85.     *
  86.     * @return string
  87.     */
  88.     public function getInternalName()
  89.     {
  90.         return 'sliderconfig';
  91.     }
  92.      /**
  93.      * Returns the label for the menu item that will be created.
  94.      *
  95.      * @return string
  96.      */
  97.     public function getLabel()
  98.     {
  99.         return 'Configuration du slider';
  100.     }
  101. }