Xpressengine\Permission\PermissionRepository::foster PHP Method

foster() public method

Parent Changing with descendant
public foster ( Permission $item, string $to ) : void
$item Permission permission instance
$to string parent name
return void
    public function foster(Permission $item, $to);

Usage Example

Ejemplo n.º 1
0
 /**
  * Move entity hierarchy to new parent or root
  *
  * @param Registered  $registered registered object
  * @param string|null $to         to registered prefix
  *
  * @return void
  * @throws InvalidArgumentException
  */
 public function move(Registered $registered, $to = null)
 {
     $toParent = $to !== null ? $this->repo->findByTypeAndName($registered->siteKey, $registered->type, $to) : null;
     if ($to !== null && $toParent === null || $toParent !== null && $registered->type != $toParent->type) {
         throw new InvalidArgumentException();
     }
     $parent = $registered->getParent();
     if ($parent === null) {
         if ($registered->getDepth() !== 1) {
             throw new InvalidArgumentException();
         }
         $this->repo->affiliate($registered, $to);
     } else {
         $this->repo->foster($registered, $to);
     }
 }
All Usage Examples Of Xpressengine\Permission\PermissionRepository::foster