summaryrefslogtreecommitdiff
path: root/demos/northwind-db/protected/database/Territory.php
diff options
context:
space:
mode:
authorwei <>2007-05-03 01:37:21 +0000
committerwei <>2007-05-03 01:37:21 +0000
commitea9e7eb535b460218b693d4e5fec80297eb3e360 (patch)
tree8dc4f4ac6d29989ba912a6013ffa6590c71e857d /demos/northwind-db/protected/database/Territory.php
parent1ae09931b2572d9c3067c99f841a60cb3330b3f3 (diff)
Add northwind db demo.
Diffstat (limited to 'demos/northwind-db/protected/database/Territory.php')
-rw-r--r--demos/northwind-db/protected/database/Territory.php60
1 files changed, 60 insertions, 0 deletions
diff --git a/demos/northwind-db/protected/database/Territory.php b/demos/northwind-db/protected/database/Territory.php
new file mode 100644
index 00000000..4da0ff46
--- /dev/null
+++ b/demos/northwind-db/protected/database/Territory.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Auto generated by prado-cli.php on 2007-05-01 05:33:28.
+ */
+class Territory extends TActiveRecord
+{
+ const TABLE='Territories';
+
+ public $TerritoryID;
+ public $TerritoryDescription;
+ public $RegionID;
+
+ private $_region;
+ private $_employees;
+
+ protected static $RELATIONS = array
+ (
+ 'Region' => array(self::BELONGS_TO, 'Region'),
+ 'Employees' => array(self::HAS_MANY, 'Employee', 'EmployeeTerritories')
+ );
+
+ /**
+ * @return Region
+ */
+ public function getRegion()
+ {
+ //lazy load the region
+ if($this->_region===null)
+ $this->_region = Region::finder()->findByPk($this->RegionID);
+ return $this->_region;
+ }
+
+ public function setRegion($value)
+ {
+ $this->_region=$value;
+ }
+
+ /**
+ * @return Employee[]
+ */
+ public function getEmployees()
+ {
+ //lazy load
+ if($this->_employees==null)
+ $this->setEmployees($this->withEmployees()->findByPk($this->TerritoryID)->getEmployees());
+ return $this->_employees;
+ }
+
+ public function setEmployees($value)
+ {
+ //ensure TList
+ $this->_employees = $value instanceof TList ? $value : new TList($value);
+ }
+
+ public static function finder($className=__CLASS__)
+ {
+ return parent::finder($className);
+ }
+}
+?> \ No newline at end of file