1111
1212namespace DTL \Bundle \PhpcrMigrations \Command ;
1313
14- use PHPCR \Migrations \VersionFinder ;
15- use PHPCR \Migrations \VersionStorage ;
16- use Symfony \Component \Console \Command \Command ;
17- use Symfony \Component \Console \Helper \Table ;
14+ use Symfony \Bundle \FrameworkBundle \Command \ContainerAwareCommand ;
15+ use Symfony \Component \Console \Helper \TableHelper ;
1816use Symfony \Component \Console \Input \InputInterface ;
1917use Symfony \Component \Console \Output \OutputInterface ;
2018
21- class StatusCommand extends Command
19+ class StatusCommand extends ContainerAwareCommand
2220{
2321 private $ versionStorage ;
2422 private $ finder ;
2523
26- public function __construct (
27- VersionStorage $ versionStorage ,
28- VersionFinder $ finder
29- ) {
30- parent ::__construct ();
31- $ this ->versionStorage = $ versionStorage ;
32- $ this ->finder = $ finder ;
33- }
3424
3525 public function configure ()
3626 {
@@ -50,11 +40,14 @@ public function configure()
5040
5141 public function execute (InputInterface $ input , OutputInterface $ output )
5242 {
43+ $ this ->versionStorage = $ this ->getContainer ()->get ('phpcr_migrations.version_storage ' );
44+ $ this ->finder = $ this ->getContainer ()->get ('phpcr_migrations.version_finder ' );
45+
5346 $ versionCollection = $ this ->finder ->getCollection ();
5447 $ executedVersions = (array ) $ this ->versionStorage ->getPersistedVersions ();
5548 $ currentVersion = $ this ->versionStorage ->getCurrentVersion ();
5649
57- $ table = new Table ( $ output );
50+ $ table = new TableHelper ( );
5851 $ table ->setHeaders (array (
5952 '' , 'Version ' , 'Date ' , 'Migrated ' , 'Path ' ,
6053 ));
@@ -70,7 +63,7 @@ public function execute(InputInterface $input, OutputInterface $output)
7063 ));
7164 }
7265
73- $ table ->render ();
66+ $ table ->render ($ output );
7467
7568 if ($ currentVersion ) {
7669 $ output ->writeln (sprintf ('<info>Current:</info> %s (%s) ' , $ currentVersion , $ this ->getDate ($ currentVersion )));
0 commit comments