protected function _actionLead(AnCommandContext $context)
    {
        if ($this->getItem()->eql($this->actor)) {
            throw new LibBaseControllerExceptionForbidden('Forbidden');
        }

        $this->getResponse()->status = AnHttpResponse::RESET_CONTENT;

        if (!$this->getItem()->following($this->actor)) {
            $this->getItem()->addLeader($this->actor);

            $this->createStory(array(
                'name' => 'actor_follower_add',
                'owner' => $this->actor,
                'subject' => $this->viewer,
                'object' => $this->getItem(),
                'target' => $this->actor,
            ));

            if ($this->actor->isAdministrable()) {
                $subscribers = $this->actor->administratorIds->toArray();
            } else {
                $subscribers = array($this->actor->id);
            }

            $this->createNotification(array(
                'name' => 'actor_follower_add',
                'subject' => $this->viewer,
                'object' => $this->getItem(),
                'target' => $this->actor,
                'subscribers' => $subscribers,
            ));
        }

        return $this->getItem();
    }
protected function _actionLead(AnCommandContext $context)
    {
        if ($this->getItem()->eql($this->actor)) {
            throw new LibBaseControllerExceptionForbidden('Forbidden');
        }

        $this->getResponse()->status = AnHttpResponse::RESET_CONTENT;

        if (!$this->getItem()->following($this->actor)) {
            $this->getItem()->addLeader($this->actor);

            $this->createStory(array(
                'name' => 'actor_follower_add',
                'owner' => $this->actor,
                'subject' => $this->viewer,
                'object' => $this->getItem(),
                'target' => $this->actor,
            ));

            if ($this->actor->isAdministrable()) {
                $subscribers = $this->actor->administratorIds->toArray();
            } else {
                $subscribers = array($this->actor->id);
            }

            $this->createNotification(array(
                'name' => 'actor_follower_add',
                'subject' => $this->viewer,
                'object' => $this->getItem(),
                'target' => $this->actor,
                'subscribers' => $subscribers,
            ));
        }

        return $this->getItem();
    }
protected function _actionLead ( AnCommandContext $ context ) { if ( $ this -> getItem ( ) -> eql ( $ this -> actor ) ) { throw new LibBaseControllerExceptionForbidden ( 'Forbidden' ) ; } $ this -> getResponse ( ) -> status = AnHttpResponse :: RESET_CONTENT ; if ( ! $ this -> getItem ( ) -> following ( $ this -> actor ) ) { $ this -> getItem ( ) -> addLeader ( $ this -> actor ) ; $ this -> createStory ( array ( 'name' => 'actor_follower_add' , 'owner' => $ this -> actor , 'subject' => $ this -> viewer , 'object' => $ this -> getItem ( ) , 'target' => $ this -> actor , ) ) ; if ( $ this -> actor -> isAdministrable ( ) ) { $ subscribers = $ this -> actor -> administratorIds -> toArray ( ) ; } else { $ subscribers = array ( $ this -> actor -> id ) ; } $ this -> createNotification ( array ( 'name' => 'actor_follower_add' , 'subject' => $ this -> viewer , 'object' => $ this -> getItem ( ) , 'target' => $ this -> actor , 'subscribers' => $ subscribers , ) ) ; } return $ this -> getItem ( ) ; }
Add a leader to this actor.

@param AnCommandContext $context Context Parameter

@return ComActorsDomainEntityActor object
Add a leader to this actor .