summaryrefslogtreecommitdiff
path: root/tests/simple_unit/ActiveRecord/records/ItemRecord.php
blob: 8585ebaf942d8836f08236fcdf1d999059b657fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;

	public static $RELATIONS=array
	(
		'related_items' => array(self::MANY_TO_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);
	}
}

?>