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


PHP Config::setValues方法代码示例

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


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

示例1: getEntityConfig

 /**
  * @param string $className
  * @param mixed  $values
  *
  * @return ConfigInterface
  */
 protected function getEntityConfig($className, $values)
 {
     $configId = new EntityConfigId('extend', $className);
     $config = new Config($configId);
     $config->setValues($values);
     return $config;
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:ByOriginFilterTest.php

示例2: testValueConfig

 public function testValueConfig()
 {
     $config = new Config(new EntityConfigId('testScope', 'testClass'));
     $values = array('firstKey' => 'firstValue', 'secondKey' => 'secondValue', 'thirdKey' => 3, 'fourthKey' => new \stdClass(), 'falseKey' => false, 'nullKey' => null);
     $config->setValues($values);
     $this->assertEquals($values, $config->all());
     $this->assertEquals(array('firstKey' => 'firstValue'), $config->all(function ($value) {
         return $value == 'firstValue';
     }));
     $this->assertEquals('firstValue', $config->get('firstKey'));
     $this->assertEquals('secondValue', $config->get('secondKey'));
     $this->assertTrue($config->is('secondKey'));
     $this->assertTrue($config->in('thirdKey', ['3']));
     $this->assertFalse($config->in('thirdKey', ['3'], true));
     $this->assertTrue($config->in('thirdKey', [3]));
     $this->assertTrue($config->in('thirdKey', [3], true));
     $this->assertFalse($config->in('thirdKey', [100]));
     $this->assertTrue($config->has('secondKey'));
     $this->assertFalse($config->has('nonExistKey'));
     $this->assertTrue($config->has('falseKey'));
     $this->assertTrue($config->has('nullKey'));
     $this->assertNull($config->get('nonExistKey'));
     $this->assertFalse($config->get('falseKey'));
     $this->assertNull($config->get('nullKey'));
     $this->assertEquals($config, unserialize(serialize($config)));
     $config->set('secondKey', 'secondValue2');
     $this->assertEquals('secondValue2', $config->get('secondKey'));
     $this->assertEquals(112233, $config->get('nonExistKey', false, 112233));
     $this->assertEquals('default', $config->get('nonExistKey', false, 'default'));
     $this->assertEquals([], $config->get('nonExistKey', false, []));
     $this->setExpectedException('Oro\\Bundle\\EntityConfigBundle\\Exception\\RuntimeException');
     $config->get('nonExistKey', true);
 }
开发者ID:Maksold,项目名称:platform,代码行数:33,代码来源:ConfigTest.php

示例3: prepareConfigProvider

 protected function prepareConfigProvider(array $configValues, $className)
 {
     /** @var \PHPUnit_Framework_MockObject_MockObject|ConfigIdInterface $configId */
     $configId = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\Id\\ConfigIdInterface');
     $entityConfig = new Config($configId);
     $entityConfig->setValues($configValues);
     $this->configProvider->expects($this->once())->method('hasConfig')->with($this->equalTo($className))->will($this->returnValue(true));
     $this->configProvider->expects($this->once())->method('getConfig')->with($this->equalTo($className))->will($this->returnValue($entityConfig));
 }
开发者ID:paulstoica,项目名称:platform,代码行数:9,代码来源:OwnerTypeExtensionTest.php

示例4: testValueConfig

 public function testValueConfig()
 {
     $values = array('firstKey' => 'firstValue', 'secondKey' => 'secondValue', 'fourthKey' => new \stdClass());
     $this->config->setValues($values);
     $this->assertEquals($values, $this->config->all());
     $this->assertEquals(array('firstKey' => 'firstValue'), $this->config->all(function ($value) {
         return $value == 'firstValue';
     }));
     $this->assertEquals('firstValue', $this->config->get('firstKey'));
     $this->assertEquals('secondValue', $this->config->get('secondKey'));
     $this->assertEquals(true, $this->config->is('secondKey'));
     $this->assertEquals(true, $this->config->has('secondKey'));
     $this->assertEquals(false, $this->config->has('thirdKey'));
     $this->assertEquals(null, $this->config->get('thirdKey'));
     $this->assertEquals($this->config, unserialize(serialize($this->config)));
     $this->config->set('secondKey', 'secondValue2');
     $this->assertEquals('secondValue2', $this->config->get('secondKey'));
     $this->setExpectedException('Oro\\Bundle\\EntityConfigBundle\\Exception\\RuntimeException');
     $this->config->get('thirdKey', true);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:20,代码来源:ConfigTest.php

示例5: testWithoutOwnerType

 public function testWithoutOwnerType()
 {
     $entity = new BusinessUnit();
     $className = 'Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit';
     /** @var \PHPUnit_Framework_MockObject_MockObject|ConfigIdInterface $configId */
     $configId = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\Id\\ConfigIdInterface');
     $config = new Config($configId);
     $config->setValues(['another_owner_type' => 'test_type']);
     $this->configProvider->expects($this->once())->method('hasConfig')->with($this->equalTo($className))->will($this->returnValue(true));
     $this->configProvider->expects($this->once())->method('getConfig')->with($this->equalTo($className))->will($this->returnValue($config));
     $this->assertNull($this->extension->getOwnerType($entity));
 }
开发者ID:gmoigneu,项目名称:platform,代码行数:12,代码来源:OwnerTypeExtensionTest.php

示例6: preSetData

 public function preSetData()
 {
     $entityConfigId = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\Id\\EntityConfigId')->disableOriginalConstructor()->getMock();
     $user = new User();
     $user->setId(1);
     $organization = new Organization();
     $organization->setId(3);
     $userConfig = new Config($entityConfigId);
     $userConfig->setValues(["owner_type" => "USER", "owner_field_name" => "owner", "owner_column_name" => "owner_id", "organization_field_name" => "organization", "organization_column_name" => "organization_id"]);
     $buConfig = new Config($entityConfigId);
     $buConfig->setValues(["owner_type" => "BUSINESS_UNIT", "owner_field_name" => "owner", "owner_column_name" => "owner_id", "organization_field_name" => "organization", "organization_column_name" => "organization_id"]);
     $organizationConfig = new Config($entityConfigId);
     $organizationConfig->setValues(["owner_type" => "ORGANIZATION", "owner_field_name" => "owner", "owner_column_name" => "owner_id"]);
     return ['OwnershipType User with UsernamePasswordOrganizationToken' => [new UsernamePasswordOrganizationToken($user, 'admin', 'key', $organization), $userConfig, ['owner' => $user, 'organization' => $organization]], 'OwnershipType BusinessUnit with UsernamePasswordOrganizationToken' => [new UsernamePasswordOrganizationToken($user, 'admin', 'key', $organization), $buConfig, ['organization' => $organization]], 'OwnershipType Organization with UsernamePasswordOrganizationToken' => [new UsernamePasswordOrganizationToken($user, 'admin', 'key', $organization), $organizationConfig, ['owner' => $organization]], 'OwnershipType User with UsernamePasswordToken' => [new UsernamePasswordToken($user, 'admin', 'key'), $userConfig, ['owner' => $user]], 'OwnershipType BusinessUnit with UsernamePasswordToken' => [new UsernamePasswordToken($user, 'admin', 'key'), $buConfig, []], 'OwnershipType Organization with UsernamePasswordToken' => [new UsernamePasswordToken($user, 'admin', 'key'), $organizationConfig, []]];
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:RecordOwnerDataListenerTest.php

示例7: addFieldConfig

 /**
  * @param string $className
  * @param string $fieldName
  * @param string $fieldType
  * @param array  $values
  * @param bool   $hidden
  *
  * @return Config
  */
 public function addFieldConfig($className, $fieldName, $fieldType = null, $values = [], $hidden = false)
 {
     if (empty($className)) {
         throw new \InvalidArgumentException('$className must not be empty.');
     }
     if (empty($fieldName)) {
         throw new \InvalidArgumentException('$fieldName must not be empty.');
     }
     $config = new Config(new FieldConfigId($this->getScope(), $className, $fieldName, $fieldType));
     $config->setValues($values);
     $this->fieldConfigs[$className][$fieldName] = $config;
     if ($hidden) {
         $this->hiddenFields[$className][$fieldName] = true;
     } else {
         unset($this->hiddenFields[$className][$fieldName]);
     }
     return $config;
 }
开发者ID:Maksold,项目名称:platform,代码行数:27,代码来源:ConfigProviderMock.php

示例8: getEntityFieldConfig

 /**
  * @param string $className
  * @param string $fieldName
  * @param mixed  $values
  * @param string $scope
  *
  * @return Config
  */
 protected function getEntityFieldConfig($className, $fieldName, $values, $scope = 'extend')
 {
     $configId = new FieldConfigId($scope, $className, $fieldName);
     $config = new Config($configId);
     $config->setValues($values);
     return $config;
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:DictionaryValueListProviderTest.php

示例9: getConfig

 /**
  * @param  ConfigIdInterface $configId
  * @param  array|null        $values
  *
  * @return Config
  */
 protected function getConfig(ConfigIdInterface $configId, array $values = null)
 {
     $config = new Config($configId);
     if (null !== $values) {
         $config->setValues($values);
     }
     return $config;
 }
开发者ID:Maksold,项目名称:platform,代码行数:14,代码来源:ConfigManagerTest.php

示例10: getEntityConfig

 protected function getEntityConfig($entityClassName, $values)
 {
     $entityConfigId = new EntityConfigId('entity', $entityClassName);
     $entityConfig = new Config($entityConfigId);
     $entityConfig->setValues($values);
     return $entityConfig;
 }
开发者ID:Maksold,项目名称:platform,代码行数:7,代码来源:OwnerDeletionManagerTest.php

示例11: testAddManyToManyRelationForAlreadyExistRelationWithOptions

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function testAddManyToManyRelationForAlreadyExistRelationWithOptions()
 {
     $relationName = 'testRelation';
     $relationKey = 'manyToMany|Test\\SourceEntity|Test\\TargetEntity|testRelation';
     $targetTitleFieldName = 'field1';
     $targetDetailedFieldName = 'field2';
     $targetGridFieldName = 'field3';
     $extendConfig = new Config(new EntityConfigId('extend', self::SOURCE_CLASS));
     $extendConfig->set('relation', [$relationKey => []]);
     $extendFieldConfig = new Config(new FieldConfigId('extend', self::SOURCE_CLASS, $relationName, 'manyToMany'));
     $testFieldConfig = new Config(new FieldConfigId('test', self::SOURCE_CLASS, $relationName, 'manyToOne'));
     $expectedExtendFieldConfig = new Config($extendFieldConfig->getId());
     $expectedExtendFieldConfig->setValues(['owner' => ExtendScope::OWNER_CUSTOM, 'is_extend' => true, 'relation_key' => $relationKey, 'target_entity' => self::TARGET_CLASS, 'target_title' => [$targetTitleFieldName], 'target_detailed' => [$targetDetailedFieldName], 'target_grid' => [$targetGridFieldName]]);
     $expectedTestFieldConfig = new Config($testFieldConfig->getId());
     $expectedTestFieldConfig->setValues(['test_attr' => 123]);
     $fieldConfigModel = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Entity\\FieldConfigModel')->disableOriginalConstructor()->getMock();
     $this->configManager->expects($this->once())->method('hasConfigFieldModel')->with(self::SOURCE_CLASS, $relationName)->will($this->returnValue(true));
     $this->configManager->expects($this->never())->method('createConfigFieldModel');
     $this->configManager->expects($this->once())->method('getConfigFieldModel')->with(self::SOURCE_CLASS, $relationName)->will($this->returnValue($fieldConfigModel));
     $fieldConfigModel->expects($this->once())->method('getType')->will($this->returnValue('manyToMany'));
     $this->configManager->expects($this->never())->method('changeFieldType');
     $extendConfigProvider = $this->getConfigProviderMock();
     $extendConfigProvider->expects($this->once())->method('getConfig')->with(self::SOURCE_CLASS, $relationName)->will($this->returnValue($extendFieldConfig));
     $extendConfigProvider->expects($this->once())->method('persist')->with($this->identicalTo($extendFieldConfig));
     $testConfigProvider = $this->getConfigProviderMock();
     $testConfigProvider->expects($this->once())->method('getConfig')->with(self::SOURCE_CLASS, $relationName)->will($this->returnValue($testFieldConfig));
     $testConfigProvider->expects($this->once())->method('persist')->with($this->identicalTo($testFieldConfig));
     $this->configManager->expects($this->any())->method('getProvider')->will($this->returnValueMap([['extend', $extendConfigProvider], ['test', $testConfigProvider]]));
     $this->builder->addManyToManyRelation($extendConfig, self::TARGET_CLASS, $relationName, [$targetTitleFieldName], [$targetDetailedFieldName], [$targetGridFieldName], ['extend' => ['owner' => ExtendScope::OWNER_CUSTOM], 'test' => ['test_attr' => 123]]);
     $this->assertEquals($expectedExtendFieldConfig, $extendFieldConfig);
     $this->assertEquals($expectedTestFieldConfig, $testFieldConfig);
 }
开发者ID:northdakota,项目名称:platform,代码行数:35,代码来源:RelationBuilderTest.php

示例12: addEntityConfig

 /**
  * @param array  $values
  * @param string $className
  *
  * @return Config
  */
 protected function addEntityConfig($values = [], $className = 'Test\\SourceEntity')
 {
     $resultValues = ['owner' => ExtendScope::OWNER_CUSTOM, 'is_extend' => true, 'state' => ExtendScope::STATE_NEW, 'is_deleted' => false, 'upgradeable' => false, 'relation' => [], 'schema' => [], 'index' => []];
     if (!empty($values)) {
         $resultValues = array_merge($resultValues, $values);
     }
     $config = new Config(new EntityConfigId('extend', $className));
     $config->setValues($resultValues);
     $this->configs[null][] = $config;
     return $config;
 }
开发者ID:snorchel,项目名称:platform,代码行数:17,代码来源:RelationEntityConfigDumperExtensionTest.php

示例13: getExtendFieldConfig

 /**
  * @param string $entityClassName
  * @param string $fieldName
  * @param string $fieldType
  * @param mixed $values
  * @return Config
  */
 protected function getExtendFieldConfig($entityClassName, $fieldName, $fieldType, $values)
 {
     $extendFieldConfigId = new FieldConfigId('extend', $entityClassName, $fieldName, $fieldType);
     $extendFieldConfig = new Config($extendFieldConfigId);
     $extendFieldConfig->setValues($values);
     return $extendFieldConfig;
 }
开发者ID:sagikazarmark,项目名称:platform,代码行数:14,代码来源:EntityFieldProviderTest.php

示例14: getFieldConfig

 protected function getFieldConfig($fieldName, $fieldType, $values = [])
 {
     $fieldConfigId = new FieldConfigId('extend', CalendarPropertyProvider::CALENDAR_PROPERTY_CLASS, $fieldName, $fieldType);
     $fieldConfig = new Config($fieldConfigId);
     $fieldConfig->setValues($values);
     return $fieldConfig;
 }
开发者ID:northdakota,项目名称:platform,代码行数:7,代码来源:CalendarPropertyProviderTest.php

示例15: createEntityConfig

 /**
  * @param string $scope
  * @param string $className
  * @param array  $values
  * @return Config
  */
 protected function createEntityConfig($scope, $className, $values = [])
 {
     $config = new Config(new EntityConfigId($scope, $className));
     $config->setValues($values);
     return $config;
 }
开发者ID:snorchel,项目名称:platform,代码行数:12,代码来源:DictionaryVirtualFieldProviderTest.php


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