本文整理汇总了PHP中Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration::isDatasourceSkipAclApply方法的典型用法代码示例。如果您正苦于以下问题:PHP DatagridConfiguration::isDatasourceSkipAclApply方法的具体用法?PHP DatagridConfiguration::isDatasourceSkipAclApply怎么用?PHP DatagridConfiguration::isDatasourceSkipAclApply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration
的用法示例。
在下文中一共展示了DatagridConfiguration::isDatasourceSkipAclApply方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: visitDatasource
/**
* {@inheritDoc}
*/
public function visitDatasource(DatagridConfiguration $config, DatasourceInterface $datasource)
{
$defaultPerPage = $config->offsetGetByPath(ToolbarExtension::PAGER_DEFAULT_PER_PAGE_OPTION_PATH, 10);
if ($datasource instanceof OrmDatasource) {
$this->pager->setQueryBuilder($datasource->getQueryBuilder());
$this->pager->setSkipAclCheck($config->isDatasourceSkipAclApply());
$this->pager->setSkipCountWalker($config->offsetGetByPath(DatagridConfiguration::DATASOURCE_SKIP_COUNT_WALKER_PATH));
}
if ($config->offsetGetByPath(ToolbarExtension::PAGER_ONE_PAGE_OPTION_PATH, false) || $config->offsetGetByPath(ModeExtension::MODE_OPTION_PATH) === ModeExtension::MODE_CLIENT) {
// no restrictions applied
$this->pager->setPage(0);
$this->pager->setMaxPerPage(0);
} else {
$this->pager->setPage($this->getOr(PagerInterface::PAGE_PARAM, 1));
$this->pager->setMaxPerPage($this->getOr(PagerInterface::PER_PAGE_PARAM, $defaultPerPage));
}
$this->pager->init();
}
示例2: testIsDatasourceSkipAclApply
/**
* @param array $params
* @param bool $expected
* @dataProvider isDatasourceSkipAclApplyDataProvider
*/
public function testIsDatasourceSkipAclApply(array $params, $expected)
{
$this->configuration->merge($params);
$this->assertEquals($expected, $this->configuration->isDatasourceSkipAclApply());
}
示例3: visitResult
/**
* {@inheritdoc}
*/
public function visitResult(DatagridConfiguration $config, ResultsObject $result)
{
$onlyOnePage = !isset($result['options']['totalRecords']) || $result['options']['totalRecords'] === count($result['data']);
$totalData = [];
$totals = $config->offsetGetByPath(Configuration::TOTALS_PATH);
if (null !== $totals && !empty($result['data'])) {
foreach ($totals as $rowName => $rowConfig) {
if ($onlyOnePage && $rowConfig[Configuration::TOTALS_HIDE_IF_ONE_PAGE_KEY]) {
unset($totals[$rowName]);
continue;
}
$totalData[$rowName] = $this->getTotalData($rowConfig, $this->getData($result, $rowConfig['columns'], $rowConfig[Configuration::TOTALS_PER_PAGE_ROW_KEY], $config->isDatasourceSkipAclApply()));
}
}
$result->offsetAddToArray('options', ['totals' => $totalData]);
return $result;
}