本文整理汇总了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;
//}
}
示例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'));
}
}