当前位置: 首页>>代码示例>>PHP>>正文


PHP Log::injectDataAndPersist方法代码示例

本文整理汇总了PHP中Log::injectDataAndPersist方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::injectDataAndPersist方法的具体用法?PHP Log::injectDataAndPersist怎么用?PHP Log::injectDataAndPersist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Log的用法示例。


在下文中一共展示了Log::injectDataAndPersist方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preSave

 public function preSave($event)
 {
     if (!$this->folder_id) {
         $this->folder_id = Folder::getInstance()->getNotDeletableForUser(sfContext::getInstance()->getUser()->getGuardUser(), Folder::TYPE_ROADMAP)->getId();
     }
     $log = new Log();
     $log->injectDataAndPersist($this, sfContext::getInstance()->getUser()->getGuardUser(), array('action' => $this->isNew() ? 'new' : 'edit'));
 }
开发者ID:sensorsix,项目名称:app,代码行数:8,代码来源:Roadmap.class.php

示例2: executeNewFolder

 public function executeNewFolder(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $folder = new Folder();
     $folder->setName('New ' . InterfaceLabelTable::getInstance()->get($this->getuser()->getGuardUser(), InterfaceLabelTable::FOLDER_TYPE));
     $folder->setUser($this->getUser()->getGuardUser());
     $folder->setType(Folder::TYPE_PROJECT);
     if (!Folder::getInstance()->getNotDeletableForUser($this->getUser()->getGuardUser(), Folder::TYPE_PROJECT, false)) {
         $folder->setDeletable(false);
     }
     $folder->save();
     // Create log
     $log = new Log();
     $log->injectDataAndPersist($folder, $this->getUser()->getGuardUser(), array('action' => 'new'));
     return $this->renderText(json_encode($folder->getRowData()));
 }
开发者ID:sensorsix,项目名称:app,代码行数:16,代码来源:actions.class.php

