Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * Auto generated by prado-cli.php on 2007-05-01 05:33:28.
4
 */
5
class Territory extends TActiveRecord
6
{
7
	const TABLE='Territories';
8
 
9
	public $TerritoryID;
10
	public $TerritoryDescription;
11
	public $RegionID;
12
 
13
	private $_region;
14
	private $_employees;
15
 
16
	public static $RELATIONS = array
17
	(
18
		'Region' => array(self::BELONGS_TO, 'Region'),
19
		'Employees' => array(self::HAS_MANY, 'Employee', 'EmployeeTerritories')
20
	);
21
 
22
	/**
23
	 * @return Region
24
	 */
25
	public function getRegion()
26
	{
27
		//lazy load the region
28
		if($this->_region===null)
29
			$this->_region = Region::finder()->findByPk($this->RegionID);
30
		return $this->_region;
31
	}
32
 
33
	public function setRegion($value)
34
	{
35
		$this->_region=$value;
36
	}
37
 
38
	/**
39
	 * @return Employee[]
40
	 */
41
	public function getEmployees()
42
	{
43
		//lazy load
44
		if($this->_employees==null)
45
			$this->setEmployees($this->withEmployees()->findByPk($this->TerritoryID)->getEmployees());
46
		return $this->_employees;
47
	}
48
 
49
	public function setEmployees($value)
50
	{
51
		//ensure TList
52
		$this->_employees = $value instanceof TList ? $value : new TList($value);
53
	}
54
 
55
	public static function finder($className=__CLASS__)
56
	{
57
		return parent::finder($className);
58
	}
59
}
60
?>