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


PHP DatagridConfiguration::offsetGetByPath方法代码示例

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


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

示例1: isApplicable

 /**
  * @param DatagridConfiguration $config
  *
  * @return bool
  */
 public function isApplicable(DatagridConfiguration $config)
 {
     $columns = $config->offsetGetByPath(Configuration::COLUMNS_PATH);
     $type = $config->offsetGetByPath(Builder::DATASOURCE_TYPE_PATH);
     $isApplicable = ($type == CombinedAuditDatasource::TYPE || $type == CombinedUsersDatasource::TYPE) && is_array($columns);
     return $isApplicable;
 }
开发者ID:gitter-badger,项目名称:diamantedesk-application,代码行数:12,代码来源:CombinedDatasourceSorterExtension.php

示例2: let

 function let(DatagridConfiguration $configuration, ConfigurationRegistry $registry, ProductManager $manager)
 {
     $attributes = ['sku' => ['code' => 'sku', 'attributeType' => 'pim_catalog_identifier'], 'name' => ['code' => 'name', 'attributeType' => 'pim_catalog_text']];
     $configuration->offsetGetByPath(sprintf('[source][%s]', ContextConfigurator::USEABLE_ATTRIBUTES_KEY))->willReturn($attributes);
     $configuration->offsetGetByPath(sprintf('[%s]', FormatterConfiguration::COLUMNS_KEY))->willReturn(['family' => ['family_config'], 'sku' => [], 'name' => []]);
     $registry->getConfiguration('pim_catalog_identifier')->willReturn(['column' => ['identifier_config'], 'sorter' => 'flexible_field']);
     $this->beConstructedWith($registry, $manager);
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:8,代码来源:SortersConfiguratorSpec.php

示例3: isApplicable

 /**
  * {@inheritDoc}
  */
 public function isApplicable(DatagridConfiguration $config)
 {
     $filters = $config->offsetGetByPath(Configuration::COLUMNS_PATH);
     if ($filters === null) {
         return false;
     }
     $type = $config->offsetGetByPath(Builder::DATASOURCE_TYPE_PATH);
     return $type == CombinedUsersDatasource::TYPE || $type == CombinedAuditDatasource::TYPE;
 }
开发者ID:gitter-badger,项目名称:diamantedesk-application,代码行数:12,代码来源:CombinedDatasourceFilterExtension.php

示例4: apply

 /**
  * {@inheritdoc}
  */
 public function apply(DatasourceInterface $datasource, DatagridConfiguration $configuration)
 {
     $qb = $datasource->getQueryBuilder();
     $joinAlias = 'selectCompleteness';
     $util = new CompletenessJoin($qb);
     $locale = $configuration->offsetGetByPath('[source][locale_code]');
     $scope = $configuration->offsetGetByPath('[source][scope_code]');
     $util->addJoins($joinAlias, $locale, $scope);
     $qb->addSelect($joinAlias . '.ratio AS ratio');
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:13,代码来源:CompletenessSelector.php

示例5: testVisitMetadata

 public function testVisitMetadata()
 {
     $metadata = MetadataObject::create([]);
     $this->extension->visitMetadata($this->config, $metadata);
     $totalsData = $metadata->offsetGet('state');
     $initialTotalsData = $metadata->offsetGet('initialState');
     $this->assertEquals($totalsData, $initialTotalsData);
     $this->assertEquals($this->config->offsetGetByPath(Configuration::TOTALS_PATH), $totalsData['totals']);
     $this->assertEquals('orodatagrid/js/totals-builder', $metadata->offsetGet('requireJSModules')[0]);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:10,代码来源:OrmTotalsExtensionTest.php

示例6: getEntity

 /**
  * @param DatagridConfiguration $config
  *
  * @return null|string
  */
 protected function getEntity(DatagridConfiguration $config)
 {
     $entityClassName = $config->offsetGetByPath(self::GRID_EXTEND_ENTITY_PATH);
     if (!$entityClassName) {
         $from = $config->offsetGetByPath(self::GRID_FROM_PATH);
         if (!$from) {
             return null;
         }
         $entityClassName = $this->entityClassResolver->getEntityClass($from[0]['table']);
     }
     return $entityClassName;
 }
开发者ID:antrampa,项目名称:platform,代码行数:17,代码来源:TagsGridListener.php

示例7: isApplicable

 /**
  * {@inheritDoc}
  */
 public function isApplicable(DatagridConfiguration $config)
 {
     if ($config->offsetGetByPath(Builder::DATASOURCE_TYPE_PATH) !== OrmDatasource::TYPE) {
         return false;
     }
     if (!$config->offsetGetByPath(self::OPTIONS_MIXIN_PATH, false)) {
         return false;
     }
     $segmentId = $this->segmentHelper->getSegmentIdByGridName($config->offsetGetByPath('[name]'));
     if (!$segmentId) {
         return false;
     }
     return (bool) $this->segmentHelper->getMarketingListBySegment($segmentId);
 }
开发者ID:dairdr,项目名称:crm,代码行数:17,代码来源:MarketingListExtension.php

示例8: visitDatasource

 /**
  * {@inheritdoc}
  */
 public function visitDatasource(DatagridConfiguration $config, DatasourceInterface $datasource)
 {
     $gridName = $config->offsetGetByPath(self::NAME_PATH);
     $parametersKey = md5(json_encode($this->parameters->all()));
     if (!empty($this->appliedFor[$gridName . $parametersKey])) {
         return;
     }
     /** @var QueryBuilder $qb */
     $qb = $datasource->getQueryBuilder();
     $ds = new GroupingOrmFilterDatasourceAdapter($qb);
     $filters = $config->offsetGetByPath('[source][query_config][filters]');
     $this->restrictionBuilder->buildRestrictions($filters, $ds);
     $this->appliedFor[$gridName . $parametersKey] = true;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:17,代码来源:OrmDatasourceExtension.php

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

示例10: applyACL

 /**
  * Add user limitation
  *
  * @param DatagridConfiguration $config
  * @param string                $accessLevel
  * @param User                  $user
  * @param Organization          $organization
  *
  * @throws \Exception
  */
 protected function applyACL(DatagridConfiguration $config, $accessLevel, User $user, Organization $organization)
 {
     $where = $config->offsetGetByPath('[source][query][where][and]', []);
     /** todo: refactor this check usages */
     if ($accessLevel == AccessLevel::BASIC_LEVEL) {
         $where = array_merge($where, ['u.id = ' . $user->getId()]);
     } elseif ($accessLevel == AccessLevel::GLOBAL_LEVEL) {
         $leftJoins = $config->offsetGetByPath('[source][query][join][inner]', []);
         $leftJoins[] = ['join' => 'u.organizations', 'alias' => 'org'];
         $config->offsetSetByPath('[source][query][join][inner]', $leftJoins);
         $where = array_merge($where, ['org.id in (' . $organization->getId() . ')']);
     } elseif ($accessLevel !== AccessLevel::SYSTEM_LEVEL) {
         $resultBuIds = [];
         if ($accessLevel == AccessLevel::LOCAL_LEVEL) {
             $resultBuIds = $this->treeProvider->getTree()->getUserBusinessUnitIds($user->getId(), $organization->getId());
         } elseif ($accessLevel == AccessLevel::DEEP_LEVEL) {
             $resultBuIds = $this->treeProvider->getTree()->getUserSubordinateBusinessUnitIds($user->getId(), $organization->getId());
         }
         $leftJoins = $config->offsetGetByPath('[source][query][join][inner]', []);
         $leftJoins[] = ['join' => 'u.businessUnits', 'alias' => 'bu'];
         $config->offsetSetByPath('[source][query][join][inner]', $leftJoins);
         $where = array_merge($where, ['bu.id in (' . implode(', ', $resultBuIds) . ')']);
     }
     if (count($where)) {
         $config->offsetSetByPath('[source][query][where][and]', $where);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:37,代码来源:OwnerUserGridListener.php

示例11: visitDatasource

 /**
  * {@inheritDoc}
  */
 public function visitDatasource(DatagridConfiguration $config, DatasourceInterface $datasource)
 {
     $entityName = $config->offsetGetByPath(self::EXTEND_ENTITY_CONFIG_PATH);
     $fields = $this->getDynamicFields($entityName);
     if ($datasource instanceof OrmDatasource && !empty($fields)) {
         /** @var QueryBuilder $qb */
         $qb = $datasource->getQueryBuilder();
         $fromParts = $qb->getDQLPart('from');
         $alias = false;
         foreach ($fromParts as $fromPart) {
             if ($fromPart->getFrom() == $entityName) {
                 $alias = $fromPart->getAlias();
             }
         }
         if ($alias === false) {
             // add entity if it not exists in from clause
             $alias = ExtendConfigDumper::FIELD_PREFIX . 'o';
             $qb->from($entityName, $alias);
         }
         foreach ($fields as $field) {
             $fn = ExtendConfigDumper::FIELD_PREFIX . $field->getFieldName();
             $qb->addSelect(sprintf('%s.%s', $alias, $fn));
             // set real "data name" for filters and sorters
             $config->offsetSetByPath(sprintf('%s[%s][%s]', OrmSorterConfiguration::COLUMNS_PATH, $fn, PropertyInterface::DATA_NAME_KEY), sprintf('%s.%s', $alias, $fn));
             $config->offsetSetByPath(sprintf('%s[%s][%s]', FilterConfiguration::COLUMNS_PATH, $fn, FilterUtility::DATA_NAME_KEY), sprintf('%s.%s', $alias, $fn));
         }
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:31,代码来源:ExtendExtension.php

示例12: let

 function let(DatagridConfiguration $configuration, ConfigurationRegistry $registry)
 {
     $registry->getConfiguration('pim_catalog_identifier')->willReturn(['column' => ['identifier_config']]);
     $registry->getConfiguration('pim_catalog_text')->willReturn(['column' => ['text_config']]);
     $configuration->offsetGetByPath(sprintf('[%s]', FormatterConfiguration::COLUMNS_KEY))->willReturn(['family' => ['family_config']]);
     $this->beConstructedWith($registry);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:7,代码来源:ColumnsConfiguratorSpec.php

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

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

示例15: getEntityRootAlias

 /**
  * @param DatagridConfiguration $config
  *
  * @return null
  */
 public function getEntityRootAlias(DatagridConfiguration $config)
 {
     $from = $config->offsetGetByPath('[source][query][from]');
     if ($from) {
         return $from[0]['alias'];
     }
     return null;
 }
开发者ID:ramunasd,项目名称:platform,代码行数:13,代码来源:GridConfigurationHelper.php


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