質問するログイン新規登録

質問編集履歴

1

タイトル修正

2016/09/30 01:00

投稿

marimo.
marimo.

スコア48

title CHANGED
@@ -1,1 +1,1 @@
1
- 【Symfony3系】Question Helperの使
1
+ 【Symfony3系】FormでDialogを出現させた
body CHANGED
@@ -1,35 +1,7 @@
1
1
  Symfony3系についての質問です。
2
- Symfony3系にはQuestion Helperが用意されています。→[Question Helper](http://symfony.com/doc/current/components/console/helpers/questionhelper.html)
3
- ただ使い方がよくわからずに困っております。
4
- 特に```InputInterface $input, OutputInterface $output```使です。
2
+ 自分はFormのaddEventListenerで定のForm対してある条件を満たさなかった場合にダイアログを出現させたいと思っているですが、わからず躓ている状況です。
5
- どのタイミングで、どのような値を用意しなければならないのか…
6
3
 
7
- ```PHP
8
- // ...
9
- use Symfony\Component\Console\Input\InputInterface;
10
- use Symfony\Component\Console\Output\OutputInterface;
11
- use Symfony\Component\Console\Question\ConfirmationQuestion;
4
+ Dialog Helperは3系ではすでに廃止されています。→[Dialog Helper](http://symfony.com/doc/current/components/console/helpers/dialoghelper.html)
12
5
 
13
- class YourCommand extends Command
14
- {
15
- // ...
16
-
17
- public function execute(InputInterface $input, OutputInterface $output)
18
- {
19
- $helper = $this->getHelper('question');
20
- $question = new ConfirmationQuestion('Continue with this action?', false);
21
-
22
- if (!$helper->ask($input, $output, $question)) {
23
- return;
24
- }
25
- }
26
- }
27
- ```
28
-
29
- そのため上記のようなexecute関数の呼び出し方もわからない感じです。
30
-
31
- 自分はFormのaddEventListenerで特定のFormに対してある条件を満たさなかった場合にダイアログを出現させたいと思っているのですが、使い方がわからず躓いている状況です。
32
-
33
- $input、$outputにはどういったものが入るのでしょうか?
34
- それさえわかれば関数を呼び出すこともできるのです
6
+ 良い方法ありましたらよろしくお願いいたします。
35
7
  よろしくお願いいたします。