title: Call to a member function get()
body: <p>I created a sort base module in my ZF2 vendor library.  So far everything is working the way I want it to work.  I do have a problem.  While I am able to extend the base module's controllers, I am unable to access the base service.  I am using Doctrine 2 as my database layer.</p>
  
  <p>After implementing the ServiceLocator, I am getting Fatal error: Call to a member function get() on a non-object in my base service file. My BaseService file is shown as below:</p>
  
  <pre><code>namespace MyResource\Service;
  
  use Doctrine\ORM\Mapping as ORM;
  use Zend\ServiceManager\ServiceManager;
  use Zend\ServiceManager\ServiceManagerAwareInterface;
  use Zend\ServiceManager\ServiceLocatorInterface;
  
  class BaseService implements ServiceLocatorAwareInterface
  {
      /**
       * Entity manager instance
       *
       * @var Doctrine\ORM\EntityManager
       */
      protected $_em;
  
      protected $_serviceLocator;
  
      public function __construct()
      {
          $this-&gt;getEntityManager();
      }
  
      /**
       * Returns an instance of the Doctrine entity manager loaded from the service
       * locator
       *
       * @return Doctrine\ORM\EntityManager
       */
      public function getEntityManager()
      {
          if (null === $this-&gt;_em) {
              $this-&gt;_em = $this-&gt;getServiceLocator()
                   -&gt;get('doctrine.entitymanager.orm_default');
          }
          return $this-&gt;_em;
      }
  
      /**
       * Set serviceManager instance
       *
       * @param  ServiceLocatorInterface $serviceLocator
       * @return void
       */
      public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
      {
          $this-&gt;serviceLocator = $serviceLocator;
      }
  
      /**
       * Retrieve serviceManager instance
       *
       * @return ServiceLocatorInterface
       */
      public function getServiceLocator()
      {
          return $this-&gt;serviceLocator;
      }
  
  }
  </code></pre>
  
  <p>Can anyone help?</p>
  
  <p>Thanks</p>