当前位置: 首页>>代码示例>>PHP>>正文


PHP Connection::getEventManager方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Connection::getEventManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getEventManager方法的具体用法?PHP Connection::getEventManager怎么用?PHP Connection::getEventManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Connection的用法示例。


在下文中一共展示了Connection::getEventManager方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createInstance

 /**
  * Factory method to create EntityManager instances.
  *
  * @param Connection $conn
  * @param Configuration $config
  * @param EventManager $eventManager
  * @throws \Doctrine\ORM\ORMException
  * @return ModelManager
  */
 public static function createInstance(Connection $conn, Configuration $config, EventManager $eventManager = null)
 {
     if (!$config->getMetadataDriverImpl()) {
         throw ORMException::missingMappingDriverImpl();
     }
     if ($eventManager !== null && $conn->getEventManager() !== $eventManager) {
         throw ORMException::mismatchedEventManager();
     }
     return new self($conn, $config, $conn->getEventManager());
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:19,代码来源:ModelManager.php

示例2: _getConnection

 protected function _getConnection()
 {
     if (!isset(self::$_conn)) {
         self::$_conn = DriverManager::getConnection($this->_getDbParams(), new Configuration());
         self::$_conn->getEventManager()->addEventSubscriber(new ORMSchemaEventSubscriber());
         Configurator::configure(self::$_conn->getConfiguration());
         if (!Type::hasType('tsvector')) {
             Type::addType('tsvector', 'Doctrine\\DBAL\\Types\\TextType');
         }
         $platform = self::$_conn->getDatabasePlatform();
         $platform->registerDoctrineTypeMapping('tsvector', 'tsvector');
     }
     return self::$_conn;
 }
开发者ID:jsor,项目名称:doctrine-postgis,代码行数:14,代码来源:AbstractFunctionalTestCase.php

示例3: _getConnection

 protected function _getConnection()
 {
     if (!isset(self::$_conn)) {
         $dbParams = array('driver' => $GLOBALS['db_type'], 'user' => $GLOBALS['db_username'], 'password' => $GLOBALS['db_password'], 'host' => $GLOBALS['db_host'], 'dbname' => $GLOBALS['db_name'], 'port' => $GLOBALS['db_port']);
         self::$_conn = DriverManager::getConnection($dbParams, new Configuration());
         self::$_conn->getEventManager()->addEventSubscriber(new ORMSchemaEventSubscriber());
         Configurator::configure(self::$_conn->getConfiguration());
         if (!Type::hasType('tsvector')) {
             Type::addType('tsvector', 'Doctrine\\DBAL\\Types\\TextType');
         }
         $platform = self::$_conn->getDatabasePlatform();
         $platform->registerDoctrineTypeMapping('tsvector', 'tsvector');
     }
     return self::$_conn;
 }
开发者ID:novikovsergey,项目名称:doctrine-postgis,代码行数:15,代码来源:AbstractFunctionalTestCase.php

示例4: testEventManagerPassedToPlatform

 public function testEventManagerPassedToPlatform()
 {
     $this->assertInstanceOf('Doctrine\\Common\\EventManager', $this->_conn->getDatabasePlatform()->getEventManager());
     $this->assertSame($this->_conn->getEventManager(), $this->_conn->getDatabasePlatform()->getEventManager());
 }
开发者ID:llinder,项目名称:FrameworkBenchmarks,代码行数:5,代码来源:ConnectionTest.php

示例5: __construct

 /**
  * @param Connection $conn
  * @param string $generatorTableName
  */
 public function __construct(Connection $conn, $generatorTableName = 'sequences')
 {
     $params = $conn->getParams();
     if ($params['driver'] == 'pdo_sqlite') {
         throw new \Doctrine\DBAL\DBALException("Cannot use TableGenerator with SQLite.");
     }
     $this->conn = DriverManager::getConnection($params, $conn->getConfiguration(), $conn->getEventManager());
     $this->generatorTableName = $generatorTableName;
 }
开发者ID:rdohms,项目名称:dbal,代码行数:13,代码来源:TableGenerator.php

示例6: getDbMockBuilder

 private function getDbMockBuilder(Connection $db)
 {
     return $this->getMockBuilder('\\Doctrine\\DBAL\\Connection')->setConstructorArgs([$db->getParams(), $db->getDriver(), $db->getConfiguration(), $db->getEventManager()])->enableOriginalConstructor();
 }
开发者ID:gandalf3,项目名称:bolt,代码行数:4,代码来源:StorageTest.php

示例7: testGetEventManager

 public function testGetEventManager()
 {
     $this->assertType('Doctrine\\Common\\EventManager', $this->_conn->getEventManager());
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:4,代码来源:ConnectionTest.php

示例8: addDbEventSubscribers

 private static function addDbEventSubscribers(Connection $conn)
 {
     if (isset($GLOBALS['db_event_subscribers'])) {
         $evm = $conn->getEventManager();
         foreach (explode(",", $GLOBALS['db_event_subscribers']) as $subscriberClass) {
             $subscriberInstance = new $subscriberClass();
             $evm->addEventSubscriber($subscriberInstance);
         }
     }
 }
开发者ID:selimcr,项目名称:servigases,代码行数:10,代码来源:TestUtil.php

示例9: connectToDatabase

 private function connectToDatabase(Connection $db, $databaseName)
 {
     $db->close();
     $db->__construct(['dbname' => $databaseName] + $db->getParams(), $db->getDriver(), $db->getConfiguration(), $db->getEventManager());
     $db->connect();
 }
开发者ID:jiripudil,项目名称:blog-db-testing,代码行数:6,代码来源:DatabaseSetup.php

示例10:

 function __construct(Connection $connection, KernelInterface $kernel)
 {
     $connection->getEventManager()->addEventListener(array(Events::postPersist, Events::postUpdate, Events::postRemove), $this);
     $this->uploadDir = $kernel->getRootDir() . '/../web/uploads';
 }
开发者ID:reserford,项目名称:art,代码行数:5,代码来源:ImageCanonizer.php

示例11: testEventManagerPassedToPlatform

 public function testEventManagerPassedToPlatform()
 {
     $driverMock = new DriverMock();
     $connection = new Connection($this->params, $driverMock);
     $this->assertInstanceOf('Doctrine\\Common\\EventManager', $connection->getDatabasePlatform()->getEventManager());
     $this->assertSame($connection->getEventManager(), $connection->getDatabasePlatform()->getEventManager());
 }
开发者ID:selimcr,项目名称:servigases,代码行数:7,代码来源:ConnectionTest.php


注:本文中的Doctrine\DBAL\Connection::getEventManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。