title: Document manager in symfony2 in console command
body: <p>I need a cron job for my symfony site. I have found tutorial to create console command in
  <a href="http://symfony.com/doc/2.1/cookbook/console/console_command.html" rel="nofollow">http://symfony.com/doc/2.1/cookbook/console/console_command.html</a>  </p>
  
  <p>My command.php</p>
  
  <blockquote>
    <p>namespace xxx\WebBundle\Command;</p>
    
    <p>use Symfony\Component\Console\Command\Command; use
    Symfony\Component\Console\Input\InputArgument; use
    Symfony\Component\Console\Input\InputInterface; use
    Symfony\Component\Console\Input\InputOption; use
    Symfony\Component\Console\Output\OutputInterface;</p>
    
    <p>class GreetCommand extends Command {
        protected function configure()
        {</p>
  
  <pre><code>}
  
  protected function execute(InputInterface $input, OutputInterface $output)
  {
  
      $em = $this-&gt;getContainer()-&gt;get('doctrine')-&gt;getManager();
      $em-&gt;getRepository('xxxWebBundle:Wishlist')-&gt;findAll();
     // $output-&gt;writeln($text);
  } 
  </code></pre>
    
    <p>}</p>
  </blockquote>
  
  <p>When I call command in console, getting error " Call to undefined method xxxx\WebBundle\Command\MyCommand::getContainer() "
  How can I get the document manger in execute function?  </p>