src/Alchemy/Component/Cerberus/Model/Base/User.php
public function addRole(ChildRole $role)
    {
        if ($this->collRoles === null) {
            $this->initRoles();
        }

        if (!$this->getRoles()->contains($role)) {
            // only add it if the **same** object is not already associated
            $this->collRoles->push($role);
            $this->doAddRole($role);
        }

        return $this;
    }
public function addRole(ChildRole $role)
    {
        if ($this->collRoles === null) {
            $this->initRoles();
        }

        if (!$this->getRoles()->contains($role)) {
            // only add it if the **same** object is not already associated
            $this->collRoles->push($role);
            $this->doAddRole($role);
        }

        return $this;
    }
public function addRole ( ChildRole $ role ) { if ( $ this -> collRoles === null ) { $ this -> initRoles ( ) ; } if ( ! $ this -> getRoles ( ) -> contains ( $ role ) ) { // only add it if the **same** object is not already associated $ this -> collRoles -> push ( $ role ) ; $ this -> doAddRole ( $ role ) ; } return $ this ; }
Associate a ChildRole to this object
through the user_role cross reference table.

@param ChildRole $role
@return ChildUser The current object (for fluent API support)
Associate a ChildRole to this object through the user_role cross reference table .