コード例 #1
0
ファイル: Role.php プロジェクト: ahmadrabie/Sylius
 /**
  * {@inheritdoc}
  */
 public function addChild(RoleInterface $role)
 {
     if (!$this->hasChild($role)) {
         $role->setParent($this);
         $this->children->add($role);
     }
 }
コード例 #2
0
ファイル: AbstractUser.php プロジェクト: Maksold/platform
 /**
  * {@inheritdoc}
  */
 public function addRole(RoleInterface $role)
 {
     if (!$this->hasRole($role)) {
         $this->roles->add($role);
     }
     return $this;
 }