예제 #1
0
 /**
  * Update the Step metadata.
  *
  * @param Step      $step
  * @param \stdClass $metadata
  *
  * @throws ValidationException
  */
 public function updateMetadata(Step $step, \stdClass $metadata)
 {
     $errors = $this->validator->validateStepMetadata($metadata);
     if (count($errors) > 0) {
         throw new ValidationException('Step metadata are not valid', $errors);
     }
     // Update Step
     $step->setTitle($metadata->title);
     $step->setText($metadata->description);
     $step->setMaxAttempts(!empty($metadata->maxAttempts) ? (int) $metadata->maxAttempts : 0);
     // Save to DB
     $this->om->persist($step);
     $this->om->flush();
 }