本文整理匯總了PHP中sfDoctrineRecord::toArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP sfDoctrineRecord::toArray方法的具體用法?PHP sfDoctrineRecord::toArray怎麽用?PHP sfDoctrineRecord::toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sfDoctrineRecord
的用法示例。
在下文中一共展示了sfDoctrineRecord::toArray方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: executeRule
private function executeRule(Rulerz $rule, sfDoctrineRecord $entity, $eventName)
{
$execution = new RulerzExecution();
$execution->setRulerz($rule);
$execution->setEvent($eventName);
$execution->setEntityUid($entity->getPrimaryKey());
try {
ob_start();
$lua = new Lua();
$lua->assign('entity', $entity->toArray());
$this->registerLuaApi($lua);
$result = $lua->eval($rule->getAction());
$print = ob_get_contents();
ob_end_clean();
$execution->setStatus('SUCCESS');
$execution->setExecutionData(sprintf("%s\n\nResult : %s", $print, $result));
} catch (Exception $e) {
$execution->setStatus('FAILED');
$execution->setExecutionData($e->__toString());
}
$execution->save();
}
示例2: toArray
public function toArray()
{
$array = parent::toArray();
$i18n = $this->getCurrentI18nObject();
$i18nArray = $i18n ? $i18n->toArray() : array();
return array_merge($array, $i18nArray);
}