Form Flashcards
What options does BaseType provide?
block_name block_prefix disabled label label_format row_attr label_translation_parameters attr_translation_parameters attr translation_domain auto_initialize
What are the available variables in label_format property?
%id%
%name%
What are available field options for ChoiceType?
choices choice_attr choice_filter choice_label choice_loader choice_name choice_translation_domain choice_value expanded group_by multiple placeholder preferred_choices
By what type is the uploaded file represented?
Symfony\Component\HttpFoundation\File\UploadedFile
What methods does Symfony\Component\Form\FormBuilderInterface define?
add($child, string $type = null, array $options = []);
create(string $name, string $type = null, array $options = []);
get(string $name);
remove(string $name);
has(string $name);
all();
getForm();
What methods does Symfony\Component\Form\FormFactoryInterface define?
create(string $type = ‘Symfony\Component\Form\Extension\Core\Type\FormType’, $data = null, array $options = []);
createNamed(string $name, string $type = ‘Symfony\Component\Form\Extension\Core\Type\FormType’, $data = null, array $options = []);
createForProperty(string $class, string $property, $data = null, array $options = []);
createBuilder(string $type = ‘Symfony\Component\Form\Extension\Core\Type\FormType’, $data = null, array $options = []);
createNamedBuilder(string $name, string $type = ‘Symfony\Component\Form\Extension\Core\Type\FormType’, $data = null, array $options = []);
createBuilderForProperty(string $class, string $property, $data = null, array $options = []);
What methods does Symfony\Component\Form\FormTypeInterface define?
buildForm(FormBuilderInterface $builder, array $options);
buildView(FormView $view, FormInterface $form, array $options);
finishView(FormView $view, FormInterface $form, array $options);
configureOptions(OptionsResolver $resolver);
getBlockPrefix();
getParent();
What is note worthy about the following case: a form type has the inherit_data option set to true?
Data transformers are not applied to such fields.
Data mappers are not used as well.
What methods does Symfony\Component\Form\DataTransformerInterface define?
transform($value);
reverseTransform($value);
What are the three forms of form data?
Model data
Normalized data
View data
What methods does Symfony\Component\Form\FormTypeExtensionInterface define?
buildForm(FormBuilderInterface $builder, array $options);
buildView(FormView $view, FormInterface $form, array $options);
finishView(FormView $view, FormInterface $form, array $options);
configureOptions(OptionsResolver $resolver);
public static function getExtendedTypes(): iterable;
What methods does Symfony\Component\Form\DataMapperInterface define?
mapDataToForms($viewData, iterable $forms);
mapFormsToData(iterable $forms, &$viewData);
What is special about setting second parameter of Symfony\Component\Form\FormInterface to false?
Missing fields are not validated via forms validation routine.
What happens if you set validation_groups form type option to false?
Validations are disabled.
How is the validator component connected to the form component?
Via FormTypeValidatorExtension, RepeatedTypeValidatorExtension, SubmitTypeValidatorExtension, UploadValidatorExtension.