summaryrefslogtreecommitdiff
path: root/tests/simple_unit/ActiveRecord/records
diff options
context:
space:
mode:
authorwei <>2007-05-04 08:37:12 +0000
committerwei <>2007-05-04 08:37:12 +0000
commit8708f7e88e423b44ea4b3b8fff14f055d2b5c4ac (patch)
treef468f8990c7675089f804914453ba994d0c1be30 /tests/simple_unit/ActiveRecord/records
parentc1bddf3826ec570ea4c58d7a56c410ae54d26508 (diff)
Add saving/updating ActiveRecord relationships.
Diffstat (limited to 'tests/simple_unit/ActiveRecord/records')
-rw-r--r--tests/simple_unit/ActiveRecord/records/ItemRecord.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/simple_unit/ActiveRecord/records/ItemRecord.php b/tests/simple_unit/ActiveRecord/records/ItemRecord.php
new file mode 100644
index 00000000..189d22c9
--- /dev/null
+++ b/tests/simple_unit/ActiveRecord/records/ItemRecord.php
@@ -0,0 +1,49 @@
+<?php
+
+class ItemRecord extends TActiveRecord
+{
+ const TABLE='items';
+ public $item_id;
+ public $name;
+ public $brand_specific;
+ public $description;
+ public $meta;
+ public $active;
+ public $need_review;
+ public $category_id;
+ public $type_id;
+ public $content;
+ public $standard_id;
+ public $timestamp;
+
+ public $related_items = array();
+ public $related_item_id;
+
+ protected static $RELATIONS=array
+ (
+ 'related_items' => array(self::HAS_MANY, 'ItemRecord', 'related_items.(related_item_id)'),
+ );
+
+ public function getDbConnection()
+ {
+ static $conn;
+ if($conn===null)
+ {
+ $conn = new TDbConnection('pgsql:host=localhost;dbname=test', 'test','test');
+ $this->OnExecuteCommand[] = array($this,'logger');
+ }
+ return $conn;
+ }
+
+ public function logger($sender,$param)
+ {
+ //var_dump($param->Command->Text);
+ }
+
+ public static function finder($className=__CLASS__)
+ {
+ return parent::finder($className);
+ }
+}
+
+?> \ No newline at end of file