public static function getEntityManager($smart = FALSE, $path_to_entity = null, $proxyPath = null, $proxyNamespace = null) { if (empty(self::$em)) { if ($path_to_entity === NULL) { //$path_to_entity = PATH_ROOT . '/' . Sokol::getApp()->name . '/Entity'; $path_to_entity = PATH_ROOT . '/Entity'; } $isDev = Sokol::getApp()->isDev; $connectionParams = Sokol::getConfig('db'); //---Table Prefix--- $tablePrefix = !empty($connectionParams['tablePrefix']) ? $connectionParams['tablePrefix'] : null; if ($tablePrefix) { $evm = new EventManager(); $tablePrefix = new TablePrefix($tablePrefix); $evm->addEventListener(Events::loadClassMetadata, $tablePrefix); } //---/Table Prefix--- if ($smart) { self::$em = self::getEmSmart($path_to_entity, $isDev, $connectionParams, $evm); } else { if ($proxyPath === NULL) { $proxyPath = PATH_ROOT . '/' . Sokol::getApp()->name . '/Proxy'; } if ($proxyNamespace === NULL) { $proxyNamespace = Sokol::getApp()->getNamespace() . '\\Proxy'; } self::$em = self::getEm($path_to_entity, $isDev, $connectionParams, $evm, $proxyPath, $proxyNamespace); } //подключаем тип данных "html" Type::addType('html', 'Sokol\\Doctrine\\Extension\\HtmlType'); self::$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('db_html', 'html'); } return self::$em; }