/**
  * @param FormField $formField
  * @param KForm     $form
  */
 public function instanceMapFrom(FormField $formField, KForm $form)
 {
     $attribute = $formField->getFieldName();
     $method = 'mappingFromFormField' . ucfirst($attribute);
     if ($this->instanceReflector->hasMethod($method)) {
         $methodReflector = $this->instanceReflector->getMethod($method);
         $parameters = array();
         foreach ($methodReflector->getParameters() as $paramReflector) {
             switch (true) {
                 case $paramReflector->getClass()->isSubclassOf(KForm::class):
                     $parameters[] = $form;
                     break;
                 case $paramReflector->getClass()->isSubclassOf(FormField::class):
                     $parameters[] = $formField;
                     break;
                 default:
                     $parameters[] = $formField;
                     break;
             }
         }
         call_user_func_array(array($this->instance, $method), $parameters);
     } else {
         $this->instance->{$attribute} = $formField->getValue();
     }
 }
 /**
  * @param FormField $field
  * @return bool
  */
 public function willExceedCurrentRow(FormField $field)
 {
     if ($this->current_row_used + $field->getWidth() > 1.0) {
         return false;
     } else {
         return true;
     }
 }
 public function validate(FormField $formField, Request $request = null)
 {
     $value = $formField->getValue();
     if (false == $this->doValidate($value, $request)) {
         $formField->addError($this->errorMessage);
         return false;
     } else {
         return true;
     }
 }
 /**
  * @param KForm $form
  * @return void
  */
 public function instanceMapTo(FormField $formField, KForm $form)
 {
     $formField->setDefault(null);
 }