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


PHP EntityManager::getEventManager方法代码示例

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


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

示例1: testconfiguration

 public function testconfiguration()
 {
     $config = new Configuration();
     $config->setCurrentUser($this->ZfcUserMock);
     $prefix = "prefix";
     $config->setTablePrefix($prefix);
     $suffix = "suffix";
     $config->setTableSuffix($suffix);
     $fieldName = "fieldName";
     $config->setRevisionFieldName($fieldName);
     $revisionIdFieldType = "string";
     $config->setRevisionIdFieldType($revisionIdFieldType);
     $tableName = "tableName";
     $config->setRevisionTableName($tableName);
     $revisionTypeFieldName = "string";
     $config->setRevisionTypeFieldName($revisionTypeFieldName);
     $ipaddress = $config->getIpAddress();
     $config->setAuditedEntityClasses(array('ZF2EntityAuditTest\\Entity\\Article', 'ZF2EntityAuditTest\\Entity\\Writer'));
     $config->setNote("default note");
     $this->auditManager = new Manager($config);
     $this->auditManager->registerEvents($this->em->getEventManager());
     /// creating the tables
     $this->schemaTool = $this->getSchemaTool();
     $this->schemaTool->createSchema(array($this->em->getClassMetadata('ZF2EntityAuditTest\\Entity\\Article'), $this->em->getClassMetadata('ZF2EntityAuditTest\\Entity\\Writer')));
     $this->assertInstanceOf("ZfcUser\\Entity\\User", $this->ZfcUserMock);
     $this->assertEquals($prefix, $config->getTablePrefix());
     $this->assertEquals($suffix, $config->getTableSuffix());
     $this->assertEquals($fieldName, $config->getRevisionFieldName());
     $this->assertEquals($tableName, $config->getRevisionTableName());
     $this->assertEquals($revisionIdFieldType, $config->getRevisionIdFieldType());
     $this->assertEquals($revisionTypeFieldName, $config->getRevisionIdFieldType());
     $this->assertEquals($ipaddress, "1.1.1.9");
 }
开发者ID:tawfekov,项目名称:zf2entityaudit,代码行数:33,代码来源:ConfigurationTest.php

示例2: testAssertTableColumnsAreNotAddedInManyToMany

 /**
  * @group DDC-2109
  */
 public function testAssertTableColumnsAreNotAddedInManyToMany()
 {
     $evm = $this->em->getEventManager();
     $this->listener->addResolveTargetEntity('Doctrine\\Tests\\ORM\\Tools\\ResolveTargetInterface', 'Doctrine\\Tests\\ORM\\Tools\\ResolveTargetEntity', array());
     $this->listener->addResolveTargetEntity('Doctrine\\Tests\\ORM\\Tools\\TargetInterface', 'Doctrine\\Tests\\ORM\\Tools\\TargetEntity', array());
     $evm->addEventListener(Events::loadClassMetadata, $this->listener);
     $cm = $this->factory->getMetadataFor('Doctrine\\Tests\\ORM\\Tools\\ResolveTargetEntity');
     $meta = $cm->associationMappings['manyToMany'];
     $this->assertSame('Doctrine\\Tests\\ORM\\Tools\\TargetEntity', $meta['targetEntity']);
     $this->assertEquals(array('resolvetargetentity_id', 'targetinterface_id'), $meta['joinTableColumns']);
 }
开发者ID:Herriniaina,项目名称:iVarotra,代码行数:14,代码来源:ResolveTargetEntityListenerTest.php

示例3: testResolveTargetEntityListenerCanResolveTargetEntity

 /**
  * @group DDC-1544
  */
 public function testResolveTargetEntityListenerCanResolveTargetEntity()
 {
     $evm = $this->em->getEventManager();
     $this->listener->addResolveTargetEntity('Doctrine\\Tests\\ORM\\Tools\\ResolveTargetInterface', 'Doctrine\\Tests\\ORM\\Tools\\ResolveTargetEntity', array());
     $this->listener->addResolveTargetEntity('Doctrine\\Tests\\ORM\\Tools\\TargetInterface', 'Doctrine\\Tests\\ORM\\Tools\\TargetEntity', array());
     $evm->addEventListener(Events::loadClassMetadata, $this->listener);
     $cm = $this->factory->getMetadataFor('Doctrine\\Tests\\ORM\\Tools\\ResolveTargetEntity');
     $meta = $cm->associationMappings;
     $this->assertSame('Doctrine\\Tests\\ORM\\Tools\\TargetEntity', $meta['manyToMany']['targetEntity']);
     $this->assertSame('Doctrine\\Tests\\ORM\\Tools\\ResolveTargetEntity', $meta['manyToOne']['targetEntity']);
     $this->assertSame('Doctrine\\Tests\\ORM\\Tools\\ResolveTargetEntity', $meta['oneToMany']['targetEntity']);
     $this->assertSame('Doctrine\\Tests\\ORM\\Tools\\TargetEntity', $meta['oneToOne']['targetEntity']);
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:16,代码来源:ResolveTargetEntityListenerTest.php

示例4: setUp

 public function setUp()
 {
     $this->Bootstrap = new Bootstrap();
     $this->em = $this->Bootstrap->getServiceManager()->get("doctrine.entitymanager.orm_default");
     /// echo sql logger
     //$this->em->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());;
     /// let's create the default user
     $this->ZfcUserMock = $this->createUser();
     $auditConfig = new Configuration();
     $auditConfig->setCurrentUser($this->ZfcUserMock);
     $auditConfig->setAuditedEntityClasses(array('ZF2EntityAuditTest\\Entity\\Article', 'ZF2EntityAuditTest\\Entity\\Writer'));
     $auditConfig->setNote("default note");
     $this->auditManager = new Manager($auditConfig);
     $this->auditManager->registerEvents($this->em->getEventManager());
     /// creating the tables
     $this->schemaTool = $this->getSchemaTool();
     $this->schemaTool->createSchema(array($this->em->getClassMetadata('ZF2EntityAuditTest\\Entity\\Article'), $this->em->getClassMetadata('ZF2EntityAuditTest\\Entity\\Writer')));
 }
开发者ID:tawfekov,项目名称:zf2entityaudit,代码行数:18,代码来源:AuditTest.php

示例5: killSoftDeletableListener

 /**
  * Removes the SoftDeleteableListener from the EventManager
  */
 public function killSoftDeletableListener()
 {
     foreach ($this->em->getEventManager()->getListeners() as $event => $listeners) {
         foreach ($listeners as $hash => $listener) {
             if ($listener instanceof SoftDeleteableListener) {
                 $listenerInst = $listener;
                 break 2;
             }
         }
     }
     $this->em->getEventManager()->removeEventListener(array('onFlush'), $listenerInst);
 }
开发者ID:RobertjanSchipper,项目名称:Cms,代码行数:15,代码来源:BlockManager.php


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