Skip to content

Commit

Permalink
Updating commands to Symfony2 RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwards committed Jun 23, 2011
1 parent 87e6e3e commit b8c2d62
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Command/EnsureIndexesCommand.php
Expand Up @@ -11,7 +11,7 @@

namespace Mandango\MandangoBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -21,7 +21,7 @@
*
* @author Pablo Díez <pablodip@gmail.com>
*/
class EnsureIndexesCommand extends Command
class EnsureIndexesCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
Expand All @@ -41,6 +41,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('ensuring the indexes');

$this->container->get('mandango')->ensureAllIndexes();
$this->getContainer()->get('mandango')->ensureAllIndexes();
}
}
14 changes: 7 additions & 7 deletions Command/GenerateCommand.php
Expand Up @@ -11,7 +11,7 @@

namespace Mandango\MandangoBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\Finder;
Expand All @@ -22,7 +22,7 @@
*
* @author Pablo Díez <pablodip@gmail.com>
*/
class GenerateCommand extends Command
class GenerateCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
Expand All @@ -42,13 +42,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('processing config classes');

$modelDir = $this->container->getParameter('mandango.model_dir');
$modelDir = $this->getContainer()->getParameter('mandango.model_dir');

$configClasses = array();
// application + extra
foreach (array_merge(
array($this->container->getParameter('kernel.root_dir').'/config/mandango'),
$this->container->getParameter('mandango.extra_config_classes_dirs')
array($this->getContainer()->getParameter('kernel.root_dir').'/config/mandango'),
$this->getContainer()->getParameter('mandango.extra_config_classes_dirs')
) as $dir) {
if (is_dir($dir)) {
$finder = new Finder();
Expand All @@ -72,7 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
// bundles
$configClassesPending = array();
foreach ($this->container->get('kernel')->getBundles() as $bundle) {
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
$bundleModelNamespace = 'Model\\'.$bundle->getName();

if (is_dir($dir = $bundle->getPath().'/Resources/config/mandango')) {
Expand Down Expand Up @@ -111,7 +111,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$output->writeln('generating classes');

$mondator = $this->container->get('mandango.mondator');
$mondator = $this->getContainer()->get('mandango.mondator');
$mondator->setConfigClasses($configClasses);
$mondator->process();
}
Expand Down
10 changes: 5 additions & 5 deletions Command/LoadFixturesCommand.php
Expand Up @@ -13,7 +13,7 @@

use Mandango\DataLoader;
use Mandango\MandangoBundle\Util;
use Symfony\Bundle\FrameworkBundle\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
Expand All @@ -25,7 +25,7 @@
*
* @author Pablo Díez <pablodip@gmail.com>
*/
class LoadFixturesCommand extends Command
class LoadFixturesCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
Expand Down Expand Up @@ -53,11 +53,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
} else {
$dirOrFile = array();
// application
if (is_dir($dir = $this->container->getParameter('kernel.root_dir').'/fixtures/mandango')) {
if (is_dir($dir = $this->getContainer()->getParameter('kernel.root_dir').'/fixtures/mandango')) {
$dirOrFile[] = $dir;
}
// bundles
foreach ($this->container->get('kernel')->getBundles() as $bundle) {
foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
if (is_dir($dir = $bundle->getPath().'/Resources/fixtures/mandango')) {
$dirOrFile[] = $dir;
}
Expand Down Expand Up @@ -94,7 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$output->writeln('loading fixtures');

$dataLoader = new DataLoader($this->container->get('mandango'));
$dataLoader = new DataLoader($this->getContainer()->get('mandango'));
$dataLoader->load($data, $input->getOption('append'));
}
}

0 comments on commit b8c2d62

Please sign in to comment.