Esempio n. 1
0
 /**
  * Remove sectionNavigations
  *
  * @param \Unifik\SystemBundle\Entity\SectionNavigation $sectionNavigations
  */
 public function removeSectionNavigation(\Unifik\SystemBundle\Entity\SectionNavigation $sectionNavigations)
 {
     $this->sectionNavigations->removeElement($sectionNavigations);
 }
Esempio n. 2
0
 /**
  * Set the navigations
  *
  * @param $navigations ArrayCollection
  */
 public function setNavigations($navigations)
 {
     // Removing unassociated navigations
     foreach ($this->sectionNavigations as $key => $sectionNavigation) {
         if (false == $navigations->contains($sectionNavigation->getNavigation())) {
             unset($this->sectionNavigations[$key]);
         }
     }
     foreach ($navigations as $navigation) {
         // Already associated
         foreach ($this->sectionNavigations as $sectionNavigation) {
             if ($sectionNavigation->getNavigation() === $navigation) {
                 continue 2;
             }
         }
         // Has to be associated
         $sectionNavigation = new SectionNavigation();
         $sectionNavigation->setNavigation($navigation);
         $sectionNavigation->setSection($this);
         $this->sectionNavigations[] = $sectionNavigation;
     }
 }