title: "em is not defined error" when trying to run doctrine command
body: <p>I've just setup a ZF2 project and configured it all for Doctrine2 without issue. It works and simply gives me an error now as it cannot find the database table I am trying to query.</p>
  
  <p>Entity is also setup correctly, all as per <a href="http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/" rel="nofollow">http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/</a></p>
  
  <p>So wanted to use the CLI to create the tables etc but when running any CLI command I get </p>
  
  <pre><code>[InvalidArgumentException]       
  The helper "em" is not defined.
  </code></pre>
  
  <p>Command I am using</p>
  
  <pre><code>php doctrine.php orm:schema-tool:update --dump-sql
  </code></pre>
  
  <p>Am running the doctrine.php from folder</p>
  
  <pre><code>/Library/WebServer/Documents/zf2-Skel-NewProj1/vendor/bin
  </code></pre>
  
  <p>Now if I use the CLI for one of my ZF1.11 projects it works fine.</p>
  
  <p>To get this working do I have to edit the cli-config.php file located under</p>
  
  <pre><code>/Library/WebServer/Documents/zf2-Skel-NewProj1/vendor/doctrine/orm/tools
  </code></pre>
  
  <p>Contents of this file is:</p>
  
  <pre><code>&lt;?php
  
  require_once '../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
  
  $classLoader = new \Doctrine\Common\ClassLoader('Doctrine\ORM', realpath(__DIR__ . '/../../lib'));
  $classLoader-&gt;register();
  $classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', realpath(__DIR__ . '/../../lib/vendor/doctrine-dbal/lib'));
  $classLoader-&gt;register();
  $classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Common', realpath(__DIR__ . '/../../lib/vendor/doctrine-common/lib'));
  $classLoader-&gt;register();
  $classLoader = new \Doctrine\Common\ClassLoader('Symfony', realpath(__DIR__ . '/../../lib/vendor'));
  $classLoader-&gt;register();
  $classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
  $classLoader-&gt;register();
  $classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
  $classLoader-&gt;register();
  
  $config = new \Doctrine\ORM\Configuration();
  $config-&gt;setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
  $driverImpl = $config-&gt;newDefaultAnnotationDriver(array(__DIR__."/Entities"));
  $config-&gt;setMetadataDriverImpl($driverImpl);
  
  $config-&gt;setProxyDir(__DIR__ . '/Proxies');
  $config-&gt;setProxyNamespace('Proxies');
  
  $connectionOptions = array(
  'driver' =&gt; 'pdo_sqlite',
  'path' =&gt; 'database.sqlite'
  );
  
  $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
  
  $helpers = new Symfony\Component\Console\Helper\HelperSet(array(
      'db' =&gt; new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em-&gt;getConnection()),
      'em' =&gt; new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
  ));
  </code></pre>