本文整理汇总了PHP中Doctrine_Collection::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Collection::toArray方法的具体用法?PHP Doctrine_Collection::toArray怎么用?PHP Doctrine_Collection::toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Collection
的用法示例。
在下文中一共展示了Doctrine_Collection::toArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _saveInCache
/**
* Save in cache
*
* @return void
*/
private function _saveInCache(Zend_Cache_Core $cache)
{
$cacheData = array();
$cacheData['tableName'] = $this->_dbData->getTable()->getComponentName();
$cacheData['dataArray'] = $this->_dbData->toArray(self::SERIALIZATION_DEEP);
$cache->save($cacheData, $this->_cacheKey);
}
示例2: processrolesAction
public function processrolesAction()
{
$session = SessionWrapper::getInstance();
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(TRUE);
$this->_translate = Zend_Registry::get("translate");
$post_array = $this->_getAllParams();
// debugMessage($this->_getAllParams()); exit;
$id = $post_array['id'];
$post_array['id'] = decode($id);
$perms = $post_array['permissions'];
unset($post_array['permissions']);
if (isEmptyString($id)) {
// add new role first
$newrole = new AclGroup();
$post_array['createdby'] = $session->getVar('userid');
$newrole->processPost($post_array);
// debugMessage($newrole->toArray()); debugMessage('error is '.$newrole->getErrorStackAsString());
$newrole->save();
$post_array['id'] = $newrole->getID();
} else {
// update role first
$newrole = new AclGroup();
$newrole->populate(decode($id));
$newrole->processPost($post_array);
// debugMessage($newrole->toArray()); debugMessage('error is '.$newrole->getErrorStackAsString()); // exit();
$newrole->save();
}
// exit;
$role = new AclGroup();
$role->populate($post_array['id']);
$permissions = $role->getPermissions();
$permissions_array = $permissions->toArray();
$post_array['permissions'] = $perms;
// set audit entry before save
if (!isArrayKeyAnEmptyString('permissions', $post_array)) {
$data = array();
foreach ($post_array['permissions'] as $key => $value) {
$data[$key] = $value;
$post_array['permissions'][$key]['groupid'] = $post_array['id'];
if (isArrayKeyAnEmptyString('flag', $value)) {
$post_array['permissions'][$key]['flag'] = 0;
} else {
$post_array['permissions'][$key]['flag'] = trim(intval($value['flag']));
}
if (isArrayKeyAnEmptyString('create', $value)) {
$post_array['permissions'][$key]['create'] = 0;
} else {
$post_array['permissions'][$key]['create'] = trim(intval($value['create']));
}
if (isArrayKeyAnEmptyString('edit', $value)) {
$post_array['permissions'][$key]['edit'] = 0;
} else {
$post_array['permissions'][$key]['edit'] = trim(intval($value['edit']));
}
if (isArrayKeyAnEmptyString('view', $value)) {
$post_array['permissions'][$key]['view'] = 0;
} else {
$post_array['permissions'][$key]['view'] = trim(intval($value['view']));
}
if (isArrayKeyAnEmptyString('list', $value)) {
$post_array['permissions'][$key]['list'] = 0;
} else {
$post_array['permissions'][$key]['list'] = trim(intval($value['list']));
}
if (isArrayKeyAnEmptyString('delete', $value)) {
$post_array['permissions'][$key]['delete'] = 0;
} else {
$post_array['permissions'][$key]['delete'] = trim(intval($value['delete']));
}
if (isArrayKeyAnEmptyString('approve', $value)) {
$post_array['permissions'][$key]['approve'] = 0;
} else {
$post_array['permissions'][$key]['approve'] = trim(intval($value['approve']));
}
if (isArrayKeyAnEmptyString('export', $value)) {
$post_array['permissions'][$key]['export'] = 0;
} else {
$post_array['permissions'][$key]['export'] = trim(intval($value['export']));
}
if (isArrayKeyAnEmptyString('id', $value)) {
$post_array['permissions'][$key]['id'] = NULL;
}
$post_array['permissions'][$key]['createdby'] = $session->getVar('userid');
$post_array['permissions'][$key]['datecreated'] = getCurrentMysqlTimestamp();
if (!isArrayKeyAnEmptyString('id', $value)) {
$post_array['permissions'][$key]['lastupdatedby'] = $session->getVar('userid');
$post_array['permissions'][$key]['lastupdatedate'] = getCurrentMysqlTimestamp();
} else {
$post_array['createdby'] = $session->getVar('userid');
}
}
// end loop through permissions to unset empty groupids
}
// debugMessage($post_array); exit();
if (!isEmptyString($id)) {
$beforesave = $post_array['permissions'];
// debugMessage($beforesave);
}
$perm_collection = new Doctrine_Collection(Doctrine_Core::getTable("AclPermission"));
//.........这里部分代码省略.........