當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Doctrine_Collection::toArray方法代碼示例

本文整理匯總了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);
 }
開發者ID:EricHogue,項目名稱:Koryukan,代碼行數:12,代碼來源:Collection.php

示例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"));
//.........這裏部分代碼省略.........
開發者ID:7thZoneTechnology,項目名稱:hrms-1,代碼行數:101,代碼來源:RoleController.php


注:本文中的Doctrine_Collection::toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。