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


PHP Config::get方法代码示例

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


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

示例1: 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

示例2: testConfigGet

 public function testConfigGet()
 {
     $config = new Config(new EntityConfigId('test', 'Entity1'), ['attr' => 'val', 'null_attr' => null]);
     self::assertBenchmark(__METHOD__, 0.05, function () use($config) {
         $config->get('attr');
         $config->get('null_attr');
         $config->get('undefined_attr');
     });
 }
开发者ID:ramunasd,项目名称:platform,代码行数:9,代码来源:ConfigManagerPerformanceTest.php

示例3: preSubmitData

 public function preSubmitData(FormEvent $event)
 {
     $form = $event->getForm();
     $data = $event->getData();
     if (!$data) {
         $data = $form->getParent()->getData();
     }
     if ($this->config->get('owner') === ExtendScope::OWNER_CUSTOM) {
         $targetEntity = $this->getArrayValue($data, 'target_entity');
         $relationType = $this->config->getId()->getFieldType();
         if ($relationType == 'manyToOne') {
             $this->addTargetField($form, 'target_field', $targetEntity, $this->getArrayValue($data, 'target_field'));
         } else {
             $this->addTargetField($form, 'target_grid', $targetEntity, $this->getArrayValue($data, 'target_grid'), 'Related entity data fields', true);
             $this->addTargetField($form, 'target_title', $targetEntity, $this->getArrayValue($data, 'target_title'), 'Related entity info title', true);
             $this->addTargetField($form, 'target_detailed', $targetEntity, $this->getArrayValue($data, 'target_detailed'), 'Related entity detailed', true);
         }
     }
     if ($event->getName() == FormEvents::PRE_SUBMIT) {
         $form->getParent()->setData(array_merge($form->getParent()->getData(), $data));
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:22,代码来源:RelationType.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: checkAvailability

 /**
  * @param Config $extendConfig
  *
  * @return bool
  */
 protected function checkAvailability(Config $extendConfig)
 {
     return $extendConfig->is('is_extend') && $extendConfig->get('owner') == ExtendScope::OWNER_CUSTOM && $extendConfig->in('state', [ExtendScope::STATE_ACTIVE, ExtendScope::STATE_UPDATE]);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:9,代码来源:NavigationListener.php

示例6: isApplicable

 /**
  * @param  Config $entityConfig
  * @param  string $relationKey
  * @return bool
  */
 protected function isApplicable($entityConfig, $relationKey)
 {
     return $entityConfig->has('relation') && (!isset($entityConfig->get('relation')[$relationKey]) || $entityConfig->get('relation')[$relationKey]['assign'] === false);
 }
开发者ID:xamin123,项目名称:platform,代码行数:9,代码来源:FileConfigType.php

示例7: createTargetRelation

 protected function createTargetRelation(Config $fieldConfig, $relationKey)
 {
     $selfEntityClass = $fieldConfig->getId()->getClassName();
     $targetEntityClass = $fieldConfig->get('target_entity');
     $selfConfig = $this->extendConfigProvider->getConfig($selfEntityClass);
     $selfRelations = $selfConfig->get('relation');
     $selfRelationConfig =& $selfRelations[$relationKey];
     $selfRelationConfig['field_id'] = $fieldConfig;
     $targetConfig = $this->extendConfigProvider->getConfig($targetEntityClass);
     $targetRelations = $targetConfig->get('relation');
     $targetRelationConfig =& $targetRelations[$relationKey];
     $targetRelationConfig['target_field_id'] = $fieldConfig;
     $selfConfig->set('relation', $selfRelations);
     $targetConfig->set('relation', $targetRelations);
     $this->extendConfigProvider->persist($targetConfig);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:16,代码来源:ConfigSubscriber.php


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