/** * Prepare a validation group and inject in the provided form * * Takes an array of elements names * * @param string|array|Traversable $spec * @param FormInterface $form * @param string $method * @return void * @throws Exception\DomainException if validation group given is not an array */ protected function prepareAndInjectValidationGroup($spec, FormInterface $form, $method) { if (!is_array($spec)) { if (!class_exists($spec)) { throw new Exception\DomainException(sprintf('%s expects an array for validation group; received "%s"', $method, $spec)); } } $form->setValidationGroup($spec); }