示例3: executeCreate

 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $criterion = new Criterion();
     $criterion->decision_id = $request->getParameter('decision_id');
     $form = new CriterionForm($criterion);
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form->save();
         // Create log
         $log = new Log();
         $log->injectDataAndPersist($criterion, $this->getUser()->getGuardUser(), array('action' => 'new'));
         return $this->renderText(json_encode($criterion->getRowData()));
     } else {
         return $this->renderPartial('form', array('form' => $form, 'type' => 'new'));
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:18,代码来源:actions.class.php

示例4: executeCreate

 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $role = new Role();
     $role->decision_id = $request->getParameter('decision_id');
     $form = new RoleForm($role);
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form->save();
         // Create log
         $log = new Log();
         $log->injectDataAndPersist($role, $this->getUser()->getGuardUser(), array('action' => 'new'));
         $matrix = json_decode($request->getParameter('matrix'), true);
         $role = $this->plannedMeasurementSaveNew($role, $matrix);
         $role->refresh(true);
         return $this->renderText(json_encode($role->getRowData()));
     } else {
         return $this->renderPartial('form', array('form' => $form, 'type' => 'new'));
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:21,代码来源:actions.class.php

示例5: executeUpdateRelease

 /**
  * @param sfWebRequest $request
  * @return sfView|string
  */
 public function executeUpdateRelease(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($object = Doctrine_Core::getTable($this->model)->find(array($request->getParameter('id'))), sprintf('Object decision does not exist (%s).', $request->getParameter('id')));
     $formClass = $this->model . 'Form';
     $this->form = new $formClass($object, array('user' => $this->getUser()));
     $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
     if ($this->form->isValid()) {
         $this->form->save();
         $this->form_valid = true;
         // Process tags
         $tags_request = json_decode($request->getParameter('tags'));
         $tags = array();
         foreach ($object->getTagRelease() as $tag) {
             $tags[] = $tag->Tag->name;
         }
         foreach (array_diff($tags_request, $tags) as $result) {
             Tag::newTag($this->getUser()->getGuardUser(), $request->getParameter('id'), $result, 'release');
         }
         foreach (array_diff($tags, $tags_request) as $result) {
             Tag::removeTag($this->getUser()->getGuardUser(), $request->getParameter('id'), $result, 'release');
         }
         $object->refresh(true);
         // Create log
         $log = new Log();
         $log->injectDataAndPersist($object, $this->getUser()->getGuardUser(), array('action' => 'edit'));
         return $this->renderText(json_encode(array('id' => $object->id, 'name' => $object->name)));
     }
     return $this->renderPartial('form', array('form' => $this->form));
 }
开发者ID:sensorsix,项目名称:app,代码行数:35,代码来源:actions.class.php

示例6: executeUpdateRelease

 /**
  * @param sfWebRequest $request
  * @return string
  */
 public function executeUpdateRelease(sfWebRequest $request)
 {
     $release = Doctrine::getTable('ProjectRelease')->find($request->getParameter('id'));
     $this->forward404Unless($release);
     $release->name = $request->getParameter('name');
     $release->save();
     // Create log
     $log = new Log();
     $log->injectDataAndPersist($release, $this->getUser()->getGuardUser(), array('action' => 'edit'));
     return sfView::NONE;
 }
开发者ID:sensorsix,项目名称:app,代码行数:15,代码来源:actions.class.php

示例7: executeUpdate

 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($roadmap = Doctrine_Core::getTable('Roadmap')->find(array($request->getParameter('id'))), sprintf('Object decision does not exist (%s).', $request->getParameter('id')));
     $form = new RoadmapForm($roadmap);
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form->save();
         // Create log
         $log = new Log();
         $log->injectDataAndPersist($roadmap, $this->getUser()->getGuardUser(), array('action' => 'edit'));
         // Process decisions
         $decisions_request = json_decode($request->getParameter('decisions_id'), true);
         $decisions = array();
         foreach ($form->getObject()->getRoadmapDecision() as $roadmap_decision) {
             $decisions[] = $roadmap_decision->getDecision()->getId();
         }
         foreach (array_diff($decisions_request, $decisions) as $result) {
             if (DecisionTable::getInstance()->getDecisionForUser($this->getUser()->getGuardUser(), $result)) {
                 $form->getObject()->addDecision($result);
             }
         }
         $form->getObject()->RoadmapDecision->save();
         foreach (array_diff($decisions, $decisions_request) as $result) {
             RoadmapDecisionTable::getInstance()->findByRoadmapIdAndDecisionId($form->getObject()->getId(), $result)->delete();
         }
         return $this->renderText(json_encode($form->getObject()->getRowData()));
     }
     return $this->executeEdit($request, $form);
 }
开发者ID:sensorsix,项目名称:app,代码行数:31,代码来源:actions.class.php

示例8: executeUpdate

 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($object = Doctrine_Core::getTable($this->model)->find(array($request->getParameter('id'))), sprintf('Object decision does not exist (%s).', $request->getParameter('id')));
     $formClass = $this->model . 'Form';
     $this->form = new $formClass($object, array('user' => $this->getUser()));
     $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
     if ($this->form->isValid()) {
         $this->form->save();
         $this->form_valid = true;
         // Create log
         $log = new Log();
         $log->injectDataAndPersist($object, $this->getUser()->getGuardUser(), array('action' => 'edit'));
         return sfView::NONE;
     }
     return $this->renderPartial('form', array('form' => $this->form));
 }
开发者ID:sensorsix,项目名称:app,代码行数:18,代码来源:BackendDefaultActions.class.php

