本文整理汇总了PHP中Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration::createNamed方法的典型用法代码示例。如果您正苦于以下问题:PHP DatagridConfiguration::createNamed方法的具体用法?PHP DatagridConfiguration::createNamed怎么用?PHP DatagridConfiguration::createNamed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration
的用法示例。
在下文中一共展示了DatagridConfiguration::createNamed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfiguration
/**
* {@inheritDoc}
*/
public function getConfiguration($gridName)
{
if (!isset($this->rawConfiguration[$gridName])) {
throw new RuntimeException(sprintf('A configuration for "%s" datagrid was not found.', $gridName));
}
if (!isset($this->processedConfiguration[$gridName])) {
$config = $this->resolver->resolve($gridName, $this->rawConfiguration[$gridName]);
$this->processedConfiguration[$gridName] = $config;
}
return DatagridConfiguration::createNamed($gridName, $this->processedConfiguration[$gridName]);
}
示例2: testBuildAfter
public function testBuildAfter()
{
$config = DatagridConfiguration::createNamed(self::TEST_GRID_NAME, []);
$acceptor = new Acceptor();
$acceptor->setConfig($config);
$parameters = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datagrid\\ParameterBag');
$grid = new Datagrid(self::TEST_GRID_NAME, $config, $parameters);
$grid->setAcceptor($acceptor);
$qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->getMock();
$qb->expects($this->once())->method('getDQLPart')->with($this->equalTo('from'))->will($this->returnValue([new From(self::TEST_ENTITY_NAME, 'alias')]));
$datasourceMock = $this->getMockBuilder('Oro\\Bundle\\DataGridBundle\\Datasource\\Orm\\OrmDatasource')->disableOriginalConstructor()->getMock();
$datasourceMock->expects($this->any())->method('getQueryBuilder')->will($this->returnValue($qb));
$this->generator->expects($this->once())->method('generate')->with(self::TEST_ENTITY_NAME)->will($this->returnValue([]));
$grid->setDatasource($datasourceMock);
$event = new BuildAfter($grid);
$this->listener->buildAfter($event);
$this->assertContains('oronavigation/js/content/grid-builder', $config->offsetGetByPath(sprintf('%s[%s]', ToolbarExtension::OPTIONS_PATH, MetadataObject::REQUIRED_MODULES_KEY)), 'Should add require js module');
}
示例3: convert
/**
* Converts a query specified in $source parameter to a datagrid configuration
*
* @param string $gridName
* @param AbstractQueryDesigner $source
* @return DatagridConfiguration
*/
public function convert($gridName, AbstractQueryDesigner $source)
{
$this->config = DatagridConfiguration::createNamed($gridName, []);
$this->doConvert($source);
return $this->config;
}
示例4: buildProvider
/**
* @return array
*/
public function buildProvider()
{
$stubDatagridClass = 'Oro\\Bundle\\DataGridBundle\\Datagrid\\Datagrid';
$baseEventList = [['oro_datagrid.datagrid.build.pre', 'Oro\\Bundle\\DataGridBundle\\Event\\PreBuild'], ['oro_datagrid.datagrid.build.before', 'Oro\\Bundle\\DataGridBundle\\Event\\BuildBefore'], ['oro_datagrid.datagrid.build.after', 'Oro\\Bundle\\DataGridBundle\\Event\\BuildAfter']];
$extToAdd = $this->getMockForAbstractClass('Oro\\Bundle\\DataGridBundle\\Extension\\ExtensionVisitorInterface');
$extToAdd2 = $this->getMockForAbstractClass('Oro\\Bundle\\DataGridBundle\\Extension\\ExtensionVisitorInterface');
$extNotToAdd = $this->getMockForAbstractClass('Oro\\Bundle\\DataGridBundle\\Extension\\ExtensionVisitorInterface');
$extToAdd->expects($this->any())->method('isApplicable')->will($this->returnValue(true));
$extToAdd2->expects($this->any())->method('isApplicable')->will($this->returnValue(true));
$extNotToAdd->expects($this->any())->method('isApplicable')->will($this->returnValue(false));
return ['Base datagrid should be created without extensions' => [DatagridConfiguration::createNamed(self::TEST_DATAGRID_NAME, []), self::DEFAULT_DATAGRID_CLASS, $baseEventList, 0], 'Datagrid should be created as object type passed in config' => [DatagridConfiguration::createNamed(self::TEST_DATAGRID_NAME, ['options' => ['base_datagrid_class' => $stubDatagridClass]]), $stubDatagridClass, $baseEventList, 0], 'Extension passed check' => [DatagridConfiguration::createNamed(self::TEST_DATAGRID_NAME, []), self::DEFAULT_DATAGRID_CLASS, $baseEventList, 1, [$extToAdd, $extNotToAdd]], 'Both extensions passed check' => [DatagridConfiguration::createNamed(self::TEST_DATAGRID_NAME, []), self::DEFAULT_DATAGRID_CLASS, $baseEventList, 2, [$extToAdd, $extNotToAdd, $extToAdd2]]];
}
示例5: getDataGrid
/**
* @return \PHPUnit_Framework_MockObject_MockObject|DatagridInterface
*/
protected function getDataGrid()
{
$dataGrid = $this->getMockBuilder('Oro\\Bundle\\DataGridBundle\\Datagrid\\DatagridInterface')->getMockForAbstractClass();
$columnAliases = ['testField' => 'c1'];
$config = DatagridConfiguration::createNamed('test', []);
$config->offsetSetByPath(MarketingListProvider::DATAGRID_COLUMN_ALIASES_PATH, $columnAliases);
$dataGrid->expects($this->any())->method('getConfig')->will($this->returnValue($config));
return $dataGrid;
}