getId() !== null) { $project = $entry->getProject(); } $builder // string - length 255 ->add('name', TextType::class, [ 'label' => 'label.name', ]) // text ->add('comment', TextareaType::class, [ 'label' => 'label.comment', 'required' => false, ]) // entity type: project ->add('project', ProjectType::class, [ 'label' => 'label.project', 'query_builder' => function (ProjectRepository $repo) use ($project) { return $repo->builderForEntityType($project); }, ]) // boolean ->add('visible', YesNoType::class, [ 'label' => 'label.visible', ]) ; if ($entry->getId() === null) { $builder->add('create_more', CheckboxType::class, [ 'label' => 'label.create_more', 'required' => false, 'mapped' => false, ]); } } /** * {@inheritdoc} */ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'data_class' => Activity::class, 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_token_id' => 'admin_activity_edit', ]); } }