Update commands for Symfony changes. Breaks compatibility with beta5

This commit is contained in:
ornicar 2011-06-21 10:23:25 -07:00
parent 4e5423efd4
commit 36f0a4bb19
2 changed files with 8 additions and 8 deletions

View file

@ -2,7 +2,7 @@
namespace FOQ\ElasticaBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
@ -12,7 +12,7 @@ use Symfony\Component\Console\Output\Output;
/**
* Populate the search index
*/
class PopulateCommand extends Command
class PopulateCommand extends ContainerAwareCommand
{
/**
* @see Command
@ -30,13 +30,13 @@ class PopulateCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('Reseting indexes');
$this->container->get('foq_elastica.reseter')->reset();
$this->getContainer()->get('foq_elastica.reseter')->reset();
$output->writeln('Setting mappings');
$this->container->get('foq_elastica.mapping_registry')->applyMappings();
$this->getContainer()->get('foq_elastica.mapping_registry')->applyMappings();
$output->writeln('Populating indexes');
$this->container->get('foq_elastica.populator')->populate(function($text) use ($output) {
$this->getContainer()->get('foq_elastica.populator')->populate(function($text) use ($output) {
$output->writeLn($text);
});

View file

@ -2,7 +2,7 @@
namespace FOQ\ElasticaBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
@ -14,7 +14,7 @@ use Elastica_Result;
/**
* Searches a type
*/
class SearchCommand extends Command
class SearchCommand extends ContainerAwareCommand
{
/**
* @see Command
@ -41,7 +41,7 @@ class SearchCommand extends Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$index = $this->container->get('foq_elastica.index_manager')->getIndex($input->getOption('index'));
$index = $this->getContainer()->get('foq_elastica.index_manager')->getIndex($input->getOption('index'));
$type = $index->getType($input->getArgument('type'));
$query = Elastica_Query::create($input->getArgument('query'));
$query->setLimit($input->getOption('limit'));