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


PHP Revision::setParentId方法代碼示例

本文整理匯總了PHP中Revision::setParentId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Revision::setParentId方法的具體用法?PHP Revision::setParentId怎麽用?PHP Revision::setParentId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Revision的用法示例。


在下文中一共展示了Revision::setParentId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addControlRevision

 public function addControlRevision($parent_id)
 {
     $parent_rev = Doctrine::getTable('Revision')->find($parent_id);
     if ($parent_rev->getBlock()) {
         return false;
     }
     $singleton = sfContext::getInstance();
     $last_revision = $this->getLastRevision();
     //if($last_revision->getRevisionStateId() == 5) {
     // Agregamos nueva revision de control
     $new_control_revision = new Revision();
     $new_control_revision->setProcedureId($this->get('id'));
     $new_control_revision->setParentId($parent_id);
     $new_control_revision->setRevisionStateId(1);
     $new_control_revision->setBlock(false);
     $new_control_revision->setCreatorId($singleton->getUser()->getGuardUser()->getId());
     $new_control_revision->save();
     // controlamos si previamente existe una revision de control
     $previous_revision = $this->getLastControlRevision();
     if (!empty($previous_revision)) {
         $previuos_items = $this->getLastControlRevision()->getRevisionItem();
         foreach ($previuos_items as $prev_item) {
             $rev = new RevisionItem();
             $rev->setRevisionId($new_control_revision->get('id'));
             $rev->setItemId($prev_item->get('item_id'));
             $rev->setState($prev_item->get('state'));
             $rev->save();
         }
     } else {
         // add revision items
         $items = Doctrine::getTable('Item')->createQuery('i')->leftJoin('i.ItemFormu if')->where('if.form_id = ?', $this->getFormuId())->execute();
         foreach ($items as $item) {
             $rev = new RevisionItem();
             $rev->setRevisionId($new_control_revision->get('id'));
             $rev->setItemId($item->get('id'));
             $rev->setState('sc');
             $rev->save();
         }
     }
     $new_control_revision->setRevisionStateId(8);
     $new_control_revision->save();
     return $new_control_revision;
     //}
 }
開發者ID:retrofox,項目名稱:Huemul,代碼行數:44,代碼來源:Procedure.class.php

示例2: executeComplete

 /**
  * action Complete
  *
  * @author Damian Suarez
  */
 public function executeComplete(sfWebRequest $request)
 {
     $user = $this->getUser()->getGuardUser();
     if ($user->hasPermission('Responsable de cierre')) {
         $this->revision = Doctrine::getTable('Revision')->find($request->getParameter('id'));
         $this->procedure = $this->revision->getProcedure();
         // bloqueamos todas las revisiones
         foreach ($this->procedure->getRevisions() as $revision) {
             $revision->setBlock(true);
             $revision->save();
         }
         // Creamos la ultima revision
         $last_revision = new Revision();
         $last_revision->setRevisionStateId(4);
         $last_revision->setProcedureId($this->procedure->get('id'));
         $last_revision->setCreatorId($this->getUser()->getGuardUser()->get('id'));
         $last_revision->setBlock(true);
         $last_revision->setParentId($this->revision->get('id'));
         $last_revision->save();
         $this->redirect('procedures/index?id=' . $this->procedure->get('id'));
     }
 }
開發者ID:retrofox,項目名稱:Huemul,代碼行數:27,代碼來源:actions.class.php


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