public function setPrimary($role)
    {
        if (!$this->handlePrimary($role)) {
            return false;
        }
        $primaryField = $this->getPrimaryField($role);
        $primarySiblings = $this->getSiblings($role, true);
        foreach ($primarySiblings as $sibling) {
            $sibling->{$primaryField} = 0;
            if (!$sibling->save()) {
                return false;
            }
        }
        $this->owner->{$primaryField} = 1;

        return $this->owner->save();
    }
public function setPrimary($role)
    {
        if (!$this->handlePrimary($role)) {
            return false;
        }
        $primaryField = $this->getPrimaryField($role);
        $primarySiblings = $this->getSiblings($role, true);
        foreach ($primarySiblings as $sibling) {
            $sibling->{$primaryField} = 0;
            if (!$sibling->save()) {
                return false;
            }
        }
        $this->owner->{$primaryField} = 1;

        return $this->owner->save();
    }
public function setPrimary ( $ role ) { if ( ! $ this -> handlePrimary ( $ role ) ) { return false ; } $ primaryField = $ this -> getPrimaryField ( $ role ) ; $ primarySiblings = $ this -> getSiblings ( $ role , true ) ; foreach ( $ primarySiblings as $ sibling ) { $ sibling -> { $ primaryField } = 0 ; if ( ! $ sibling -> save ( ) ) { return false ; } } $ this -> owner -> { $ primaryField } = 1 ; return $ this -> owner -> save ( ) ; }
Set primary.

@param [[@doctodo param_type:role]] $role [[@doctodo param_description:role]]

@return [[@doctodo return_type:setPrimary]] [[@doctodo return_description:setPrimary]]
Set primary .