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


PHP ClassMetadataInfo::addEntityListener方法代码示例

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


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

示例1: loadMetadata

 public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
 {
     $metadata->mapField(array('type' => 'integer', 'name' => 'maxPrice', 'fieldName' => 'maxPrice'));
     $metadata->addEntityListener(\Doctrine\ORM\Events::postPersist, 'CompanyContractListener', 'postPersistHandler');
     $metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyContractListener', 'prePersistHandler');
     $metadata->addEntityListener(\Doctrine\ORM\Events::postUpdate, 'CompanyContractListener', 'postUpdateHandler');
     $metadata->addEntityListener(\Doctrine\ORM\Events::preUpdate, 'CompanyContractListener', 'preUpdateHandler');
     $metadata->addEntityListener(\Doctrine\ORM\Events::postRemove, 'CompanyContractListener', 'postRemoveHandler');
     $metadata->addEntityListener(\Doctrine\ORM\Events::preRemove, 'CompanyContractListener', 'preRemoveHandler');
     $metadata->addEntityListener(\Doctrine\ORM\Events::preFlush, 'CompanyContractListener', 'preFlushHandler');
     $metadata->addEntityListener(\Doctrine\ORM\Events::postLoad, 'CompanyContractListener', 'postLoadHandler');
     $metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyFlexUltraContractListener', 'prePersistHandler1');
     $metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CompanyFlexUltraContractListener', 'prePersistHandler2');
 }
开发者ID:selimcr,项目名称:servigases,代码行数:14,代码来源:CompanyFlexUltraContract.php

示例2: loadMetadata

 public static function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata)
 {
     $metadata->setPrimaryTable(array('name' => 'company_person'));
     $metadata->mapField(array('id' => true, 'fieldName' => 'id', 'type' => 'integer'));
     $metadata->mapField(array('fieldName' => 'zip', 'length' => 50));
     $metadata->mapField(array('fieldName' => 'city', 'length' => 50));
     $metadata->mapOneToOne(array('fieldName' => 'user', 'targetEntity' => 'CmsUser', 'joinColumns' => array(array('referencedColumnName' => 'id'))));
     $metadata->addNamedNativeQuery(array('name' => 'find-all', 'query' => 'SELECT id, country, city FROM cms_addresses', 'resultSetMapping' => 'mapping-find-all'));
     $metadata->addNamedNativeQuery(array('name' => 'find-by-id', 'query' => 'SELECT * FROM cms_addresses WHERE id = ?', 'resultClass' => 'Doctrine\\Tests\\Models\\CMS\\CmsAddress'));
     $metadata->addNamedNativeQuery(array('name' => 'count', 'query' => 'SELECT COUNT(*) AS count FROM cms_addresses', 'resultSetMapping' => 'mapping-count'));
     $metadata->addSqlResultSetMapping(array('name' => 'mapping-find-all', 'columns' => array(), 'entities' => array(array('fields' => array(array('name' => 'id', 'column' => 'id'), array('name' => 'city', 'column' => 'city'), array('name' => 'country', 'column' => 'country')), 'entityClass' => 'Doctrine\\Tests\\Models\\CMS\\CmsAddress'))));
     $metadata->addSqlResultSetMapping(array('name' => 'mapping-without-fields', 'columns' => array(), 'entities' => array(array('entityClass' => 'Doctrine\\Tests\\Models\\CMS\\CmsAddress', 'fields' => array()))));
     $metadata->addSqlResultSetMapping(array('name' => 'mapping-count', 'columns' => array(array('name' => 'count'))));
     $metadata->addEntityListener(\Doctrine\ORM\Events::postPersist, 'CmsAddressListener', 'postPersist');
     $metadata->addEntityListener(\Doctrine\ORM\Events::prePersist, 'CmsAddressListener', 'prePersist');
     $metadata->addEntityListener(\Doctrine\ORM\Events::postUpdate, 'CmsAddressListener', 'postUpdate');
     $metadata->addEntityListener(\Doctrine\ORM\Events::preUpdate, 'CmsAddressListener', 'preUpdate');
     $metadata->addEntityListener(\Doctrine\ORM\Events::postRemove, 'CmsAddressListener', 'postRemove');
     $metadata->addEntityListener(\Doctrine\ORM\Events::preRemove, 'CmsAddressListener', 'preRemove');
     $metadata->addEntityListener(\Doctrine\ORM\Events::preFlush, 'CmsAddressListener', 'preFlush');
     $metadata->addEntityListener(\Doctrine\ORM\Events::postLoad, 'CmsAddressListener', 'postLoad');
 }
开发者ID:selimcr,项目名称:servigases,代码行数:22,代码来源:CmsAddress.php


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