2016-07-21 8 views
-2

現在、symfony 2.7プロジェクトを3. *に更新しています。2.8バージョンで廃止予定をクリアしています。Symfonyカスタムタイプ廃止通知

だから私はChoiceNVTypeたちはこれまでのように使用私たちのカスタム型で廃止通知に

Passing type instances to FormBuilder::add(), Form::add() or the FormFactory is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead (******\AutoBundle\Form\Type\ChoiceNVType) 

を得続けるました:

$form->add('model', new ChoiceNVType(), array(
       'choices' => array(), 
       'required' => false, 
       'placeholder' => 'Something', 
       )); 

は、今、私たちはすべて廃止通知を修正したいが、私は持っていますどのようにカスタムタイプでそれを行うか分かりません。何か案は?

答えて

1

メッセージが明確にあなたの代わりに、インスタンスのFQNを使用する必要が言う:

$form->add('model', '******\AutoBundle\Form\Type\ChoiceNVType', array(
       'choices' => array(), 
       'required' => false, 
       'placeholder' => 'Something', 
       )); 
+0

ええ、それはそれだった、最悪の事態は私が先に試してみたが、それが実際に動作しませんでした。ありがとう! :) – Pitchwaiz

+1

あなたは 'ChoiceNVType :: class' =>と書くこともできます。 – mblaettermann

関連する問題