src/Kunstmaan/AdminBundle/Entity/GroupPropertiesTrait.php
public function getRole($role = null)
    {
        /* @var $roleItem RoleInterface */
        foreach ($this->roles as $roleItem) {
            if ($role == $roleItem->getRole()) {
                return $roleItem;
            }
        }

        return null;
    }
public function getRole($role = null)
    {
        /* @var $roleItem RoleInterface */
        foreach ($this->roles as $roleItem) {
            if ($role == $roleItem->getRole()) {
                return $roleItem;
            }
        }

        return null;
    }
public function getRole ( $ role = null ) { /* @var $roleItem RoleInterface */ foreach ( $ this -> roles as $ roleItem ) { if ( $ role == $ roleItem -> getRole ( ) ) { return $ roleItem ; } } return null ; }
Pass a string, get the desired Role object or null.

@param string $role

@return Role|null
Pass a string get the desired Role object or null .