質問編集履歴

1

タイトル修正

2016/09/30 01:00

投稿

marimo.
marimo.

スコア48

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