本文整理匯總了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;
}