示例9: executeUpdate

 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($alternative = Doctrine_Core::getTable($this->model)->find(array($request->getParameter('id'))), sprintf('Object decision does not exist (%s).', $request->getParameter('id')));
     $form = new AlternativeForm($alternative, array('user' => $this->getUser()));
     $alternative->setUpdatedBy(Alternative::generateUpdateAndCreatedBy($this->getUser()->getGuardUser()));
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $form->save();
         // Create log
         $log = new Log();
         $log->injectDataAndPersist($alternative, $this->getUser()->getGuardUser(), array('action' => 'edit'));
         // Process tags
         $tags_request = json_decode($request->getParameter('tags'));
         $tags = array();
         foreach ($alternative->getTagAlternative() as $tag) {
             $tags[] = $tag->Tag->name;
         }
         foreach (array_diff($tags_request, $tags) as $result) {
             Tag::newTag($this->getUser()->getGuardUser(), $request->getParameter('id'), $result, 'alternative');
         }
         foreach (array_diff($tags, $tags_request) as $result) {
             Tag::removeTag($this->getUser()->getGuardUser(), $request->getParameter('id'), $result, 'alternative');
         }
         // Process links
         $links = array();
         foreach ($alternative->getAlternativeLink() as $link) {
             $links[$link->id] = $link->link;
         }
         $links_request_new = array();
         $links_request_old = array();
         $links_request = json_decode($request->getParameter('links'), true);
         foreach ($links_request as $link_request) {
             if (is_array($link_request) && array_key_exists('id', $link_request)) {
                 $links_request_old[$link_request['id']] = $link_request['link'];
             } else {
                 $links_request_new[] = $link_request;
             }
         }
         foreach ($links_request_new as $link_request_new) {
             $link = new AlternativeLink();
             $link->link = $link_request_new['link'];
             $link->alternative_id = $request->getParameter('id');
             $link->save();
         }
         foreach (array_diff(array_keys($links), array_keys($links_request_old)) as $result) {
             AlternativeLinkTable::getInstance()->find($result)->delete();
         }
         foreach ($links_request_old as $key => $link) {
             if ($links_request_old[$key] !== $links[$key]) {
                 $alternative_link = AlternativeLinkTable::getInstance()->find($key);
                 $alternative_link->link = $links_request_old[$key];
                 $alternative_link->save();
             }
         }
         // Process related alternatives
         $related_alternatives_request = json_decode($request->getParameter('related_alternatives'), true);
         if (!$related_alternatives_request) {
             $related_alternatives_request = array();
         }
         $related_alternatives = array();
         foreach ($alternative->getAlternativeRelation() as $related_alternative) {
             $related_alternatives[] = $related_alternative->to_id;
         }
         foreach (array_diff($related_alternatives_request, $related_alternatives) as $result) {
             if (AlternativeTable::getInstance()->getOneForUser($this->getUser()->getGuardUser(), $result)) {
                 $alternative_relation = new AlternativeRelation();
                 $alternative_relation->setFromId($alternative->getId());
                 $alternative_relation->setToId($result);
                 $alternative_relation->setCreatedBy(Alternative::generateUpdateAndCreatedBy($this->getUser()->getGuardUser()));
                 $alternative_relation->save();
             }
         }
         foreach (array_diff($related_alternatives, $related_alternatives_request) as $result) {
             AlternativeRelationTable::getInstance()->findByFromIdAndToId($alternative->getId(), $result)->delete();
         }
         $alternative->refresh(true);
         return $this->renderText(json_encode($alternative->getRowData()));
     } else {
         return $this->renderPartial('form', array('form' => $form));
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:83,代码来源:actions.class.php

示例10: executeAlternativeModalSave

 /**
  * @param sfWebRequest $request
  * @return string
  */
 public function executeAlternativeModalSave(sfWebRequest $request)
 {
     $this->forward404Unless($request->isXmlHttpRequest());
     $decision_id = $this->getUser()->getAttribute('decision_id', null, 'sfGuardSecurityUser');
     if (!empty($decision_id)) {
         $this->decision = DecisionTable::getInstance()->getDecisionForUser($this->getUser()->getGuardUser(), $decision_id);
         $this->forward404Unless(is_object($this->decision));
     } else {
         $this->forward404();
     }
     $alternative = new Alternative();
     $alternative->setName($request->getParameter('name'));
     $alternative->setDecision($this->decision);
     $alternative->setCreatedBy(Alternative::generateUpdateAndCreatedBy($this->getUser()->getGuardUser()));
     $alternative->setUpdatedBy(Alternative::generateUpdateAndCreatedBy($this->getUser()->getGuardUser()));
     $alternative->save();
     $dashboard_role = $this->decision->getDashboardRole();
     if ($dashboard_role) {
         foreach ($this->decision->getCriterion() as $criterion) {
             $planned_alternative_measurement = new PlannedAlternativeMeasurement();
             $planned_alternative_measurement->setAlternative($alternative);
             $planned_alternative_measurement->setCriterion($criterion);
             $dashboard_role->PlannedAlternativeMeasurement->add($planned_alternative_measurement);
         }
         $dashboard_role->PlannedAlternativeMeasurement->save();
     }
     $additional_roles = Doctrine_Query::create()->from('Role r')->leftJoin('r.Decision d')->where('d.id = ?', $this->decision->getId())->andWhere('d.user_id = ?', $this->getUser()->getGuardUser()->id)->execute();
     $criterion_estimates = Doctrine_Query::create()->from('Criterion c')->leftJoin('c.Decision d')->where('d.id = ?', $this->decision->getId())->andWhere('d.user_id = ?', $this->getUser()->getGuardUser()->id)->andWhere('c.name = ?', 'Hour Estimate')->fetchOne();
     $criterion_value = Doctrine_Query::create()->from('Criterion c')->leftJoin('c.Decision d')->where('d.id = ?', $this->decision->getId())->andWhere('d.user_id = ?', $this->getUser()->getGuardUser()->id)->andWhere('c.name = ?', 'Value')->fetchOne();
     $criterion_usability = Doctrine_Query::create()->from('Criterion c')->leftJoin('c.Decision d')->where('d.id = ?', $this->decision->getId())->andWhere('d.user_id = ?', $this->getUser()->getGuardUser()->id)->andWhere('c.name = ?', 'Usability')->fetchOne();
     $criterion_feasibility = Doctrine_Query::create()->from('Criterion c')->leftJoin('c.Decision d')->where('d.id = ?', $this->decision->getId())->andWhere('d.user_id = ?', $this->getUser()->getGuardUser()->id)->andWhere('c.name = ?', 'Feasibility')->fetchOne();
     foreach ($additional_roles as $additional_role) {
         if ($additional_role->getName() == 'Collect Estimates' && $criterion_estimates) {
             $planned_alternative_measurement = new PlannedAlternativeMeasurement();
             $planned_alternative_measurement->setAlternative($alternative);
             $planned_alternative_measurement->setCriterion($criterion_estimates);
             $planned_alternative_measurement->setRole($additional_role);
             $planned_alternative_measurement->save();
         } elseif ($additional_role->getName() == 'Collect input on Value' && $criterion_value) {
             $planned_alternative_measurement = new PlannedAlternativeMeasurement();
             $planned_alternative_measurement->setAlternative($alternative);
             $planned_alternative_measurement->setCriterion($criterion_value);
             $planned_alternative_measurement->setRole($additional_role);
             $planned_alternative_measurement->save();
         } elseif ($additional_role->getName() == 'Collect input on Usability' && $criterion_usability) {
             $planned_alternative_measurement = new PlannedAlternativeMeasurement();
             $planned_alternative_measurement->setAlternative($alternative);
             $planned_alternative_measurement->setCriterion($criterion_usability);
             $planned_alternative_measurement->setRole($additional_role);
             $planned_alternative_measurement->save();
         } elseif ($additional_role->getName() == 'Collect input on Feasibility' && $criterion_feasibility) {
             $planned_alternative_measurement = new PlannedAlternativeMeasurement();
             $planned_alternative_measurement->setAlternative($alternative);
             $planned_alternative_measurement->setCriterion($criterion_feasibility);
             $planned_alternative_measurement->setRole($additional_role);
             $planned_alternative_measurement->save();
         }
     }
     // Create log
     $log = new Log();
     $log->injectDataAndPersist($alternative, $this->getUser()->getGuardUser(), array('action' => 'new'));
     return sfView::NONE;
 }
开发者ID:sensorsix,项目名称:app,代码行数:67,代码来源:actions.class.php


注:本文中的Log::injectDataAndPersist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。