Permalink
Browse files

BackwardsCompatibilityBreak - fORMRelated::constructRecord() renamed …

…to fORMRelated::createRecord(), fORMRelated::constructRecordSet() renamed to fORMRelated::buildRecords()
  • Loading branch information...
wbond committed Aug 26, 2008
1 parent 90ac235 commit 66b4f30e04378191007b16f13d6e09c6c2bd4da4
@@ -117,9 +117,9 @@ public function __call($method_name, $parameters)
$subject = fGrammar::camelize($subject, TRUE);
if (isset($parameters[0])) {
return fORMRelated::constructRecordSet($this, $this->values, $this->related_records, $subject, $parameters[0]);
return fORMRelated::buildRecords($this, $this->values, $this->related_records, $subject, $parameters[0]);
}
return fORMRelated::constructRecordSet($this, $this->values, $this->related_records, $subject);
return fORMRelated::buildRecords($this, $this->values, $this->related_records, $subject);
case 'count':
$subject = fGrammar::singularize($subject);
@@ -134,9 +134,9 @@ public function __call($method_name, $parameters)
$subject = fGrammar::camelize($subject, TRUE);
if (isset($parameters[0])) {
return fORMRelated::constructRecord($this, $this->values, $subject, $parameters[0]);
return fORMRelated::createRecord($this, $this->values, $subject, $parameters[0]);
}
return fORMRelated::constructRecord($this, $this->values, $subject);
return fORMRelated::createRecord($this, $this->values, $subject);
case 'inject':
$subject = fGrammar::singularize($subject);
@@ -61,30 +61,7 @@ static public function associateRecords($class, &$related_records, $related_clas
/**
* Builds the object for the related class specified
*
* @internal
*
* @param mixed $class The class name or instance of the class to get the related values for
* @param array $values The values existing in the {@link fActiveRecord} class
* @param string $related_class The related class name
* @param string $route The route to the related class
* @return fActiveRecord An instace of the class specified
*/
static public function constructRecord($class, $values, $related_class, $route=NULL)
{
$table = fORM::tablize($class);
$related_table = fORM::tablize($related_class);
$relationship = fORMSchema::getRoute($table, $related_table, $route, '*-to-one');
return new $related_class($values[$relationship['column']]);
}
/**
* Builds a sequence of related records along a one-to-many or many-to-many relationship
* Builds a set of related records along a one-to-many or many-to-many relationship
*
* @internal
*
@@ -95,7 +72,7 @@ static public function constructRecord($class, $values, $related_class, $route=N
* @param string $route The route to follow for the class specified
* @return array An array of the related column values
*/
static public function constructRecordSet($class, &$values, &$related_records, $related_class, $route=NULL)
static public function buildRecords($class, &$values, &$related_records, $related_class, $route=NULL)
{
$table = fORM::tablize($class);
$related_table = fORM::tablize($related_class);
@@ -188,6 +165,29 @@ static public function countRecords($class, &$values, &$related_records, $relate
}
/**
* Builds the object for the related class specified
*
* @internal
*
* @param mixed $class The class name or instance of the class to get the related values for
* @param array $values The values existing in the {@link fActiveRecord} class
* @param string $related_class The related class name
* @param string $route The route to the related class
* @return fActiveRecord An instace of the class specified
*/
static public function createRecord($class, $values, $related_class, $route=NULL)
{
$table = fORM::tablize($class);
$related_table = fORM::tablize($related_class);
$relationship = fORMSchema::getRoute($table, $related_table, $route, '*-to-one');
return new $related_class($values[$relationship['column']]);
}
/**
* Figures out what filter to pass to {@link fRequest::filter()} for the specified related class
*

0 comments on commit 66b4f30

Please sign in to comment.