Defining a function to a Row
im making an application and i need to implement diferent level of user permits.
I coul have the function
$this->view->users->hasPermits($this->view->user);
By declaring a function on the model, an things could be easy to implement. But i would like to be able to have the next function doing the sa开发者_如何转开发me:
$this->view->user->hasPermits();
Is there a way to do this? do i need to extend the Zend_Db_Table_Row class? any ideas?
Use Zend_Acl for this.
There is a Zend ACL tutorial on YouTube.
If $user is a Zend_Db_Table_Row from the Zend_Db_Table $users, than in User you could perform the method like so:
public function hasPermits()
{
return $this->getTable()->hasPermits($this);
}
精彩评论