summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2007-09-29 22:07:12 +0000
committerxue <>2007-09-29 22:07:12 +0000
commit54e9feab491bcf8d1a95b486b68605cb4441e603 (patch)
treebffc84037861293872f5db616345888ffbd0e453 /framework
parent109ff4ee3bec41d95a122c6a69ad204c5dcfe099 (diff)
Changed RELATIONS declaration.
Diffstat (limited to 'framework')
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php2
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php2
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php4
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php2
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php6
-rw-r--r--framework/Data/ActiveRecord/TActiveRecord.php10
6 files changed, 16 insertions, 10 deletions
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
index 02d0b0e3..5d20476c 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php
@@ -39,7 +39,7 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelation');
* public $age;
* public $team; //foreign object TeamRecord
*
- * protected static $RELATIONS = array
+ * public static $RELATIONS = array
* (
* 'team' => array(self::BELONGS_TO, 'TeamRecord')
* );
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php
index 5c180c12..fea78e36 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php
@@ -34,7 +34,7 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelation');
*
* public $players=array(); //list of players
*
- * protected static $RELATIONS=array
+ * public static $RELATIONS=array
* (
* 'players' => array(self::HAS_MANY, 'PlayerRecord')
* );
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php
index 65989639..7e942e67 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php
@@ -35,7 +35,7 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelation');
*
* public $Categories=array(); //foreign object collection.
*
- * protected static $RELATIONS = array
+ * public static $RELATIONS = array
* (
* 'Categories' => array(self::HAS_MANY, 'CategoryRecord', 'Article_Category')
* );
@@ -52,7 +52,7 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelation');
*
* public $Articles=array();
*
- * protected static $RELATIONS = array
+ * public static $RELATIONS = array
* (
* 'Articles' => array(self::HAS_MANY, 'ArticleRecord', 'Article_Category')
* );
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php
index 7127d2ac..375c38ef 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php
@@ -43,7 +43,7 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelation');
*
* public $engine; //engine foreign object
*
- * protected static $RELATIONS=array
+ * public static $RELATIONS=array
* (
* 'engine' => array(self::HAS_ONE, 'EngineRecord')
* );
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php
index 16b29861..c9b47d12 100644
--- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php
+++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php
@@ -68,11 +68,7 @@ class TActiveRecordRelationContext
public function getRecordRelationships()
{
$class = new ReflectionClass($this->_sourceRecord);
- $statics = $class->getStaticProperties();
- if(isset($statics[self::RELATIONS_CONST]))
- return $statics[self::RELATIONS_CONST];
- else
- return array();
+ return $class->getStaticPropertyValue(self::RELATIONS_CONST);
}
public function getPropertyValue()
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php
index 5cc6dee0..bf7b68d9 100644
--- a/framework/Data/ActiveRecord/TActiveRecord.php
+++ b/framework/Data/ActiveRecord/TActiveRecord.php
@@ -106,10 +106,20 @@ abstract class TActiveRecord extends TComponent
* and the values are logical column names as defined as public variable/property names
* for the corresponding active record class.
* @var array column mapping. Keys: physical column names, values: logical column names.
+ * @since 3.1.1
*/
public static $COLUMN_MAPPING=array();
/**
+ * This static variable defines the relationships.
+ * The keys are public variable/property names defined in the AR class.
+ * Each value is an array, e.g. array(self::HAS_MANY, 'PlayerRecord').
+ * @var array relationship.
+ * @since 3.1.1
+ */
+ public static $RELATIONS=array();
+
+ /**
* @var boolean true if this class is read only.
*/
private $_readOnly=false;