$chainDriverImpl->addDriver($driverImpl, 'Cx\\Model'); $driverImpl = new \Doctrine\ORM\Mapping\Driver\YamlDriver(ASCMS_CORE_PATH . '/ContentManager/Model/Yaml'); $chainDriverImpl->addDriver($driverImpl, 'Cx\\Core\\ContentManager'); //loggable stuff $loggableDriverImpl = $config->newDefaultAnnotationDriver(array(UPDATE_CORE, $doctrineDir . 'Gedmo/Loggable/Entity')); $chainDriverImpl->addDriver($loggableDriverImpl, 'Gedmo\\Loggable'); $loggableListener = new \Cx\Update\core\LoggableListener(); $evm->addEventSubscriber($loggableListener); \Env::set('loggableListener', $loggableListener); //tree stuff $treeListener = new \Gedmo\Tree\TreeListener(); $evm->addEventSubscriber($treeListener); $config->setMetadataDriverImpl($chainDriverImpl); //table prefix $prefixListener = new \DoctrineExtension\TablePrefixListener($_DBCONFIG['tablePrefix']); $evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $prefixListener); //page listener for unique slugs $pageListener = new PageEventListener(); $evm->addEventListener(\Doctrine\ORM\Events::preUpdate, $pageListener); $evm->addEventListener(\Doctrine\ORM\Events::onFlush, $pageListener); $evm->addEventListener(\Doctrine\ORM\Events::postPersist, $pageListener); $evm->addEventListener(\Doctrine\ORM\Events::preRemove, $pageListener); $config->setSqlLogger(new \Cx\Lib\DBG\DoctrineSQLLogger()); $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config, $evm); //resolve enum, set errors $conn = $em->getConnection(); $conn->setCharset($_DBCONFIG['charset']); $conn->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); $conn->getDatabasePlatform()->registerDoctrineTypeMapping('set', 'string'); Env::setEm($em);