本文整理汇总了PHP中Env::setEm方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::setEm方法的具体用法?PHP Env::setEm怎么用?PHP Env::setEm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::setEm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PageEventListener
$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);