getUnits() public method

public getUnits ( ) : RunUnitList
return RunUnitList
 /**
  * @Given /^following run for "([^"]+)":$/
  */
 public function followingRunFor($name, TableNode $table)
 {
     $app = $this->getApplication();
     $project = $app['project_list']->get($name);
     $methods = array('created_at' => function (RunUnit $unit, $val) {
         $int = new \DateInterval($val);
         $now = new \DateTime();
         $unit->setCreatedAt($now->sub($int));
     }, 'started_at' => function (RunUnit $unit, $val) {
         $int = new \DateInterval($val);
         $now = new \DateTime();
         $unit->setStartedAt($now->sub($int));
     }, 'finished_at' => function (RunUnit $unit, $val) {
         $int = new \DateInterval($val);
         $now = new \DateTime();
         if (!$unit->getStartedAt()) {
             $unit->setStartedAt($now->sub($int));
         }
         $unit->setFinishedAt($now->sub($int));
     }, 'feature' => function (RunUnit $unit, $val) {
         $unit->setFeature($val);
     }, 'return_code' => function (RunUnit $unit, $val) {
         $unit->setReturnCode($val);
     });
     $headers = $table->getRow(0);
     foreach ($headers as $col) {
         if (!isset($methods[$col])) {
             throw new \RuntimeException(sprintf('No handler for column "%s".', $col));
         }
     }
     $run = new Run();
     $run->setProjectName($name);
     $units = $run->getUnits();
     foreach ($table->getRows() as $i => $row) {
         if ($i == 0) {
             continue;
         }
         $unit = new RunUnit();
         foreach ($headers as $i => $header) {
             $value = $row[$i];
             if ($value === '@null') {
                 continue;
             }
             $methods[$header]($unit, $row[$i]);
         }
         $units->add($unit);
     }
     $app['run_storage']->saveRun($run);
 }
 /**
  * {@inheritdoc}
  */
 public function saveRun(Run $run)
 {
     // Just UPDATE title
     if ($run->getId()) {
         $stmt = $this->connection->prepare('UPDATE bl_run SET title = :title WHERE id = :id');
         $stmt->bindValue('title', $run->getTitle());
         $stmt->bindValue('id', $run->getId());
         $stmt->execute();
         return $this;
     }
     // Insert the run
     $stmt = $this->connection->prepare('INSERT INTO bl_run (title, project_name, properties, created_at) VALUES (:title, :project_name, :properties, :created_at)');
     $stmt->bindValue('title', $run->getTitle());
     $stmt->bindValue('project_name', $run->getProjectName());
     $stmt->bindValue('properties', json_encode($run->getProperties()));
     $stmt->bindValue('created_at', $run->getCreatedAt(), "datetime");
     $stmt->execute();
     $run->setId($this->connection->lastInsertId());
     // Insert units
     foreach ($run->getUnits() as $unit) {
         $stmt = $this->connection->prepare('
             INSERT INTO bl_run_unit
                 (run_id, feature, created_at, started_at, finished_at, return_code, output_files)
             VALUES
                 (:run_id, :feature, :created_at, :started_at, :finished_at, :return_code, :output_files)
         ');
         $stmt->bindValue('run_id', $run->getId());
         $stmt->bindValue('feature', $unit->getFeature());
         $stmt->bindValue('created_at', $unit->getCreatedAt(), "datetime");
         $stmt->bindValue('started_at', $unit->getStartedAt(), "datetime");
         $stmt->bindValue('finished_at', $unit->getFinishedAt(), "datetime");
         $stmt->bindValue('return_code', $unit->getReturnCode());
         $stmt->bindValue('output_files', json_encode($unit->getOutputFiles()->toArrayOfID()));
         $stmt->execute();
         $unit->setId($this->connection->lastInsertId());
     }
     return $this;
 }