blob: d00b93f7060291149a2f315eb8fd2677b0aaf96e (
plain) (
tree)
|
|
<?php
class Application_Model_Role
{
protected $_roleID;
protected $_groupID;
protected $_title;
protected $_description;
public function __construct(array $options = null)
{
if (is_array($options)) {
$this->setOptions($options);
}
}
public function __set($name, $value)
{
$method = 'set' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
throw new Exception('Invalid role property');
}
$this->$method($value);
}
public function __get($name)
{
$method = 'get' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
throw new Exception('Invalid role property');
}
return $this->$method();
}
public function setOptions(array $options)
{
$methods = get_class_methods($this);
foreach ($options as $key => $value) {
$method = 'set' . ucfirst($key);
if (in_array($method, $methods)) {
$this->$method($value);
}
}
return $this;
}
public function getID()
{
return $this->_roleID;
}
public function setID($_roleID)
{
$this->_roleID = $_roleID;
}
public function getGroupID()
{
return $this->_groupID;
}
public function setGroupID($_groupID)
{
$this->_groupID = $_groupID;
}
public function getTitle()
{
return $this->_title;
}
public function setTitle($_title)
{
$this->_title = $_title;
}
public function getDescription()
{
return $this->_description;
}
public function setDescription($_description)
{
$this->_description = $_description;
}
}
|