コード例 #1
0
 public function updateParameters(Step $step, \stdClass $stepStructure)
 {
     $parameters = $step->getParameters();
     if (empty($parameters)) {
         $parameters = new ActivityParameters();
     }
     // Update parameters properties
     $duration = !empty($stepStructure->duration) ? $stepStructure->duration : null;
     $parameters->setMaxDuration($duration);
     $withTutor = !empty($stepStructure->withTutor) ? $stepStructure->withTutor : false;
     $parameters->setWithTutor($withTutor);
     $who = !empty($stepStructure->who) ? $stepStructure->who : null;
     $parameters->setWho($who);
     $where = !empty($stepStructure->where) ? $stepStructure->where : null;
     $parameters->setWhere($where);
     $evaluationType = !empty($stepStructure->evaluationType) ? $stepStructure->evaluationType : null;
     $parameters->setEvaluationType($evaluationType);
     // Set resources
     $this->updateSecondaryResources($parameters, $stepStructure);
     // Persist parameters to generate ID
     $this->om->persist($parameters);
     // Store parameters in Step
     $step->setParameters($parameters);
     return $this;
 }