44
55use Symfony \Component \DependencyInjection \Reference ;
66use Symfony \Component \DependencyInjection \ContainerBuilder ;
7+ use PHPCR \Shell \PhpcrShell ;
78
89class Container extends ContainerBuilder
910{
10- const MODE_EMBEDDED_SHELL = 'shell ' ;
11- const MODE_EMBEDDED_COMMAND = 'command ' ;
12- const MODE_STANDALONE = 'standalon ' ;
13-
1411 protected $ mode ;
1512
1613 /**
@@ -22,7 +19,7 @@ class Container extends ContainerBuilder
2219 'transport.transport.fs ' => 'PHPCR\Shell\Transport\Transport\JackalopeFs ' ,
2320 );
2421
25- public function __construct ($ mode = self ::MODE_STANDALONE )
22+ public function __construct ($ mode = PhpcrShell ::MODE_STANDALONE )
2623 {
2724 parent ::__construct ();
2825 $ this ->mode = $ mode ;
@@ -97,7 +94,7 @@ public function registerPhpcr()
9794
9895 public function registerEvent ()
9996 {
100- if ($ this ->mode === self ::MODE_STANDALONE ) {
97+ if ($ this ->mode === PhpcrShell ::MODE_STANDALONE ) {
10198 $ this ->register (
10299 'event.subscriber.profile_loader ' ,
103100 'PHPCR\Shell\Subscriber\ProfileLoaderSubscriber '
@@ -148,10 +145,16 @@ public function registerEvent()
148145
149146 public function registerConsole ()
150147 {
151- $ this ->register ('console.application.shell ' , 'PHPCR\Shell\Console\Application\ShellApplication ' )
152- ->addArgument (new Reference ('container ' ));
148+ if ($ this ->mode === PhpcrShell::MODE_STANDALONE ) {
149+ $ this ->register ('application ' , 'PHPCR\Shell\Console\Application\ShellApplication ' )
150+ ->addArgument (new Reference ('container ' ));
151+ } else {
152+ $ this ->register ('application ' , 'PHPCR\Shell\Console\Application\EmbeddedApplication ' )
153+ ->addArgument (new Reference ('container ' ));
154+ }
155+
153156 $ this ->register ('console.input.autocomplete ' , 'PHPCR\Shell\Console\Input\AutoComplete ' )
154- ->addArgument (new Reference ('console. application.shell ' ))
157+ ->addArgument (new Reference ('application ' ))
155158 ->addArgument (new Reference ('phpcr.session ' ));
156159 }
157160
0 commit comments