本文整理汇总了PHP中TActiveRecord::createRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP TActiveRecord::createRecord方法的具体用法?PHP TActiveRecord::createRecord怎么用?PHP TActiveRecord::createRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TActiveRecord
的用法示例。
在下文中一共展示了TActiveRecord::createRecord方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyResultMap
/**
* Apply result mapping.
* @param array a result set row retrieved from the database
* @param object the result object, will create if necessary.
* @return object the result filled with data, null if not filled.
*/
protected function applyResultMap($row, &$resultObject = null)
{
if ($row === false) {
return null;
}
$resultMapName = $this->_statement->getResultMap();
$resultClass = $this->_statement->getResultClass();
$obj = null;
if ($this->getManager()->getResultMaps()->contains($resultMapName)) {
$obj = $this->fillResultMap($resultMapName, $row, null, $resultObject);
} else {
if (strlen($resultClass) > 0) {
$obj = $this->fillResultClass($resultClass, $row, $resultObject);
} else {
$obj = $this->fillDefaultResultMap(null, $row, $resultObject);
}
}
if (class_exists('TActiveRecord', false) && $obj instanceof TActiveRecord) {
//Create a new clean active record.
$obj = TActiveRecord::createRecord(get_class($obj), $obj);
}
return $obj;
}
示例2: createFkObject
/**
* @param string active record class name.
* @param array row data
* @param array foreign key column names
* @return TActiveRecord
*/
protected function createFkObject($type, $row, $foreignKeys)
{
$obj = TActiveRecord::createRecord($type, $row);
if (count($this->_association_columns) > 0) {
$i = 0;
foreach ($foreignKeys as $ref => $fk) {
$obj->setColumnValue($ref, $row[$this->_association_columns[$i++]]);
}
}
return $obj;
}