このサイトへの私の最初の質問は少し記述が難しいです。 私は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'));
}
おかげ
セバスチャン
投稿に挨拶を追加できません。保存されていないようです。申し訳ありませんが... –