summaryrefslogblamecommitdiffstats
path: root/application/models/Role.php
blob: e8812b98f2541a76e8b20c87569560b76b580c15 (plain) (tree)
1
2
3
4
5
6
7
8
9



                            




                                
                                                          






































































                                                                            
 



                                                      

 
<?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 get_roleID()
	{
		return $this->_roleID;
	}

	public function set_roleID($_roleID)
	{
		$this->_roleID = $_roleID;
	}

	public function get_groupID()
	{
		return $this->_groupID;
	}

	public function set_groupID($_groupID)
	{
		$this->_groupID = $_groupID;
	}

	public function get_title()
	{
		return $this->_title;
	}

	public function set_title($_title)
	{
		$this->_title = $_title;
	}

	public function get_description()
	{
		return $this->_description;
	}

	public function set_description($_description)
	{
		$this->_description = $_description;
	}
}