title: Error: Call to a member function format() on a non-object
body: <p>Im creating a symfony console command to auto select a winner from participant entries to run via cron every day.</p>
  
  <p>The execute function looks like this</p>
  
  <pre><code>    protected function execute(InputInterface $input, OutputInterface $output)
      {
  
          $this-&gt;today = new \DateTime();
          $this-&gt;today = $this-&gt;today-&gt;format('Y-m-d');
  
          $this-&gt;container = $this-&gt;getApplication()-&gt;getKernel()-&gt;getContainer();
          $participant = $this-&gt;container-&gt;get('smack_calendar.data_collection_repository')
              -&gt;findOneBy(array('entryDate' =&gt; $this-&gt;today ));
  </code></pre>
  
  <p>}</p>
  
  <p>when executing</p>
  
  <pre><code> app/console foo:pickwinner --test daily
  </code></pre>
  
  <p>I get this error </p>
  
  <blockquote>
    <p>[Symfony\Component\Debug\Exception\FatalErrorException]   Error: Call
    to a member function format() on a non-object</p>
  </blockquote>
  
  <p>on this line</p>
  
  <pre><code>-&gt;findOneBy(array('entryDate' =&gt; $this-&gt;today ));
  </code></pre>
  
  <p>Im not a big symfony user and never touched doctrine before so forgive me if this is a stupid question :D</p>