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


PHP ConfigInterface::is方法代码示例

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


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

示例1: prepareRelations

 /**
  * @param ConfigInterface $config
  * @param ClassMetadataBuilder $cmBuilder
  */
 protected function prepareRelations(ConfigInterface $config, ClassMetadataBuilder $cmBuilder)
 {
     if ($config->is('relation')) {
         foreach ($config->get('relation') as $relation) {
             /** @var FieldConfigId $fieldId */
             if ($relation['assign'] && ($fieldId = $relation['field_id'])) {
                 /** @var FieldConfigId $targetFieldId */
                 $targetFieldId = $relation['target_field_id'];
                 $targetFieldName = $targetFieldId ? ExtendConfigDumper::FIELD_PREFIX . $targetFieldId->getFieldName() : null;
                 $fieldName = ExtendConfigDumper::FIELD_PREFIX . $fieldId->getFieldName();
                 $defaultName = ExtendConfigDumper::DEFAULT_PREFIX . $fieldId->getFieldName();
                 switch ($fieldId->getFieldType()) {
                     case 'manyToOne':
                         $builder = $cmBuilder->createManyToOne($fieldName, $relation['target_entity']);
                         if ($targetFieldName) {
                             $builder->inversedBy($targetFieldName);
                         }
                         $builder->addJoinColumn($fieldName . '_id', 'id', true, false, 'SET NULL');
                         $builder->cascadeDetach();
                         $builder->build();
                         break;
                     case 'oneToMany':
                         /** create 1:* */
                         $builder = $cmBuilder->createOneToMany($fieldName, $relation['target_entity']);
                         $builder->mappedBy($targetFieldName);
                         $builder->cascadeDetach();
                         $builder->build();
                         /** create 1:1 default */
                         $builder = $cmBuilder->createOneToOne($defaultName, $relation['target_entity']);
                         $builder->addJoinColumn($defaultName . '_id', 'id', true, false, 'SET NULL');
                         $builder->build();
                         break;
                     case 'manyToMany':
                         if ($relation['owner']) {
                             $builder = $cmBuilder->createManyToMany($fieldName, $relation['target_entity']);
                             if ($targetFieldName) {
                                 $builder->inversedBy($targetFieldName);
                             }
                             $builder->setJoinTable(ExtendHelper::generateManyToManyJoinTableName($fieldId, $relation['target_entity']));
                             $builder->build();
                             $builder = $cmBuilder->createOneToOne($defaultName, $relation['target_entity']);
                             $builder->addJoinColumn($defaultName . '_id', 'id', true, false, 'SET NULL');
                             $builder->build();
                         } else {
                             $cmBuilder->addInverseManyToMany($fieldName, $relation['target_entity'], $targetFieldName);
                         }
                         break;
                 }
             }
         }
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:56,代码来源:DoctrineSubscriber.php

示例2: createRelation

 /**
  * @param ConfigInterface $fieldConfig
  */
 protected function createRelation(ConfigInterface $fieldConfig)
 {
     if (!$fieldConfig->is('relation_key')) {
         $this->createSelfRelation($fieldConfig);
     } else {
         $relationKey = $fieldConfig->get('relation_key');
         $selfConfig = $this->extendConfigProvider->getConfig($fieldConfig->getId()->getClassName());
         $selfRelations = $selfConfig->get('relation', false, []);
         if (!isset($selfRelations[$relationKey])) {
             $this->createSelfRelation($fieldConfig);
         }
         $this->ensureReverseRelationCompleted($fieldConfig);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:17,代码来源:RelationEntityConfigDumperExtension.php

示例3: createRelation

 /**
  * @param ConfigInterface $fieldConfig
  */
 protected function createRelation(ConfigInterface $fieldConfig)
 {
     if (!$fieldConfig->is('relation_key')) {
         $this->setRelationKeyToFieldConfig($fieldConfig);
         $this->createSelfRelation($fieldConfig);
     } else {
         $entityConfig = $this->getEntityConfig($fieldConfig->getId()->getClassName());
         $relations = $entityConfig->get('relation', false, []);
         $relationKey = $fieldConfig->get('relation_key');
         if (!isset($relations[$relationKey])) {
             $this->createSelfRelation($fieldConfig);
             $this->ensureReverseRelationCompleted($fieldConfig);
         } else {
             $relation = $relations[$relationKey];
             if (array_key_exists('owner', $relation)) {
                 $this->ensureReverseRelationCompleted($fieldConfig);
             } elseif (isset($relation['target_field_id']) && $relation['target_field_id']) {
                 $this->completeSelfRelation($fieldConfig);
             }
         }
     }
 }
开发者ID:paulstoica,项目名称:platform,代码行数:25,代码来源:RelationEntityConfigDumperExtension.php

示例4: createRelation

 /**
  * @param ConfigInterface $fieldConfig
  */
 protected function createRelation(ConfigInterface $fieldConfig)
 {
     $createSelfRelation = true;
     if ($fieldConfig->is('relation_key')) {
         $relationKey = $fieldConfig->get('relation_key');
         $selfConfig = $this->extendConfigProvider->getConfig($fieldConfig->getId()->getClassName());
         $selfRelations = $selfConfig->get('relation');
         if (isset($selfRelations[$relationKey]['field_id'])) {
             $createSelfRelation = false;
         } else {
             $targetConfig = $this->extendConfigProvider->getConfig($fieldConfig->get('target_entity'));
             $targetRelations = $targetConfig->get('relation');
             if (isset($targetRelations[$relationKey])) {
                 $this->createTargetRelation($fieldConfig, $relationKey);
                 if ($targetRelations[$relationKey]['assign']) {
                     $createSelfRelation = false;
                 }
             }
         }
     }
     if ($createSelfRelation) {
         $this->createSelfRelation($fieldConfig);
     }
 }
开发者ID:northdakota,项目名称:platform,代码行数:27,代码来源:RelationEntityConfigDumperExtension.php

示例5: apply

 /**
  * {@inheritdoc}
  */
 protected function apply(ConfigInterface $config)
 {
     $configId = $config->getId();
     $className = $configId->getClassName();
     if ($configId instanceof FieldConfigId) {
         $fieldName = $configId->getFieldName();
         if (!isset($this->initialStates['fields'][$className][$fieldName])) {
             return true;
         }
         $initialState = $this->initialStates['fields'][$className][$fieldName];
     } else {
         if (!isset($this->initialStates['entities'][$className])) {
             return true;
         }
         $initialState = $this->initialStates['entities'][$className];
     }
     if ($initialState === ExtendScope::STATE_ACTIVE) {
         return true;
     }
     if ($initialState === ExtendScope::STATE_DELETE && !$config->is('state', ExtendScope::STATE_DELETE)) {
         return true;
     }
     return false;
 }
开发者ID:Maksold,项目名称:platform,代码行数:27,代码来源:ByInitialStateFilter.php

示例6: isApplicableField

 /**
  * @param ConfigInterface         $extendConfig
  * @param ConfigProviderInterface $extendConfigProvider
  *
  * @return bool
  */
 protected function isApplicableField(ConfigInterface $extendConfig, ConfigProviderInterface $extendConfigProvider)
 {
     return !$extendConfig->is('is_deleted') && $extendConfig->is('owner', ExtendScope::OWNER_CUSTOM) && !$extendConfig->is('state', ExtendScope::STATE_NEW) && !in_array($extendConfig->getId()->getFieldType(), ['ref-one', 'ref-many']) && (!$extendConfig->has('target_entity') || !$extendConfigProvider->getConfig($extendConfig->get('target_entity'))->is('is_deleted'));
 }
开发者ID:xamin123,项目名称:platform,代码行数:10,代码来源:DynamicFieldsExtension.php

示例7: getDynamicFieldItem

 /**
  * Get dynamic field or empty array if field is not visible
  *
  * @param $alias
  * @param ConfigInterface $extendConfig
  * @return array
  */
 public function getDynamicFieldItem($alias, ConfigInterface $extendConfig)
 {
     /** @var FieldConfigId $fieldConfig */
     $fieldConfig = $extendConfig->getId();
     $fieldName = $fieldConfig->getFieldName();
     $field = [];
     $select = '';
     // no need to add to select enything here
     if (in_array($fieldName, $this->relationConfig->get('target_grid'))) {
         /** @var ConfigProvider $entityConfigProvider */
         $entityConfigProvider = $this->configManager->getProvider('entity');
         $entityConfig = $entityConfigProvider->getConfig($this->entityClass, $fieldName);
         $label = $entityConfig->get('label') ?: $fieldName;
         $code = $extendConfig->is('owner', ExtendManager::OWNER_CUSTOM) ? ExtendConfigDumper::FIELD_PREFIX . $fieldName : $fieldName;
         $this->queryFields[] = $code;
         $field = $field = $this->createFieldArrayDefinition($code, $label, $fieldConfig);
         $select = $alias . '.' . $code;
     }
     return [$field, $select];
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:27,代码来源:RelationEntityGridListener.php

示例8: checkState

 /**
  * @param ConfigInterface $extendConfig
  *
  * @return bool
  */
 protected function checkState(ConfigInterface $extendConfig)
 {
     $hasChanges = false;
     $extendProvider = $this->em->getExtendConfigProvider();
     $className = $extendConfig->getId()->getClassName();
     if ($extendConfig->is('state', ExtendScope::STATE_DELETE)) {
         // mark entity as deleted
         if (!$extendConfig->is('is_deleted')) {
             $extendConfig->set('is_deleted', true);
             $extendProvider->persist($extendConfig);
             $hasChanges = true;
         }
         // mark all fields as deleted
         $fieldConfigs = $extendProvider->getConfigs($className, true);
         foreach ($fieldConfigs as $fieldConfig) {
             if (!$fieldConfig->is('is_deleted')) {
                 $fieldConfig->set('is_deleted', true);
                 $extendProvider->persist($fieldConfig);
                 $hasChanges = true;
             }
         }
     } elseif (!$extendConfig->is('state', ExtendScope::STATE_ACTIVE)) {
         $extendConfig->set('state', ExtendScope::STATE_ACTIVE);
         $extendProvider->persist($extendConfig);
         $hasChanges = true;
     }
     return $hasChanges;
 }
开发者ID:xamin123,项目名称:platform,代码行数:33,代码来源:ExtendConfigDumper.php

示例9: supports

 /**
  * {@inheritdoc}
  */
 public function supports(ConfigInterface $extendConfig)
 {
     return $extendConfig->is('relation');
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:RelationMetadataBuilder.php

示例10: isApplicableField

 /**
  * @param ConfigInterface $extendConfig
  *
  * @return bool
  */
 protected function isApplicableField(ConfigInterface $extendConfig)
 {
     return !$extendConfig->is('is_deleted') && $extendConfig->is('owner', ExtendScope::OWNER_CUSTOM) && !$extendConfig->is('state', ExtendScope::STATE_NEW) && !in_array($extendConfig->getId()->getFieldType(), RelationType::$toAnyRelations) && (!$extendConfig->has('target_entity') || !$this->extendConfigProvider->getConfig($extendConfig->get('target_entity'))->is('is_deleted'));
 }
开发者ID:northdakota,项目名称:platform,代码行数:9,代码来源:ExtendFieldTypeGuesser.php

示例11: filterFields

 /**
  * @param ConfigInterface $config
  * @return bool
  */
 public function filterFields(ConfigInterface $config)
 {
     $extendConfig = $this->extendProvider->getConfigById($config->getId());
     /** @var FieldConfigId $fieldConfigId */
     $fieldConfigId = $extendConfig->getId();
     // skip system and not accessible fields
     if (!$config->is('owner', ExtendScope::OWNER_CUSTOM) || !ExtendHelper::isFieldAccessible($config)) {
         return false;
     }
     // skip invisible fields
     if (!$this->viewProvider->getConfigById($config->getId())->is('is_displayable')) {
         return false;
     }
     // skip relations if they are referenced to not accessible entity
     $underlyingFieldType = $this->fieldTypeHelper->getUnderlyingType($fieldConfigId->getFieldType());
     if (in_array($underlyingFieldType, RelationType::$anyToAnyRelations, true) && !ExtendHelper::isEntityAccessible($this->extendProvider->getConfig($extendConfig->get('target_entity')))) {
         return false;
     }
     return true;
 }
开发者ID:Maksold,项目名称:platform,代码行数:24,代码来源:DynamicFieldsExtension.php

示例12: processTitles

 /**
  * Check if field marked as title_field, add this field to titles
  *
  * @param array           $mapConfig
  * @param ConfigInterface $searchConfig
  * @param string          $className
  * @param string          $fieldName
  */
 protected function processTitles(&$mapConfig, ConfigInterface $searchConfig, $className, $fieldName)
 {
     if ($searchConfig->is('title_field')) {
         $mapConfig[$className][self::TITLE_FIELDS_PATH] = array_merge($mapConfig[$className][self::TITLE_FIELDS_PATH], [$fieldName]);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:14,代码来源:BeforeMapObjectSearchListener.php

示例13: isTargetEntityApplicable

 /**
  * {@inheritdoc}
  */
 protected function isTargetEntityApplicable(ConfigInterface $targetEntityConfig)
 {
     return $targetEntityConfig->is($this->getAssociationAttributeName());
 }
开发者ID:xamin123,项目名称:platform,代码行数:7,代码来源:AssociationEntityConfigDumperExtension.php

示例14: updateStateValues

 /**
  * @param ConfigInterface $entityConfig
  * @param ConfigProvider  $configProvider
  */
 protected function updateStateValues(ConfigInterface $entityConfig, ConfigProvider $configProvider)
 {
     if ($entityConfig->is('state', ExtendScope::STATE_DELETE)) {
         // mark entity as deleted
         if (!$entityConfig->is('is_deleted')) {
             $entityConfig->set('is_deleted', true);
             $this->configManager->persist($entityConfig);
         }
         // mark all fields as deleted
         $fieldConfigs = $configProvider->getConfigs($entityConfig->getId()->getClassName(), true);
         foreach ($fieldConfigs as $fieldConfig) {
             if (!$fieldConfig->is('is_deleted')) {
                 $fieldConfig->set('is_deleted', true);
                 $this->configManager->persist($fieldConfig);
             }
         }
     } elseif (!$entityConfig->is('state', ExtendScope::STATE_ACTIVE)) {
         $hasNotActiveFields = false;
         $fieldConfigs = $configProvider->getConfigs($entityConfig->getId()->getClassName(), true);
         foreach ($fieldConfigs as $fieldConfig) {
             if (!$fieldConfig->in('state', [ExtendScope::STATE_ACTIVE, ExtendScope::STATE_DELETE])) {
                 $hasNotActiveFields = true;
                 break;
             }
         }
         // Set entity state to active if all fields are active or deleted
         if (!$hasNotActiveFields) {
             $entityConfig->set('state', ExtendScope::STATE_ACTIVE);
             $this->configManager->persist($entityConfig);
         }
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:36,代码来源:ExtendConfigDumper.php

示例15: getDynamicFieldItem

 /**
  * Get dynamic field or empty array if field is not visible
  *
  * @param $alias
  * @param ConfigInterface $extendConfig
  * @return array
  */
 public function getDynamicFieldItem($alias, ConfigInterface $extendConfig)
 {
     /** @var FieldConfigId $fieldConfig */
     $fieldConfig = $extendConfig->getId();
     /** @var ConfigProvider $datagridProvider */
     $datagridConfigProvider = $this->configManager->getProvider('datagrid');
     $datagridConfig = $datagridConfigProvider->getConfig($this->entityClass, $fieldConfig->getFieldName());
     $select = '';
     $field = [];
     if ($datagridConfig->is('is_visible')) {
         /** @var ConfigProvider $entityConfigProvider */
         $entityConfigProvider = $this->configManager->getProvider('entity');
         $entityConfig = $entityConfigProvider->getConfig($this->entityClass, $fieldConfig->getFieldName());
         $label = $entityConfig->get('label') ?: $fieldConfig->getFieldName();
         $code = $extendConfig->is('owner', ExtendManager::OWNER_CUSTOM) ? ExtendConfigDumper::FIELD_PREFIX . $fieldConfig->getFieldName() : $fieldConfig->getFieldName();
         $this->queryFields[] = $code;
         $field = $this->createFieldArrayDefinition($code, $label, $fieldConfig);
         $select = $alias . '.' . $code;
     }
     return [$field, $select];
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:28,代码来源:CustomEntityGridListener.php


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