本文整理匯總了PHP中Yii::enableProfile方法的典型用法代碼示例。如果您正苦於以下問題:PHP Yii::enableProfile方法的具體用法?PHP Yii::enableProfile怎麽用?PHP Yii::enableProfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Yii
的用法示例。
在下文中一共展示了Yii::enableProfile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: findAndModify
/**
* Find one record, modifies, and returns it.
* @return null|EMongoDocument
*/
public function findAndModify($criteria = array(), $updateDoc = array(), $fields = array(), $options = array())
{
$this->trace(__FUNCTION__);
if ($criteria instanceof EMongoCriteria) {
$criteria = $criteria->getCondition();
}
$c = $this->getDbCriteria();
$criteria = $this->mergeCriteria(isset($c['condition']) ? $c['condition'] : array(), $criteria);
$fields = $this->mergeCriteria(isset($c['project']) ? $c['project'] : array(), $fields);
$options = array_merge($this->getDbConnection()->getDefaultWriteConcern(), $options);
if (YII_DEBUG) {
Yii::trace('Executing findAndModify: { $query: ' . json_encode($criteria) . ', $document: ' . json_encode($updateDoc) . ', $fields: ' . json_encode($fields) . ', $options: ' . json_encode($options) . '}', 'extensions.MongoYii.EMongoDocument');
}
if ($this->getDbConnection()->enableProfiling) {
$token = 'extensions.MongoYii.EMongoDocument.query.' . $this->collectionName() . '.findAndModify({ $query: ' . json_encode($criteria) . ', $document: ' . json_encode($updateDoc) . ', $fields: ' . json_encode($fields) . ', $options: ' . json_encode($options) . '})';
Yii::beginProfile($token, 'extensions.MongoYii.EMongoDocument.findAndModify');
}
$result = $this->getCollection()->findAndModify($criteria, $updateDoc, $fields, $options);
if ($this->getDbConnection()->enableProfiling) {
Yii::enableProfile($token, 'extensions.MongoYii.EMongoDocument.findAndModify');
}
if ($result === null) {
return null;
}
return $this->populateRecord($result, true, $fields === array() ? false : true);
}