2017-08-03 11 views
0

このサイトへの私の最初の質問は少し記述が難しいです。 私はSymfonyを新しくしました。3.2で起動し、最近3.3.5に更新されました。 CraueFormFlowBundle(多段フォームバンドル)を使用しようとしましたが、動作させることができません。Symfony 3.3 CraueFormFlowBundle Request_stackが空です

Error: Call to a member function getCurrentRequest() on null 

Symfony\Component\Debug\Exception\ FatalErrorException 
in vendor/craue/formflow-bundle/Form/FormFlow.php (line 191) 

ライン191ショー: 問題は例外で、フロー結果にアクセスしようとしているということです)($ currentRequest =の$ this - > requestStack-> getCurrentRequest。

ダンプ行でFormFlow.phpを変更すると、$ this-> requestStackがnullであることがわかります。 問題を探す場所を知るために、このバンドルに関する知識が不十分です。フォーム定義も非常に簡単であり、問​​題なく動作

namespace EngineeringBundle\Form; 

use Craue\FormFlowBundle\Form\FormFlow; 
use Craue\FormFlowBundle\Form\FormFlowInterface; 

class SelectExaminationFlow extends FormFlow 
{ 

    /** 
    * {@inheritDoc} 
    */ 
    protected function loadStepsConfig() 
    { 
     dump("loadStepsConfig"); 
     return array(
      array(
       'label' => 'engineering.discipline', 
       'form_type' => new SelectExaminationStep1Form(), 
      ), 
      array(
       'label' => 'engineering.date', 
       'form_type' => new SelectExaminationStep2Form(), 
         'skip' => function($estimatedCurrentStepNumber, FormFlowInterface $flow) { 
          return $estimatedCurrentStepNumber > 1 && !$flow->getFormData()->canHaveRegion(); 
         }, 
      ), 
      array(
       'label' => 'confirmation', 
      ), 
     ); 
    } 

class SelectExaminationStep1Form extends AbstractType 
{ 
    public function buildForm(FormBuilderInterface $builder, array $options) 
    { 
    dump("buildForm"); 
     $builder 
     ->add('id', HiddenType::class) 
     ->add('discipline', EntityType::class, array(
       'class' => 'EngineeringBundle:Discipline', 
       'choice_label' => 'disciplineName', 
       'label' => 'engineering.discipline.label' 
      ) 
      ); 
    } 

    public function getName() { 
     return $this->getBlockPrefix(); 
    } 

    public function getBlockPrefix() { 
     return 'createEngineeringStep1'; 
    } 

} 

services.yml:

EngineeringBundle\Form\SelectExaminationFlow: 
    parent: craue.form.flow 
    autowire: false 
    autoconfigure: false 
    public: true 

engineering.form_flow: 
    alias: EngineeringBundle\Form\SelectExaminationFlow 
    public: true 

フロー定義は、場所例に基づいています

コントローラ:

私は同じ問題を抱えていた事前にの
/** 
* @Route("create", name="engineering_create") 
*/ 
public function createAction() 
{ 
    return $this->processFlow(new ExaminationDate(), $this->get('engineering.form_flow')); 

} 

おかげ

セバスチャン

+0

投稿に挨拶を追加できません。保存されていないようです。申し訳ありませんが... –

答えて

0

は、以下の内容でvendor/craue/formflow-bundle/Form/FormFlow.phpにコンストラクタを追加することによってそれを解決:

public function __construct(RequestStack $requestStack, FormFactoryInterface $formFactory, DataManagerInterface $dataManager, EventDispatcherInterface $eventDispatcher) { 
    $this->formFactory = $formFactory; 
    $this->requestStack = $requestStack; 
    $this->dataManager = $dataManager; 
    $this->eventDispatcher = $eventDispatcher; 
} 

は後に、それを配置することを確認しますすべてのセッターメソッド。問題は、symfonyのアップデートに関連しているようです。

+0

こんにちはStuffy、私は自分の要件を変更したため、問題は廃止されましたが、それでもなお感謝しています。私は同じ問題を抱えている他のすべての人に答えを受け入れます。 –

関連する問題