예제 #1
0
 /**
  * create the exercise.
  *
  * @param array    $step     - properties of the step
  * @param Exercise $exercise
  *
  * @return Step
  */
 private function createStep(array $step, Exercise $exercise)
 {
     $newStep = new Step();
     $newStep->setText($step['text']);
     $newStep->setOrder($step['order']);
     $newStep->setShuffle($step['shuffle']);
     $newStep->setNbQuestion($step['nbQuestion']);
     $newStep->setKeepSameQuestion($step['keepSameQuestion']);
     $newStep->setDuration($step['duration']);
     $newStep->setMaxAttempts($step['maxAttempts']);
     $newStep->setExercise($exercise);
     $this->om->persist($newStep);
     $this->om->flush();
     return $newStep;
 }
예제 #2
0
 /**
  * @param Exercise $exercise
  * @param int      $orderStep
  *
  * @return Step
  */
 public function createStep(Exercise $exercise, $orderStep)
 {
     $em = $this->doctrine->getManager();
     //Creating a step by question
     $step = new Step();
     $step->setText(' ');
     $step->setExercise($exercise);
     $step->setNbQuestion(0);
     $step->setDuration(0);
     $step->setMaxAttempts(0);
     $step->setOrder($orderStep);
     $em->persist($step);
     return $step;
 }