summaryrefslogtreecommitdiff
path: root/tests/simple_unit/ActiveRecord/records/ItemRecord.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/simple_unit/ActiveRecord/records/ItemRecord.php')
-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