本文整理汇总了PHP中Doctrine\ORM\Event\LoadClassMetadataEventArgs类的典型用法代码示例。如果您正苦于以下问题:PHP LoadClassMetadataEventArgs类的具体用法?PHP LoadClassMetadataEventArgs怎么用?PHP LoadClassMetadataEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LoadClassMetadataEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$classMetadata = $eventArgs->getClassMetadata();
// add subclasses to node
$subclasses = array_flip($this->contentTypes);
if ($classMetadata->name == $subclasses['node']) {
unset($subclasses['node']);
$classMetadata->subClasses = $subclasses;
switch ($this->inheritanceType) {
case 'single_table':
$classMetadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE);
break;
case 'table_per_class':
$classMetadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_TABLE_PER_CLASS);
break;
default:
$classMetadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_JOINED);
break;
}
$classMetadata->setDiscriminatorColumn(array('name' => $this->discriminatorColumn, 'type' => 'string', 'length' => 50));
}
// check if class is defined in config
if (isset($this->contentTypes[$classMetadata->name])) {
// set discriminator
$classMetadata->discriminatorMap = array_flip($this->contentTypes);
$classMetadata->discriminatorValue = $this->contentTypes[$classMetadata->name];
}
}
开发者ID:hatimeria,项目名称:ZenstruckCMSBundle,代码行数:28,代码来源:DiscriminatorListener.php
示例2: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$classMetadata = $eventArgs->getClassMetadata();
$reflectionClass = $classMetadata->getReflectionClass();
if (null === $reflectionClass) {
return;
}
if (ClassUtil::classUsesTrait($reflectionClass->getName(), __NAMESPACE__ . '\\Translatable')) {
if (!$classMetadata->hasAssociation('translations')) {
$classMetadata->mapOneToMany(['fieldName' => 'translations', 'mappedBy' => 'translatable', 'indexBy' => 'locale', 'cascade' => ['persist', 'merge', 'remove'], 'orphanRemoval' => true, 'targetEntity' => $classMetadata->getName() . 'Translation']);
}
}
if (ClassUtil::classUsesTrait($reflectionClass->getName(), __NAMESPACE__ . '\\Translation')) {
if (!$classMetadata->hasAssociation('translatable')) {
$classMetadata->mapManyToOne(['fieldName' => 'translatable', 'inversedBy' => 'translations', 'joinColumns' => [['name' => 'translatable_id', 'referencedColumnName' => 'id', 'onDelete' => 'CASCADE']], 'targetEntity' => substr($classMetadata->getName(), 0, -11)]);
}
if (!$classMetadata->hasField('locale')) {
$classMetadata->mapField(['fieldName' => 'locale', 'type' => 'string']);
}
$translationConstraint = $classMetadata->getTableName() . '_unique_translation';
if (!ClassMetadataUtil::hasUniqueConstraint($classMetadata, $translationConstraint)) {
$classMetadata->setPrimaryTable(['uniqueConstraints' => [['name' => $translationConstraint, 'columns' => ['translatable_id', 'locale']]]]);
}
}
}
开发者ID:v3labs,项目名称:doctrine-extensions,代码行数:25,代码来源:TranslatableListener.php
示例3: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
/** @var ClassMetadata $metadata */
$metadata = $eventArgs->getClassMetadata();
// Transform Librinfo entities only
if (strpos($metadata->getName(), "Librinfo\\") !== 0) {
return;
}
$this->logger->debug("[NamingListener] Entering NamingListener for « loadClassMetadata » event");
$namingStrategy = $eventArgs->getEntityManager()->getConfiguration()->getNamingStrategy();
// create a FQDN for the representing table
if ($namingStrategy->classToTableName($metadata->getName()) == $metadata->table['name']) {
$metadata->table['name'] = $this->buildTableName($metadata->name);
}
// create a FQDN for the ManyToMany induced tables
foreach ($metadata->associationMappings as $field => $mapping) {
if ($mapping['type'] == ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide']) {
if ($namingStrategy->classToTableName($mapping['joinTable']['name']) == $mapping['joinTable']['name']) {
$rc = new \ReflectionClass($mapping['targetEntity']);
$fqdn = $mapping['sourceEntity'] . '__' . $rc->getShortName();
$metadata->associationMappings[$field]['joinTable']['name'] = $this->buildTableName($fqdn);
}
}
}
$this->logger->debug("[NamingListener] Added table naming strategy to Entity", ['class' => $metadata->getName()]);
}
开发者ID:libre-informatique,项目名称:SymfonyLibrinfoDoctrineBundle,代码行数:26,代码来源:NamingListener.php
示例4: loadClassMetadata
/**
* @param LoadClassMetadataEventArgs $args
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$this->em = $args->getEntityManager();
$this->meta = $args->getClassMetadata();
if (!$this->em->getConnection()->getWrappedConnection() instanceof AbstractConnection) {
return;
}
if ($this->meta->customPersisterClassName === null) {
$this->meta->setCustomPersisterClass(EntityPersister::class);
}
$this->markIndex();
foreach ($this->meta->fieldMappings as $property => &$mapping) {
$this->remapIdentifier($property, $mapping);
$this->remapVersion($property, $mapping);
$this->markField($property, $mapping);
}
foreach ($this->meta->associationMappings as $property => &$mapping) {
$this->remapAnyToOneAssociation($property, $mapping);
$this->remapAnyToManyAssociation($property, $mapping);
$this->remapManyToManyAssociation($property, $mapping);
}
if ($cache = $this->em->getMetadataFactory()->getCacheDriver()) {
$cache->save($this->meta->name . '$CLASSMETADATA', $this->meta, null);
}
}
开发者ID:mihai-stancu,项目名称:orientdb-orm,代码行数:28,代码来源:OrientDBListener.php
示例5: loadClassMetadata
/**
* define Addressable mapping at runtime
*
* @param LoadClassMetadataEventArgs $eventArgs
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
/** @var ClassMetadata $metadata */
$metadata = $eventArgs->getClassMetadata();
$reflectionClass = $metadata->getReflectionClass();
if (!$reflectionClass || !$this->hasTrait($reflectionClass, 'Librinfo\\DoctrineBundle\\Entity\\Traits\\Addressable')) {
return;
}
// return if current entity doesn't use Addressable trait
// Check if parents already have the Addressable trait
foreach ($metadata->parentClasses as $parent) {
if ($this->classAnalyzer->hasTrait($parent, 'Librinfo\\DoctrineBundle\\Entity\\Traits\\Addressable')) {
return;
}
}
$this->logger->debug("[AddressableListener] Entering AddressableListener for « loadClassMetadata » event");
// setting default mapping configuration for Traceable
// address
$metadata->mapField(['fieldName' => 'address', 'type' => 'string', 'nullable' => true]);
// zip
$metadata->mapField(['fieldName' => 'zip', 'type' => 'string', 'length' => 20, 'nullable' => true]);
// city
$metadata->mapField(['fieldName' => 'city', 'type' => 'string', 'nullable' => true]);
// country
$metadata->mapField(['fieldName' => 'country', 'type' => 'string', 'nullable' => true]);
// npai
$metadata->mapField(['fieldName' => 'npai', 'type' => 'boolean', 'nullable' => true]);
// vcardUid
$metadata->mapField(['fieldName' => 'vcardUid', 'type' => 'string', 'nullable' => true]);
// confirmed
$metadata->mapField(['fieldName' => 'confirmed', 'type' => 'boolean', 'default' => true]);
$this->logger->debug("[AddressableListener] Added Addressable mapping metadata to Entity", ['class' => $metadata->getName()]);
}
开发者ID:libre-informatique,项目名称:SymfonyLibrinfoDoctrineBundle,代码行数:38,代码来源:AddressableListener.php
示例6: loadClassMetadata
/**
* Sets the discriminator maps on AbstractCharacteristics entity mappings.
*
* @param LoadClassMetadataEventArgs $eventArgs
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$metadata = $eventArgs->getClassMetadata();
if ($metadata->getName() === self::ROOT_CHARACTERISTICS_CLASS) {
$metadata->setDiscriminatorMap($this->characteristicsClassesMap);
}
}
开发者ID:ekyna,项目名称:characteristics,代码行数:12,代码来源:AbstractMapsSubscriber.php
示例7: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$metadata = $eventArgs->getClassMetadata();
if ($metadata->getName() === $this->profile) {
$this->setupProfileDiscriminator($metadata);
}
}
开发者ID:symedit,项目名称:symedit,代码行数:7,代码来源:MetadataSubscriber.php
示例8: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$classMetadata = $args->getClassMetadata();
// Get class annotations
$classAnnotations = $this->annotatonReader->getClassAnnotations($classMetadata->getReflectionClass());
// Search for WordpressTable annotation
$found = false;
foreach ($classAnnotations as $classAnnotation) {
if ($classAnnotation instanceof WordpressTable) {
$found = true;
break;
}
}
// Only apply to classes having WPTable annotation
if (!$found) {
return;
}
// set table prefix
$prefix = $this->getPrefix($classMetadata->name, $args->getEntityManager());
$classMetadata->setPrimaryTable(array('name' => $prefix . $classMetadata->getTableName()));
// set table prefix to associated entity
// TODO: make sure prefix won't apply to user table
foreach ($classMetadata->associationMappings as &$mapping) {
if (isset($mapping['joinTable']) && !empty($mapping['joinTable'])) {
$mapping['joinTable']['name'] = $prefix . $mapping['joinTable']['name'];
}
}
}
开发者ID:chiqui3d,项目名称:KayueWordpressBundle,代码行数:28,代码来源:TablePrefixSubscriber.php
示例9: loadClassMetadata
/**
* define Emailable mapping at runtime
*
* @param LoadClassMetadataEventArgs $eventArgs
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
/** @var ClassMetadata $metadata */
$metadata = $eventArgs->getClassMetadata();
$reflectionClass = $metadata->getReflectionClass();
if (!$reflectionClass || !$this->hasTrait($reflectionClass, 'Librinfo\\DoctrineBundle\\Entity\\Traits\\Emailable')) {
return;
}
// return if current entity doesn't use Emailable trait
// Check if parents already have the Emailable trait
foreach ($metadata->parentClasses as $parent) {
if ($this->classAnalyzer->hasTrait($parent, 'Librinfo\\DoctrineBundle\\Entity\\Traits\\Emailable')) {
return;
}
}
$this->logger->debug("[EmailableListener] Entering EmailableListener for « loadClassMetadata » event");
// setting default mapping configuration for Traceable
// email
$metadata->mapField(['fieldName' => 'email', 'type' => 'string', 'nullable' => true]);
// emailNpai
$metadata->mapField(['fieldName' => 'emailNpai', 'type' => 'boolean', 'nullable' => true]);
// emailNoNewsletter
$metadata->mapField(['fieldName' => 'emailNoNewsletter', 'type' => 'boolean', 'nullable' => true]);
$this->logger->debug("[EmailableListener] Added Emailable mapping metadata to Entity", ['class' => $metadata->getName()]);
}
开发者ID:libre-informatique,项目名称:SymfonyLibrinfoDoctrineBundle,代码行数:30,代码来源:EmailableListener.php
示例10: loadClassMetadata
/**
* @param LoadClassMetadataEventArgs $args
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$meta = $args->getClassMetadata();
if ($this->_l) {
if (Strings::endsWith($meta->associationMappings[$this->_lName]['targetEntity'], '::dynamic')) {
$meta->associationMappings[$this->_lName]['targetEntity'] = $this->getTargetEntity($meta->name, $this->_l);
}
return;
}
foreach ($meta->getAssociationNames() as $name) {
if (!Strings::endsWith($meta->associationMappings[$name]['targetEntity'], '::dynamic')) {
continue;
}
$em = $args->getEntityManager();
$target = $this->getTargetEntity($meta, $name);
$this->_l = $meta->name;
$this->_lName = $meta->associationMappings[$name]['inversedBy'];
if (!$this->_lName) {
$this->_lName = $meta->associationMappings[$name]['mappedBy'];
}
if ($this->_lName) {
$targetMeta = $em->getClassMetadata($target);
}
$this->_l = FALSE;
$meta->associationMappings[$name]['targetEntity'] = $target;
if ($this->_lName) {
$targetMeta->associationMappings[$this->_lName]['targetEntity'] = $meta->name;
}
}
}
开发者ID:svobodni,项目名称:web,代码行数:33,代码来源:DynamicMapper.php
示例11: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$metadata = $args->getClassMetadata();
$user = 'FOM\\UserBundle\\Entity\\User';
$basicProfile = 'FOM\\UserBundle\\Entity\\BasicProfile';
$profile = $this->container->getParameter('fom_user.profile_entity');
if ($user == $metadata->getName()) {
$metadata->mapOneToOne(array('fieldName' => 'profile', 'targetEntity' => $profile, 'mappedBy' => 'uid', 'cascade' => array('persist')));
}
$connection = $args->getEntityManager()->getConnection();
$platform = $connection->getDatabasePlatform();
$uidColname = $connection->quoteIdentifier('uid');
if ($platform instanceof OraclePlatform) {
$uidColname = strtoupper($uidColname);
} elseif ($platform instanceof MySqlPlatform) {
$uidColname = 'uid';
}
// need to add metadata for the basic profile, else doctrine
// will whine in many situations
if ($profile == $metadata->getName() || $basicProfile == $metadata->getName()) {
$metadata->setIdentifier(array('uid'));
$metadata->setIdGenerator(new AssignedGenerator());
$metadata->mapOneToOne(array('fieldName' => 'uid', 'targetEntity' => $user, 'inversedBy' => 'profile', 'id' => true, 'joinColumns' => array(array('name' => $uidColname, 'referencedColumnName' => 'id'))));
}
}
开发者ID:mapbender,项目名称:fom,代码行数:25,代码来源:UserProfileListener.php
示例12: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$classMetadata = $args->getClassMetadata();
if ($classMetadata->isInheritanceTypeSingleTable() && !$classMetadata->isRootEntity()) {
// if we are in an inheritance hierarchy, only apply this once
return;
}
$classMetadata->setTableName($this->prefix . $classMetadata->getTableName());
foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY) {
$mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
}
}
if ($classMetadata->isIdGeneratorSequence()) {
$newDefinition = $classMetadata->sequenceGeneratorDefinition;
$newDefinition['sequenceName'] = $this->prefix . $newDefinition['sequenceName'];
$classMetadata->setSequenceGeneratorDefinition($newDefinition);
$em = $args->getEntityManager();
if (isset($classMetadata->idGenerator)) {
$sequenceGenerator = new \Doctrine\ORM\Id\SequenceGenerator($em->getConfiguration()->getQuoteStrategy()->getSequenceName($newDefinition, $classMetadata, $em->getConnection()->getDatabasePlatform()), $newDefinition['allocationSize']);
$classMetadata->setIdGenerator($sequenceGenerator);
}
}
}
开发者ID:javierseixas,项目名称:openMarketAPI,代码行数:25,代码来源:TablePrefixSubscriber.php
示例13: loadClassMetadata
/**
* loadClassMetadata event
*
* Retrieves the discriminatorMap from the BlockManagar, so we can
* add entities to the discriminatorMap without adjusting the annotations
* in the Block entity.
*
* @param LoadClassMetadataEventArgs $args
*
* @return void
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$metadata = $args->getClassMetadata();
if ($metadata->name == 'Opifer\\CmsBundle\\Entity\\Block') {
$metadata->setDiscriminatorMap($this->getDiscriminatorMap());
}
}
开发者ID:Opifer,项目名称:Cms,代码行数:18,代码来源:BlockDiscriminatorListener.php
示例14: loadClassMetadata
/**
* @param LoadClassMetadataEventArgs $eventArgs
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$metadata = $eventArgs->getClassMetadata();
$this->mapManyToMany($metadata);
$this->mapOneToMany($metadata);
$this->mapManyToOne($metadata);
}
开发者ID:aleherse,项目名称:Sylius,代码行数:10,代码来源:LoadMetadataSubscriber.php
示例15: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
/** @var ClassMetadata $metadata */
$metadata = $eventArgs->getClassMetadata();
// Do not generate id mapping twice for entities that extend a MappedSuperclass
if ($metadata->isMappedSuperclass) {
return;
}
// Do not generate id mapping twice for entities that use the SINGLE_TABLE inheritance mapping strategy.
if ($metadata->isInheritanceTypeSingleTable() && !$metadata->subClasses) {
return;
}
// Check if parents already have the Guidable trait
foreach ($metadata->parentClasses as $parent) {
if ($this->classAnalyzer->hasTrait($parent, 'Librinfo\\DoctrineBundle\\Entity\\Traits\\Guidable')) {
return;
}
}
$this->logger->debug("[GuidableListener] Entering GuidableListener for « loadClassMetadata » event");
$reflectionClass = $metadata->getReflectionClass();
// return if the current entity doesn't use Guidable trait
if (!$reflectionClass || !$this->hasTrait($reflectionClass, 'Librinfo\\DoctrineBundle\\Entity\\Traits\\Guidable')) {
return;
}
$metadata->mapField(['id' => true, 'fieldName' => "id", 'type' => "guid", 'columnName' => "id"]);
$metadata->setIdGenerator(new UuidGenerator());
$this->logger->debug("[GuidableListener] Added Guidable mapping metadata to Entity", ['class' => $metadata->getName()]);
}
开发者ID:libre-informatique,项目名称:SymfonyLibrinfoDoctrineBundle,代码行数:28,代码来源:GuidableListener.php
示例16: loadClassMetadata
/**
* Load class meta data event
*
* @param LoadClassMetadataEventArgs $args
*
* @return void
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
/** @var ClassMetadata $classMetadata */
$classMetadata = $args->getClassMetadata();
if (empty($this->prefix)) {
// Prefix is empty, we don't need to do anything;
return;
}
if ($classMetadata->namespace == self::ENTITY_NAMESPACE && $classMetadata->name == self::ENTITY_NAME) {
// Do not re-apply the prefix when the table is already prefixed
if (false === strpos($classMetadata->getTableName(), $this->prefix)) {
$tableName = $this->prefix . $classMetadata->getTableName();
$classMetadata->setPrimaryTable(['name' => $tableName]);
}
foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
if ($mapping['type'] == ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide'] == true) {
$mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];
// Do not re-apply the prefix when the association is already prefixed
if (false !== strpos($mappedTableName, $this->prefix)) {
continue;
}
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $this->prefix . $mappedTableName;
}
}
}
}
开发者ID:Wedmer,项目名称:PhpbbSessionsAuthBundle,代码行数:33,代码来源:TablePrefixSubscriber.php
示例17: loadClassMetadata
/**
* load class metadata.
*
* @todo [cms][db] add plugin hook if there is multi-site::multi-db module plugs enabled then it is no need site_id_prefix.
* @param \Doctrine\ORM\Event\LoadClassMetadataEventArgs $eventArgs
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
{
$classMetadata = $eventArgs->getClassMetadata();
if (!$classMetadata->isInheritanceTypeSingleTable() || $classMetadata->getName() === $classMetadata->rootEntityName) {
$table_name = $classMetadata->getTableName();
$table_name_with_prefixed = $this->prefix . $table_name;
// if it is multi-site table, set table prefix with site_id prefix
if (in_array($table_name, $this->multisite_tables)) {
if ($this->site_id_prefix != null) {
$table_name_with_prefixed = $this->prefix . $this->site_id_prefix . $table_name;
}
}
$classMetadata->setTableName($table_name_with_prefixed);
unset($table_name, $table_name_with_prefixed);
}
foreach ($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
if ($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY && $mapping['isOwningSide']) {
$mappedTableName = $mapping['joinTable']['name'];
$table_name_with_prefixed = $this->prefix . $mappedTableName;
// if it is multi-site table, set table prefix with site_id prefix
if (in_array($mappedTableName, $this->multisite_tables)) {
if ($this->site_id_prefix != null) {
$table_name_with_prefixed = $this->prefix . $this->site_id_prefix . $mappedTableName;
}
}
$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $table_name_with_prefixed;
unset($mappedTableName, $table_name_with_prefixed);
}
}
unset($fieldName, $mapping);
}
开发者ID:AgniCMS,项目名称:agni-framework,代码行数:37,代码来源:TablePrefix.php
示例18: loadClassMetadata
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$em = $args->getEntityManager();
$meta = $args->getClassMetadata();
$class = $meta->name;
$rootClass = $meta->rootEntityName;
$info = Chalk::info($class);
$parentClasses = array_merge([$class], $meta->parentClasses);
$repositoryClasses = [];
foreach ($parentClasses as $parentClass) {
$parentInfo = Chalk::info($parentClass);
$repositoryClasses[] = $parentInfo->module->class . '\\Repository\\' . $parentInfo->local->class;
}
$repositoryClasses[] = 'Chalk\\Repository';
foreach ($repositoryClasses as $repositoryClass) {
if (class_exists($repositoryClass)) {
$meta->setCustomRepositoryClass($repositoryClass);
break;
}
}
if ($meta->discriminatorMap) {
$meta->discriminatorMap = [Chalk::info($rootClass)->name => $rootClass];
$allClasses = $em->getConfiguration()->getMetadataDriverImpl()->getAllClassNames();
foreach ($allClasses as $allClass) {
if (is_subclass_of($allClass, $rootClass)) {
$meta->discriminatorMap[Chalk::info($allClass)->name] = $allClass;
}
if (is_subclass_of($allClass, $class) && !in_array($allClass, $meta->subClasses)) {
$meta->subClasses[] = $allClass;
}
}
}
}
开发者ID:jacksleight,项目名称:chalk,代码行数:33,代码来源:Listener.php
示例19: loadClassMetadata
/**
* @param LoadClassMetadataEventArgs $args
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
$evm = $args->getEntityManager()->getEventManager();
$this->resolveTargetEntities->addResolveTargetEntity("Bigfish\\Bundle\\CoreBundle\\Model\\TemplateInterface", "Bigfish\\Bundle\\CoreBundle\\Entity\\Template", array());
$this->resolveTargetEntities->addResolveTargetEntity("Bigfish\\Bundle\\CoreBundle\\Model\\RouteInterface", "Bigfish\\Bundle\\CoreBundle\\Entity\\Route", array());
$evm->addEventListener(Events::loadClassMetadata, $this->resolveTargetEntities);
}
开发者ID:BigfishCMF,项目名称:CoreBundle,代码行数:10,代码来源:ResolveCoreEntities.php
示例20: loadClassMetadata
/**
* @param LoadClassMetadataEventArgs $event
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $event)
{
// HOT FIX for PIM-3683, when using MongoDB with PIM some queries are executed before that the schema is created
return;
/** @var OroEntityManager $em */
$em = $event->getEntityManager();
$configProvider = $em->getExtendManager()->getConfigProvider();
$className = $event->getClassMetadata()->getName();
if ($configProvider->hasConfig($className)) {
$config = $configProvider->getConfig($className);
if ($config->is('is_extend')) {
$cmBuilder = new ClassMetadataBuilder($event->getClassMetadata());
if ($config->is('index')) {
foreach ($config->get('index') as $columnName => $enabled) {
$fieldConfig = $configProvider->getConfig($className, $columnName);
if ($enabled && !$fieldConfig->is('state', ExtendManager::STATE_NEW)) {
$cmBuilder->addIndex(array(ExtendConfigDumper::FIELD_PREFIX . $columnName), 'oro_idx_' . $columnName);
}
}
}
$this->prepareRelations($config, $cmBuilder);
}
$em->getMetadataFactory()->setMetadataFor($className, $event->getClassMetadata());
}
}
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:28,代码来源:DoctrineSubscriber.php
注:本文中的Doctrine\ORM\Event\LoadClassMetadataEventArgs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论