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


PHP DatagridConfiguration::offsetSetByPath方法代码示例

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


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

示例1: showAllAccountItems

 /**
  * @param DatagridConfiguration $config
  */
 protected function showAllAccountItems(DatagridConfiguration $config)
 {
     $config->offsetSetByPath(Builder::DATASOURCE_SKIP_ACL_CHECK, true);
     $user = $this->getUser();
     $where = $config->offsetGetByPath('[source][query][where]', ['and' => []]);
     $where['and'][] = sprintf('(%s.account = %d OR %s.accountUser = %d)', $this->entityAlias, $user->getAccount()->getId(), $this->entityAlias, $user->getId());
     $config->offsetSetByPath('[source][query][where]', $where);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:11,代码来源:AccountDatagridListener.php

示例2: removeExtraSorters

 /**
  * Remove extra sorters, ie, sorters defined in datagrid.yml but columns are not displayed
  */
 protected function removeExtraSorters()
 {
     $displayedColumns = $this->configuration->offsetGetByPath(sprintf('[%s]', FormatterConfiguration::COLUMNS_KEY));
     $columnsCodes = array_keys($displayedColumns);
     $sorters = $this->configuration->offsetGetByPath(sprintf('%s', OrmSorterConfiguration::COLUMNS_PATH));
     if (!empty($sorters)) {
         $sortersCodes = array_keys($sorters);
         foreach ($sortersCodes as $sorterCode) {
             if (!in_array($sorterCode, $columnsCodes)) {
                 unset($sorters[$sorterCode]);
             }
         }
         $this->configuration->offsetSetByPath(sprintf('%s', OrmSorterConfiguration::COLUMNS_PATH), $sorters);
     }
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:18,代码来源:SortersConfigurator.php

示例3:

 function it_applies_when_user_preference_is_filled_and_skip_disallowed($context, UserInterface $user, DatagridInterface $datagrid, Acceptor $acceptor, DatagridConfiguration $config, BuildAfter $event)
 {
     $config->offsetGet('filters')->willReturn(['columns' => ['foo' => [], 'baz' => [], 'scope' => [], 'locale' => []]]);
     $config->offsetSetByPath('[filters][columns][foo][enabled]', true)->shouldBeCalled();
     $config->offsetSetByPath('[filters][columns][baz][enabled]', false)->shouldBeCalled();
     $config->offsetSetByPath('[filters][columns][bar][enabled]', Argument::any())->shouldNotBeCalled();
     $config->offsetSetByPath('[filters][columns][scope][enabled]', Argument::any())->shouldNotBeCalled();
     $config->offsetSetByPath('[filters][columns][locale][enabled]', Argument::any())->shouldNotBeCalled();
     $user->getProductGridFilters()->willReturn(['foo', 'bar']);
     $context->getUser()->willReturn($user);
     $acceptor->getConfig()->willReturn($config);
     $datagrid->getAcceptor()->willReturn($acceptor);
     $event->getDatagrid()->willReturn($datagrid);
     $this->onBuildAfter($event);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:15,代码来源:ConfigureProductFiltersListenerSpec.php

示例4: configure

 /**
  * {@inheritdoc}
  */
 public function configure(DatagridConfiguration $configuration)
 {
     $path = sprintf(self::SOURCE_PATH, self::USEABLE_ATTRIBUTES_KEY);
     $attributes = $configuration->offsetGetByPath($path);
     $attributes = $attributes === null ? [] : $attributes;
     $displayedFilters = [];
     foreach ($attributes as $attributeCode => $attribute) {
         if (!$attribute['useableAsGridFilter']) {
             continue;
         }
         $attributeType = $attribute['attributeType'];
         $attributeTypeConf = $this->registry->getConfiguration($attributeType);
         if (!$attributeTypeConf || !isset($attributeTypeConf['filter'])) {
             throw new \LogicException(sprintf('Attribute type %s must be configured to allow grid filter on attribute %s', $attributeType, $attributeCode));
         }
         $filterConfig = $attributeTypeConf['filter'];
         $filterConfig = $filterConfig + [ProductFilterUtility::DATA_NAME_KEY => $attributeCode, 'label' => $attribute['label'], 'enabled' => AttributeTypes::IDENTIFIER === $attributeType, 'order' => $attribute['sortOrder'], 'group' => $attribute['group'], 'groupOrder' => $attribute['groupOrder']];
         if (AttributeTypes::METRIC === $attributeType) {
             $filterConfig['family'] = $attribute['metricFamily'];
         }
         $displayedFilters[$attributeCode] = $filterConfig;
     }
     $this->sortFilters($displayedFilters);
     foreach ($displayedFilters as $attributeCode => $filterConfig) {
         $configuration->offsetSetByPath(sprintf('%s[%s]', FilterConfiguration::COLUMNS_PATH, $attributeCode), $filterConfig);
     }
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:30,代码来源:FiltersConfigurator.php

示例5: processConfigs

 /**
  * {@inheritDoc}
  */
 public function processConfigs(DatagridConfiguration $config)
 {
     $options = $config->offsetGetByPath(self::TOOLBAR_OPTION_PATH, []);
     // validate configuration and pass default values back to config
     $configuration = $this->validateConfiguration(new Configuration($this->cm), ['toolbarOptions' => $options]);
     $config->offsetSetByPath(sprintf('%s[%s]', self::OPTIONS_PATH, 'toolbarOptions'), $configuration);
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:ToolbarExtension.php

示例6: processConfigs

 /**
  * {@inheritDoc}
  */
 public function processConfigs(DatagridConfiguration $config)
 {
     $filters = $config->offsetGetByPath(Configuration::FILTERS_PATH);
     // validate extension configuration and pass default values back to config
     $filtersNormalized = $this->validateConfiguration(new Configuration(array_keys($this->filters)), ['filters' => $filters]);
     // replace config values by normalized, extra keys passed directly
     $config->offsetSetByPath(Configuration::FILTERS_PATH, array_replace_recursive($filters, $filtersNormalized));
 }
开发者ID:Maksold,项目名称:platform,代码行数:11,代码来源:OrmFilterExtension.php

示例7: processConfigs

 /**
  * {@inheritdoc}
  */
 public function processConfigs(DatagridConfiguration $config)
 {
     $pagination = $config->offsetGetByPath(self::ENTITY_PAGINATION_PATH);
     if ($pagination !== null && !is_bool($pagination)) {
         throw new \LogicException('Entity pagination is not boolean');
     }
     $config->offsetSetByPath(self::ENTITY_PAGINATION_PATH, (bool) $pagination);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:11,代码来源:EntityPaginationExtension.php

示例8: processConfigs

 /**
  * {@inheritDoc}
  */
 public function processConfigs(DatagridConfiguration $config)
 {
     $totalRows = $this->validateConfiguration(new Configuration(), ['totals' => $config->offsetGetByPath(Configuration::TOTALS_PATH)]);
     if (!empty($totalRows)) {
         foreach ($totalRows as $rowName => $rowConfig) {
             $this->mergeTotals($totalRows, $rowName, $rowConfig, $config->getName());
         }
         $config->offsetSetByPath(Configuration::TOTALS_PATH, $totalRows);
     }
 }
开发者ID:gmoigneu,项目名称:platform,代码行数:13,代码来源:OrmTotalsExtension.php

示例9: addConfigElement

 /**
  * @param DatagridConfiguration $config
  * @param string $path
  * @param mixed $element
  * @param mixed $key
  */
 protected function addConfigElement(DatagridConfiguration $config, $path, $element, $key = null)
 {
     $select = $config->offsetGetByPath($path);
     if ($key) {
         $select[$key] = $element;
     } else {
         $select[] = $element;
     }
     $config->offsetSetByPath($path, $select);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:16,代码来源:DatagridListener.php

示例10: isApplicable

 /**
  * {@inheritDoc}
  */
 public function isApplicable(DatagridConfiguration $config)
 {
     // validate configuration and fill default values
     $options = $this->validateConfiguration(new Configuration(), ['export' => $config->offsetGetByPath(self::EXPORT_OPTION_PATH, false)]);
     // translate labels
     foreach ($options as &$option) {
         $option['label'] = $this->translator->trans($option['label']);
     }
     // push options back to config
     $config->offsetSetByPath(self::EXPORT_OPTION_PATH, $options);
     return !empty($options);
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:ExportExtension.php

示例11: it_configures_mass_actions

 public function it_configures_mass_actions(BuildBefore $event, DatagridConfiguration $datagridConfig, ActionInterface $indexAction, ActionFactory $actionFactory, ActionInterface $action1, ActionInterface $action2)
 {
     $action1->implement('Pim\\Bundle\\CustomEntityBundle\\Action\\GridActionInterface');
     $action2->implement('Pim\\Bundle\\CustomEntityBundle\\Action\\GridActionInterface');
     $actionFactory->getAction('entity', 'action1')->willReturn($action1);
     $actionFactory->getAction('entity', 'action2')->willReturn($action2);
     $action1->getGridActionOptions()->willReturn(['action1_key1' => 'action1_value1']);
     $datagridConfig->getName()->willReturn('entity');
     $indexAction->getMassActions()->willReturn(['action1', 'action2']);
     $indexAction->getRowActions()->willReturn([]);
     $indexAction->getOptions()->willReturn([]);
     $datagridConfig->offsetGetByPath('[extends]')->willReturn('custom_entity');
     $datagridConfig->offsetGetByPath('[properties]')->willReturn([]);
     $datagridConfig->offsetGetByPath('[actions]')->willReturn([]);
     $datagridConfig->offsetGetByPath('[source]')->willReturn([]);
     $datagridConfig->offsetGetByPath('[mass_actions]')->willReturn(['action2' => []]);
     $datagridConfig->offsetSetByPath("[source]", ["entity" => "entity_class", "type" => "pim_custom_entity"])->shouldBeCalled();
     $datagridConfig->offsetSetByPath("[actions]", [])->shouldBeCalled();
     $datagridConfig->offsetSetByPath("[properties]", ['id' => []])->shouldBeCalled();
     $datagridConfig->offsetSetByPath("[mass_actions]", ["action2" => [], "action1" => ["action1_key1" => "action1_value1"]])->shouldBeCalled();
     $this->buildBefore($event);
 }
开发者ID:antoineguigan,项目名称:CustomEntityBundle,代码行数:22,代码来源:ConfigureCustomEntityGridListenerSpec.php

示例12: addNewsletterSubscribers

 /**
  * @param DatagridConfiguration $config
  */
 protected function addNewsletterSubscribers(DatagridConfiguration $config)
 {
     $query = $config->offsetGetByPath('[source][query]', []);
     foreach ($query['select'] as &$field) {
         if ($field === 'c.id') {
             $field = 'DISTINCT ' . $field;
             break;
         }
     }
     $query['select'][] = "CASE WHEN\n                transport.isExtensionInstalled = true AND transport.extensionVersion IS NOT NULL\n            THEN (CASE WHEN newsletterSubscriberStatus.id = '1' THEN 'yes' ELSE 'no' END)\n            ELSE 'unknown'\n            END as isSubscriber";
     $query['join']['left'][] = ['join' => 'OroCRM\\Bundle\\MagentoBundle\\Entity\\MagentoSoapTransport', 'alias' => 'transport', 'conditionType' => 'WITH', 'condition' => 'channel.transport = transport'];
     $query['join']['left'][] = ['join' => 'c.newsletterSubscribers', 'alias' => 'newsletterSubscribers'];
     $query['join']['left'][] = ['join' => 'newsletterSubscribers.status', 'alias' => 'newsletterSubscriberStatus'];
     $config->offsetSetByPath('[source][query]', $query);
 }
开发者ID:heoffice,项目名称:crm,代码行数:18,代码来源:CustomerDataGridListener.php

示例13: extendConfiguration

 /**
  * @param DatagridConfiguration $configuration
  * @param string                $gridName
  *
  * @return DatagridConfiguration
  */
 public function extendConfiguration(DatagridConfiguration $configuration, $gridName)
 {
     $gridConfiguration = $this->configurationProvider->getConfiguration($gridName);
     $scopes = array_diff(array_keys($gridConfiguration->getIterator()->getArrayCopy()), ['name']);
     foreach ($scopes as $scope) {
         $path = sprintf('[%s]', $scope);
         $additionalParams = $gridConfiguration->offsetGetByPath($path);
         $baseParams = $configuration->offsetGetByPath($path, []);
         if (!is_array($additionalParams) || !is_array($baseParams)) {
             continue;
         }
         $configuration->offsetSetByPath($path, ArrayUtils::arrayMergeRecursiveDistinct($baseParams, $additionalParams));
     }
     return $configuration;
 }
开发者ID:dairdr,项目名称:crm,代码行数:21,代码来源:DataGridConfigurationHelper.php

示例14: extendConfiguration

 /**
  * @param DatagridConfiguration $configuration
  * @param string                $gridName
  *
  * @return DatagridConfiguration
  */
 public function extendConfiguration(DatagridConfiguration $configuration, $gridName)
 {
     $gridConfiguration = $this->configurationProvider->getConfiguration($gridName);
     $basicAlias = $configuration->offsetGetByPath('[source][query][from][0][alias]');
     foreach ($this->pathsToFix as $path) {
         $forFix = $gridConfiguration->offsetGetByPath($path);
         if ($forFix) {
             $gridConfiguration->offsetSetByPath($path, $this->fixMixinAlias($basicAlias, $forFix));
         }
     }
     $scopes = array_diff(array_keys($gridConfiguration->getIterator()->getArrayCopy()), ['name']);
     foreach ($scopes as $scope) {
         $path = sprintf('[%s]', $scope);
         $additionalParams = $gridConfiguration->offsetGetByPath($path);
         $baseParams = $configuration->offsetGetByPath($path, []);
         if (!is_array($additionalParams) || !is_array($baseParams)) {
             continue;
         }
         $configuration->offsetSetByPath($path, self::arrayMergeRecursiveAppendDistinct($baseParams, $additionalParams));
     }
     return $configuration;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:28,代码来源:MixinConfigurationHelper.php

示例15: addAttributesConfig

 /**
  * Inject attributes configurations in the datagrid configuration
  */
 protected function addAttributesConfig()
 {
     $attributes = $this->getAttributesConfig();
     $path = $this->getSourcePath(self::USEABLE_ATTRIBUTES_KEY);
     $this->configuration->offsetSetByPath($path, $attributes);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:9,代码来源:ContextConfigurator.php


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