当uisng表单类型为phpstorm时缺少服务警告

时间:2016-03-31 09:17:32

标签: forms symfony

当我使用类型i创建表单时,会收到缺少的服务警告。一切正常但警告很烦人,每当我提交git存储库的更改时它就会弹出。

UserType表单:

class UserType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('username', TextType::class) ->add('password', PasswordType::class); } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\Users')); } }

表单创建:

$form = $this->createForm(UserType::class, $user) ->add('newPass', PasswordType::class, array('mapped' => false)) ->add('confirmPass', PasswordType::class, array('mapped' => false)) ->add('submit', SubmitType::class, array('label' => 'Change password'))

发生恼人的警告

$newPass = $form->get('newPass')->getData();

如果通过表格填写,我不会收到任何警告 $form = $this->createFormBuilder($user)

编辑:

警告的图像

missing service warning

0 个答案:

没有答案