コード例 #1
0
 /**
  * @Route("/insert", name="project_milestone_insert")
  */
 public function insertAction(Request $request)
 {
     $entity = new Milestone();
     $entity->setProject($this->getActiveProject());
     $action = new InsertAction($this->crudInfo, $entity, MilestoneForm::class, ['isNew' => true]);
     $action->slug($this->getSlug());
     return $action->run($this, $request);
 }
コード例 #2
0
ファイル: MilestoneRule.php プロジェクト: zyxist/cantiga
 /**
  * Fires the rule against the given entity, using the callback that produces the new status
  * for the milestone.
  * 
  * @param Connection $conn
  * @param Entity $entity
  * @param callback $callback
  */
 public function fireRule(Connection $conn, Entity $entity, $callback)
 {
     if ($this->milestone->isBeforeDeadline()) {
         $result = $callback();
         if (!$result instanceof NewMilestoneStatus) {
             throw new LogicException('Cannot fire the milestone rule \'' . $this->activator + '\': the callback did not return a NewMilestoneStatus instance!');
         }
         if ($result->isChanged()) {
             if ($this->milestone->getType() == Milestone::TYPE_BINARY) {
                 if ($result->isCompleted()) {
                     $this->milestone->complete($conn, $entity);
                 } else {
                     $this->milestone->cancel($conn, $entity);
                 }
             } else {
                 $this->milestone->updateProgress($conn, $entity, $result->getProgress());
             }
         }
     }
 }
コード例 #3
0
ファイル: ModelListener.php プロジェクト: zyxist/cantiga
 public function onAreaCreated(AreaEvent $event)
 {
     Milestone::populateEntities($this->conn, $event->getArea()->getEntity(), $event->getArea()->getProject());
 }
コード例 #4
0
 public function remove(Milestone $item)
 {
     $this->transaction->requestTransaction();
     try {
         return $item->remove($this->conn);
     } catch (Exception $ex) {
         $this->transaction->requestRollback();
         throw $ex;
     }
 }
コード例 #5
0
 public function findClosestDeadline(Entity $entity, Project $project)
 {
     return Milestone::fetchClosestDeadline($this->conn, $entity, $project);
 }