/** * @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); }
/** * 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()); } } } }
public function onAreaCreated(AreaEvent $event) { Milestone::populateEntities($this->conn, $event->getArea()->getEntity(), $event->getArea()->getProject()); }
public function remove(Milestone $item) { $this->transaction->requestTransaction(); try { return $item->remove($this->conn); } catch (Exception $ex) { $this->transaction->requestRollback(); throw $ex; } }
public function findClosestDeadline(Entity $entity, Project $project) { return Milestone::fetchClosestDeadline($this->conn, $entity, $project); }