private function registerCollectors() { $this->loader->registerNamespace('Shopware\\Plugin\\Debug', realpath(__DIR__ . '/../../../../Default/Core/Debug/') . '/'); $eventManager = Shopware()->Container()->get('events'); $utils = new Utils(); $errorHandler = $this->collection->get('ErrorHandler'); if ($this->Config()->get('logTemplateVars')) { $this->pushCollector(new TemplateVarCollector($eventManager)); } if ($this->Config()->get('logErrors')) { $this->pushCollector(new ErrorCollector($errorHandler, $utils)); } if ($this->Config()->get('logExceptions')) { $this->pushCollector(new ExceptionCollector($eventManager, $utils)); } if ($this->Config()->get('logDb')) { $this->pushCollector(new DatabaseCollector(Shopware()->Container()->get('db'))); } if ($this->Config()->get('logModel')) { $this->pushCollector(new DbalCollector(Shopware()->Container()->get('modelconfig'))); } if ($this->Config()->get('logTemplate')) { $this->pushCollector(new TemplateCollector(Shopware()->Container()->get('template'), $utils, Shopware()->Container()->get('kernel')->getRootDir())); } if ($this->Config()->get('logController')) { $this->pushCollector(new ControllerCollector($eventManager, $utils)); } if ($this->Config()->get('logEvents')) { $this->pushCollector(new EventCollector($eventManager, $utils)); } foreach ($this->collectors as $collector) { $collector->start(); } }
/** * @param Enlight_Event_EventManager $eventManager * @param array $options * @throws Exception */ public function __construct(\Enlight_Event_EventManager $eventManager, \Enlight_Loader $loader, $options) { $this->eventManager = $eventManager; if (!isset($options['proxyNamespace'])) { throw new \Exception('proxyNamespace has to be set.'); } if (!isset($options['proxyDir'])) { throw new \Exception('proxyDir has to be set.'); } $this->proxyFactory = new Enlight_Hook_ProxyFactory($this, $options['proxyNamespace'], $options['proxyDir']); $loader->registerNamespace($options['proxyNamespace'], $this->proxyFactory->getProxyDir()); }
/** * @param Container $container * @param \Enlight_Loader $loader * @param \Enlight_Event_EventManager $eventManager * @param \Shopware $application * @param array $config * @return \Enlight_Plugin_PluginManager */ public function factory(Container $container, \Enlight_Loader $loader, \Enlight_Event_EventManager $eventManager, \Shopware $application, array $config) { $pluginManager = new \Enlight_Plugin_PluginManager($application); $container->load('Table'); if (!isset($config['namespaces'])) { $config['namespaces'] = array('Core', 'Frontend', 'Backend'); } foreach ($config['namespaces'] as $namespace) { $namespace = new \Shopware_Components_Plugin_Namespace($namespace); $pluginManager->registerNamespace($namespace); $eventManager->registerSubscriber($namespace->Subscriber()); } foreach (array('Local', 'Community', 'Default', 'Commercial') as $dir) { $loader->registerNamespace('Shopware_Plugins', Shopware()->AppPath('Plugins_' . $dir)); } return $pluginManager; }
/** * Creates the entity manager for the application. * * @param EventManager $eventManager * @param Configuration $config * @param \Enlight_Loader $loader * @param \Pdo $db * @param string $kernelRootDir * @param AnnotationDriver $modelAnnotation * * @return ModelManager */ public function factory(EventManager $eventManager, Configuration $config, \Enlight_Loader $loader, \PDO $db, $kernelRootDir, AnnotationDriver $modelAnnotation) { $vendorPath = $kernelRootDir . '/vendor'; // register standard doctrine annotations AnnotationRegistry::registerFile($vendorPath . '/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'); // register symfony validation annotations AnnotationRegistry::registerAutoloadNamespace('Symfony\\Component\\Validator\\Constraint', realpath($vendorPath . '/symfony/validator')); $loader->registerNamespace('Shopware\\Models\\Attribute', $config->getAttributeDir()); // now create the entity manager and use the connection // settings we defined in our application.ini $conn = DriverManager::getConnection(array('pdo' => $db), $config, $eventManager); $conn->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); $conn->getDatabasePlatform()->registerDoctrineTypeMapping('bit', 'boolean'); $entityManager = ModelManager::createInstance($conn, $config, $eventManager); LazyFetchModelEntity::setEntityManager($entityManager); return $entityManager; }
/** * Include the auto load / tests the loading * * @return Enlight_Loader * @throws Exception */ protected function initLoader() { @(include_once 'Enlight/Loader.php'); if (!class_exists('Enlight_Loader')) { throw new Exception('Enlight loader could not be included. Please check the include path.'); } $loader = new Enlight_Loader(); $loader->registerNamespace('Enlight', 'Enlight/'); $loader->registerNamespace('Zend', 'Zend/'); return $loader; }