Пример #1
0
 /**
  * {@inheritDoc}
  */
 public function getRoles()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getRoles', array());
     return parent::getRoles();
 }
Пример #2
0
 /**
  * Update profile role 
  * 
  * @param \XLite\Model\Profile $profile Profile
  *  
  * @return void
  */
 protected function updateProfileRole(\XLite\Model\Profile $profile)
 {
     $rootRole = \XLite\Core\Database::getRepo('XLite\\Model\\Role')->findOneRoot();
     if (\XLite\Core\Auth::getInstance()->getAdminAccessLevel() == $profile->getAccessLevel()) {
         // Add root role
         if ($rootRole && !$profile->getRoles()->contains($rootRole)) {
             $profile->addRoles($rootRole);
             $rootRole->addProfiles($profile);
         }
     } else {
         // Remove root role
         if ($rootRole && $profile->getRoles()->contains($rootRole)) {
             $profile->getRoles()->removeElement($rootRole);
             $rootRole->getProfiles()->removeElement($profile);
         }
     }
     \XLite\Core\Database::getEM()->flush();
 }