Example #1
0
 /**
  * Computes the current status of the project.
  * 
  * @param ProjectEntity $project
  * 
  * @return boolean
  */
 private function computeIsAnalyzed(ProjectEntity $project)
 {
     return $project->getAnalyzing();
 }
 /**
  * Starts an analysis on the given project.
  * 
  * @param Project $project
  * 
  * @throws \RuntimeException
  */
 protected function startAnalysis(Project $project)
 {
     // A single analysis may run on a project at a time.
     if ($project->getAnalyzing()) {
         throw new \RuntimeException(sprintf('Attempted to start an analysis on project with id:%d while another was running. There might be an ' . 'error in the logic of the application.', $project->getId()));
     }
     // Flag the project as being analyzed to prevent race conditions or other problems.
     $project->setAnalyzing(true);
     $this->doctrine->getManager()->flush();
     // Run the analysis command.
     $this->runAnalysisCommand($project->getId());
 }