ZF-10744: Zend_Acl->getRoles() does not properly documented or implemented
Description
I'm not quite sure, is this documentation or code issue. Taking in mind Zend_Acl->getRoles() method doc, i expected roles instances:
source:
/**
* @return array of registered roles
*/
public function getRoles()
{
return array_keys($this->_getRoleRegistry()->getRoles());
}
So, the implementation can not return role instances, just IDs. I think this should be documented unequivocally or corrected in case if instances have been mentioned.
And IMHO: On the one hand current behavior is reasonable, but in case if custom roles implementation is necessary, Zend_Acl can not be used as unique roles registry. It is not a catastrophe, but not so comfortably as well.
Comments
Posted by Andries Seutens (andries) on 2010-12-17T03:30:52.000+0000
This is expected, as there is a unittest in place that verifies this behaviour.
If you want access to the role instances, you could simply subclass Zend_Acl:
Unless you have any objections, this issue can be closed.
Posted by Sergey Gruzdev (potam) on 2010-12-17T03:46:44.000+0000
I have no objections, thanks for answer. May be there's meaning to change method doc for prevent misunderstanding.
Posted by Andries Seutens (andries) on 2010-12-17T04:31:41.000+0000
Fixed in svn r23529 and merged to 1.11 release branch in svn r23530
Posted by Andries Seutens (andries) on 2010-12-17T04:33:10.000+0000
RE: previous comment
I've improved the docblock for the getRoles() method, so that it's clear that only role ID's are returned.