/** * So called "static constructor". * NOTE: do not call the "parent::__constructStatic()" explicitly: it will be called automatically * * @return void */ public static function __constructStatic() { foreach (static::getResourcesSchema() as $data) { list(, $index, ) = $data; static::$resources[$index] = static::getResourcesTypeSchema(); } static::$profilerInfo = array('isEnabled' => \XLite\Core\Profiler::isTemplatesProfilingEnabled(), 'markTemplates' => (bool) \XLite::getInstance()->getOptions(array('debug', 'mark_templates')), 'countDeep' => 0, 'countLevel' => 0, 'tail' => array()); }
/** * Start Doctrine entity manager * * @return void */ public function startEntityManager() { // Initialize DB connection and entity manager static::$em = \Doctrine\ORM\EntityManager::create($this->getDSN(), $this->configuration); if (\XLite\Core\Profiler::getInstance()->enabled) { static::$em->getConnection()->getConfiguration()->setSQLLogger(\XLite\Core\Profiler::getInstance()); } static::registerCustomTypes(static::$em); // Set charset for DB connection $this->setCharset(); // Bind events $events = array(\Doctrine\ORM\Events::loadClassMetadata); if (static::$cacheDriver) { // Bind cache chekers $events[] = \Doctrine\ORM\Events::postPersist; $events[] = \Doctrine\ORM\Events::postUpdate; $events[] = \Doctrine\ORM\Events::postRemove; } static::$em->getEventManager()->addEventListener($events, $this); }