本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Config\ConfigManager::getIds方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigManager::getIds方法的具体用法?PHP ConfigManager::getIds怎么用?PHP ConfigManager::getIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityConfigBundle\Config\ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getIds方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntityChoiceList
/**
* @param string $entityClassName
* @param string $relationType
*
* @return array
*/
protected function getEntityChoiceList($entityClassName, $relationType)
{
/** @var EntityConfigId[] $entityIds */
$entityIds = $this->targetEntityClass ? [$this->configManager->getId('extend', $this->targetEntityClass)] : $this->configManager->getIds('extend');
if (in_array($relationType, [RelationTypeBase::ONE_TO_MANY, RelationTypeBase::MANY_TO_MANY], true)) {
$entityIds = array_filter($entityIds, function (EntityConfigId $configId) {
$config = $this->configManager->getConfig($configId);
return $config->is('is_extend');
});
}
$entityIds = array_filter($entityIds, function (EntityConfigId $configId) {
$config = $this->configManager->getConfig($configId);
return !$config->is('state', ExtendScope::STATE_NEW) && ($this->targetEntityClass || !$config->is('is_deleted'));
});
$choices = [];
foreach ($entityIds as $entityId) {
$className = $entityId->getClassName();
if (!$this->configManager->hasConfig($className, 'id') && !ExtendHelper::isCustomEntity($className)) {
// @todo: temporary ignore entities that don't have PK with name 'id'
// remove this in https://magecore.atlassian.net/browse/BAP-9713
continue;
}
if ($className !== $entityClassName) {
$entityConfig = $this->configManager->getProvider('entity')->getConfig($className);
$choices[$className] = $entityConfig->get('label');
}
}
return $choices;
}
示例2: getIds
/**
* Gets a list of ids for all classes (if $className is not specified) or all fields of
* the given $className, which can be managed by this provider.
*
* @param string|null $className
* @return array|ConfigIdInterface[]
*/
public function getIds($className = null)
{
if ($className) {
$className = $this->getClassName($className);
}
return $this->configManager->getIds($this->getScope(), $className);
}
示例3: getTargetEntityClasses
/**
* Get array with all target classes (entities where activity can be assigned to)
*
* @param bool $regenerateCaches
* @return array
*/
public function getTargetEntityClasses($regenerateCaches = false)
{
if (empty($this->targetClasses)) {
/** @var ConfigIdInterface[] $configIds */
$configIds = $this->configManager->getIds('entity', null, false, $regenerateCaches);
foreach ($configIds as $configId) {
foreach ($this->providers as $provider) {
if ($provider->isApplicableTarget($configId, $this->configManager) && !in_array($configId->getClassName(), $this->targetClasses)) {
$this->targetClasses[] = $configId->getClassName();
continue;
}
}
}
}
return $this->targetClasses;
}
示例4: getIds
/**
* Gets a list of ids for all configurable entities (if $className is not specified)
* or all configurable fields of the given $className, which can be managed by this provider.
*
* @param string|null $className
* @param bool $withHidden Set true if you need ids of all configurable entities,
* including entities marked as mode="hidden"
*
* @return array|ConfigIdInterface[]
*/
public function getIds($className = null, $withHidden = false)
{
if ($className) {
$className = $this->getClassName($className);
}
return $this->configManager->getIds($this->getScope(), $className, $withHidden);
}
示例5: testGetIds
/**
* @dataProvider getIdsProvider
*/
public function testGetIds($scope, $className, $withHidden, $expectedIds)
{
$models = [$this->createEntityConfigModel('EntityClass1'), $this->createEntityConfigModel('EntityClass2'), $this->createEntityConfigModel('HiddenEntity', ConfigModel::MODE_HIDDEN)];
$entityModel = $this->createEntityConfigModel('EntityClass1');
$fieldModels = [$this->createFieldConfigModel($entityModel, 'f1', 'int'), $this->createFieldConfigModel($entityModel, 'f2', 'int'), $this->createFieldConfigModel($entityModel, 'hiddenField', 'int', ConfigModel::MODE_HIDDEN)];
$this->modelManager->expects($this->any())->method('checkDatabase')->willReturn(true);
$this->modelManager->expects($this->once())->method('getModels')->with($className)->willReturn($className ? $fieldModels : $models);
$result = $this->configManager->getIds($scope, $className, $withHidden);
$this->assertEquals($expectedIds, array_values($result));
}
示例6: isApplicableTarget
/**
* @param string $targetClassName
* @param string $activityClassName
*
* @return bool
*/
public function isApplicableTarget($targetClassName, $activityClassName)
{
/** @var ConfigIdInterface[] $configIds */
$configIds = $this->configManager->getIds('entity', null, false);
foreach ($configIds as $configId) {
if (array_key_exists($activityClassName, $this->providers)) {
$provider = $this->getProviderByClass($activityClassName);
if ($provider->isApplicableTarget($configId, $this->configManager) && $configId->getClassName() === $targetClassName) {
return true;
}
}
}
return false;
}
示例7: getTargetEntityClasses
/**
* Get array with all target classes (entities where activity can be assigned to)
*
* @param bool $accessible Whether only targets are ready to be used in a business logic should be returned.
* It means that an association with the target entity should exist
* and should not be marked as deleted.
*
* @return string[]
*/
public function getTargetEntityClasses($accessible = true)
{
if (null === $this->targetClasses || !isset($this->targetClasses[$accessible])) {
$targetClasses = [];
/** @var ConfigIdInterface[] $configIds */
$configIds = $this->configManager->getIds('entity');
foreach ($configIds as $configId) {
$entityClass = $configId->getClassName();
foreach ($this->providers as $provider) {
if ($provider->isApplicableTarget($entityClass, $accessible)) {
$targetClasses[] = $entityClass;
break;
}
}
}
$this->targetClasses[$accessible] = $targetClasses;
}
return $this->targetClasses[$accessible];
}
示例8: renameExtendColumns
protected function renameExtendColumns(Schema $schema, QueryBag $queries, ConfigManager $configManager)
{
/** @var EntityMetadataHelper $entityMetadataHelper */
$entityMetadataHelper = $this->container->get('oro_entity_extend.migration.entity_metadata_helper');
$configManager->clearConfigurableCache();
/** @var EntityConfigId[] $entityConfigIds */
$entityConfigIds = $configManager->getIds('extend');
foreach ($entityConfigIds as $entityConfigId) {
if ($configManager->getConfig($entityConfigId)->is('is_extend')) {
$tableName = $entityMetadataHelper->getTableNameByEntityClass($entityConfigId->getClassName());
if ($tableName && $schema->hasTable($tableName)) {
$table = $schema->getTable($tableName);
/** @var FieldConfigId[] $fieldConfigIds */
$fieldConfigIds = $configManager->getIds('extend', $entityConfigId->getClassName());
foreach ($fieldConfigIds as $fieldConfigId) {
if ($configManager->getConfig($fieldConfigId)->is('extend')) {
$this->renameExtendField($schema, $queries, $table, $fieldConfigId, $configManager, $entityMetadataHelper);
}
}
}
}
}
}