/** * Factory method. * * @param ServiceLocatorInterface $serviceLocator * @return SectionController */ public function createService(ServiceLocatorInterface $serviceLocator) { $ctr = new SchoolController(); $ctr->setEntityManager($serviceLocator->getServiceLocator()->get('Doctrine\\ORM\\EntityManager')); $ctr->setSectionService($serviceLocator->getServiceLocator()->get('SectionService')); return $ctr; }