/**
  * @return Orm\IServiceContainer
  */
 public function getContainer()
 {
     $container = new Orm\ServiceContainer();
     $container->addService('annotationsParser', 'Orm\\AnnotationsParser');
     $container->addService('annotationClassParser', array($this, 'createAnnotationClassParser'));
     $container->addService('mapperFactory', array($this, 'createMapperFactory'));
     $container->addService('repositoryHelper', 'Orm\\RepositoryHelper');
     $container->addService('dibi', $this->dibiConnection);
     $container->addService('purifier', $this->purifier);
     $container->addService('container', $this->container);
     if ($this->cache !== NULL) {
         $container->addService('performanceHelperCache', $this->cache);
     }
     return $container;
 }
Esempio n. 2
0
 /** @param IServiceContainer|NULL */
 public function __construct(IServiceContainer $container = NULL)
 {
     if (!$container) {
         $container = new ServiceContainer();
     }
     $container->addService('annotationsParser', 'Orm\\AnnotationsParser');
     $container->addService('annotationClassParser', array($this, 'createAnnotationClassParser'));
     $container->addService('mapperFactory', array($this, 'createMapperFactory'));
     $container->addService('repositoryHelper', 'Orm\\RepositoryHelper');
     $container->addService('dibi', array($this, 'createDibi'));
     if ($performanceHelperCache = $this->getPerformanceHelperCacheFactory()) {
         $container->addService('performanceHelperCache', $performanceHelperCache);
     }
     $this->container = $container;
 }