本文整理汇总了PHP中Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider::getConfigManager方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigProvider::getConfigManager方法的具体用法?PHP ConfigProvider::getConfigManager怎么用?PHP ConfigProvider::getConfigManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\EntityConfigBundle\Provider\ConfigProvider
的用法示例。
在下文中一共展示了ConfigProvider::getConfigManager方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEntityChoiceList
protected function getEntityChoiceList($entityClassName, $relationType)
{
$configManager = $this->configProvider->getConfigManager();
$choices = array();
if ($this->targetEntity) {
$entityIds = array($this->configProvider->getId($this->targetEntity));
} else {
$entityIds = $configManager->getIds('extend');
}
if (in_array($relationType, array('oneToMany', 'manyToMany'))) {
$entityIds = array_filter($entityIds, function (EntityConfigId $configId) use($configManager) {
$config = $configManager->getConfig($configId);
return $config->is('is_extend');
});
}
$entityIds = array_filter($entityIds, function (EntityConfigId $configId) use($configManager) {
$config = $configManager->getConfig($configId);
return $config->is('is_extend', false) || !$config->is('state', ExtendScope::STATE_NEW);
});
foreach ($entityIds as $entityId) {
$className = $entityId->getClassName();
if ($className != $entityClassName) {
list($moduleName, $entityName) = ConfigHelper::getModuleAndEntityNames($className);
$choices[$className] = $moduleName . ':' . $entityName;
}
}
return $choices;
}
示例2: createEntity
/**
* @param string $entityName
* @param bool $isExtend
* @param string $owner
* @param string $mode
*/
public function createEntity($entityName, $isExtend = true, $owner = self::OWNER_CUSTOM, $mode = ConfigModelManager::MODE_DEFAULT)
{
$configManager = $this->configProvider->getConfigManager();
$configManager->createConfigEntityModel($entityName, $mode);
$extendConfig = $this->configProvider->getConfig($entityName);
$extendConfig->set('owner', $owner);
$extendConfig->set('state', self::STATE_NEW);
$extendConfig->set('is_extend', $isExtend);
$configManager->persist($extendConfig);
$entityFieldConfig = $configManager->getProvider('entity')->getConfig($entityName, 'id');
$entityFieldConfig->set('label', 'Id');
}
示例3: testConfig
public function testConfig()
{
$this->assertEquals($this->configManager, $this->configProvider->getConfigManager());
$this->assertEquals(true, $this->configProvider->hasConfig(DemoEntity::ENTITY_NAME));
$this->assertEquals($this->entityConfig, $this->configProvider->getConfig(DemoEntity::ENTITY_NAME));
$this->assertEquals('testScope', $this->configProvider->getScope());
$entityConfigId = new EntityConfigId('testScope', DemoEntity::ENTITY_NAME);
$fieldConfigId = new FieldConfigId('testScope', DemoEntity::ENTITY_NAME, 'testField', 'string');
$this->assertEquals($entityConfigId, $this->configProvider->getId(DemoEntity::ENTITY_NAME));
$this->assertEquals($fieldConfigId, $this->configProvider->getId(DemoEntity::ENTITY_NAME, 'testField', 'string'));
$entityConfigIdWithOtherScope = new EntityConfigId('otherScope', DemoEntity::ENTITY_NAME);
$this->assertEquals($this->entityConfig, $this->configProvider->getConfigById($entityConfigIdWithOtherScope));
}
示例4: getPropertyChoiceList
/**
* @return array
*/
protected function getPropertyChoiceList()
{
$choices = array();
if (!$this->entityClass) {
return $choices;
}
$fields = $this->configProvider->filter(function (Config $config) {
return in_array($config->getId()->getFieldType(), ['integer', 'string', 'smallint', 'decimal', 'bigint', 'text', 'money']) && $config->is('is_deleted', false);
}, $this->entityClass);
$entityConfigProvider = $this->configProvider->getConfigManager()->getProvider('entity');
foreach ($fields as $field) {
$label = $entityConfigProvider->getConfigById($field->getId())->get('label');
$choices[$field->getId()->getFieldName()] = $label ?: $field->getId()->getFieldName();
}
return $choices;
}
示例5: getMetadata
/**
* {@inheritdoc}
*/
public function getMetadata()
{
$metadata = parent::getMetadata();
$entityIds = [];
$em = $this->entityConfigProvider->getConfigManager()->getEntityManager();
$configIds = $this->entityConfigProvider->getIds();
foreach ($configIds as $configId) {
$className = $configId->getClassName();
if ($this->extendConfigProvider->getConfig($className)->in('state', [ExtendScope::STATE_ACTIVE, ExtendScope::STATE_UPDATE])) {
$classMetadata = $em->getClassMetadata($className);
$identifiers = $classMetadata->getIdentifier();
$entityIds[$className] = array_shift($identifiers);
}
}
$metadata['entity_ids'] = $entityIds;
return $metadata;
}
示例6: getRepository
/**
* {@inheritdoc}
*/
public function getRepository($className)
{
$repo = parent::getRepository($className);
if ($repo instanceof EntityConfigAwareRepositoryInterface) {
$repo->setEntityConfigManager($this->extendConfigProvider->getConfigManager());
}
return $repo;
}
示例7: getEntityChoiceList
protected function getEntityChoiceList($entityClassName, $relationType)
{
$configManager = $this->configProvider->getConfigManager();
$choices = array();
if ($this->targetEntity) {
$entityIds = array($this->configProvider->getId($this->targetEntity));
} else {
$entityIds = $configManager->getIds('extend');
}
if (in_array($relationType, array('oneToMany', 'manyToMany'))) {
$entityIds = array_filter($entityIds, function (EntityConfigId $configId) use($configManager) {
$config = $configManager->getConfig($configId);
return $config->is('is_extend');
});
}
$entityIds = array_filter($entityIds, function (EntityConfigId $configId) use($configManager) {
$config = $configManager->getConfig($configId);
return $config->is('is_extend', false) || !$config->is('state', ExtendManager::STATE_NEW);
});
foreach ($entityIds as $entityId) {
$entityName = $moduleName = '';
if ($entityId->getClassName() != $entityClassName) {
$className = explode('\\', $entityId->getClassName());
if (count($className) > 1) {
foreach ($className as $i => $name) {
if (count($className) - 1 == $i) {
$entityName = $name;
} elseif (!in_array($name, array('Bundle', 'Entity'))) {
$moduleName .= $name;
}
}
}
$choices[$entityId->getClassName()] = $moduleName . ':' . $entityName;
}
}
return $choices;
}
示例8: clear
/**
* Removes the entity proxies and metadata from the cache
*
* @param bool $keepEntityProxies Set TRUE if proxies for custom and extend entities should not be deleted
*/
public function clear($keepEntityProxies = false)
{
$filesystem = new Filesystem();
if ($keepEntityProxies) {
$aliasesPath = ExtendClassLoadingUtils::getAliasesPath($this->cacheDir);
if ($filesystem->exists($aliasesPath)) {
$filesystem->remove($aliasesPath);
}
} else {
$baseCacheDir = ExtendClassLoadingUtils::getEntityBaseCacheDir($this->cacheDir);
if ($filesystem->exists($baseCacheDir)) {
$filesystem->remove([$baseCacheDir]);
}
$filesystem->mkdir(ExtendClassLoadingUtils::getEntityCacheDir($this->cacheDir));
}
$metadataCacheDriver = $this->configProvider->getConfigManager()->getEntityManager()->getMetadataFactory()->getCacheDriver();
if ($metadataCacheDriver instanceof ClearableCache) {
$metadataCacheDriver->deleteAll();
}
}