本文整理汇总了PHP中Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration::offsetGet方法的典型用法代码示例。如果您正苦于以下问题:PHP DatagridConfiguration::offsetGet方法的具体用法?PHP DatagridConfiguration::offsetGet怎么用?PHP DatagridConfiguration::offsetGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration
的用法示例。
在下文中一共展示了DatagridConfiguration::offsetGet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
/**
* {@inheritdoc}
*/
public function configure(DatagridConfiguration $configuration)
{
$attributes = $configuration->offsetGet(self::SOURCE_KEY)[self::USEABLE_ATTRIBUTES_KEY];
$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);
$filters = $configuration->offsetGet(FilterConfiguration::FILTERS_KEY);
foreach ($displayedFilters as $attributeCode => $filterConfig) {
$filters['columns'][$attributeCode] = $filterConfig;
}
$configuration->offsetSet(FilterConfiguration::FILTERS_KEY, $filters);
}
示例2: buildReferenceData
/**
* Build references data
*
* @param DatasourceInterface $dataSource
* @param DatagridConfiguration $configuration
*/
protected function buildReferenceData(DatasourceInterface $dataSource, DatagridConfiguration $configuration)
{
$source = $configuration->offsetGet('source');
$qb = $dataSource->getQueryBuilder();
foreach ($configuration->offsetGet('columns') as $column => $config) {
$this->buildQueryBuilder($qb, $source, $column);
}
}
示例3:
function it_cannot_handle_misconfigured_attribute_type(DatagridConfiguration $configuration, $registry)
{
$attributes = ['sku' => ['code' => 'sku', 'label' => 'Sku', 'useableAsGridFilter' => 1, 'attributeType' => 'pim_catalog_identifier', 'sortOrder' => 2, 'group' => 'Foo', 'groupOrder' => 3], 'name' => ['code' => 'name', 'label' => 'Name', 'useableAsGridFilter' => 1, 'attributeType' => 'pim_catalog_text', 'sortOrder' => 4, 'group' => 'Bar', 'groupOrder' => 5]];
$attributesConf = [ContextConfigurator::USEABLE_ATTRIBUTES_KEY => $attributes];
$configuration->offsetGet(ContextConfigurator::SOURCE_KEY)->willReturn($attributesConf);
$registry->getConfiguration('pim_catalog_identifier')->willReturn(['filter' => ['identifier_config']]);
$registry->getConfiguration('pim_catalog_text')->willReturn([]);
$this->shouldThrow('\\LogicException')->duringConfigure($configuration);
}
示例4:
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);
}
示例5: getColumnsWithOrder
/**
* @param DatagridConfiguration $config
*
* @return array
*/
protected function getColumnsWithOrder(DatagridConfiguration $config)
{
$columnsData = $config->offsetGet(self::COLUMNS_PATH);
$columnsOrder = $this->columnsHelper->buildColumnsOrder($columnsData);
$columns = $this->applyColumnsOrderAndRender($columnsData, $columnsOrder);
return $columns;
}
示例6: getColumnsWithOrder
/**
* @param DatagridConfiguration $config
* @param bool $default
*
* @return array
*/
protected function getColumnsWithOrder(DatagridConfiguration $config, $default = false)
{
if (!$default) {
$params = $this->getParameters()->get(ParameterBag::ADDITIONAL_PARAMETERS, []);
$defaultGridView = $this->getDefaultGridView($config->getName());
if (isset($params['view']) && $defaultGridView && $params['view'] === $defaultGridView->getId()) {
return $defaultGridView->getColumnsData();
}
}
$columnsData = $config->offsetGet(self::COLUMNS_PATH);
$columnsOrder = $this->columnsHelper->buildColumnsOrder($columnsData);
$columns = $this->applyColumnsOrderAndRender($columnsData, $columnsOrder);
return $columns;
}