Skip to content

Commit

Permalink
Merge branch 'hotfix/4.1.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
pfilsx committed Nov 16, 2019
2 parents 4cc1eaa + 33cfc9e commit ad2302a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/Grid/AbstractGridType.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@ abstract class AbstractGridType
* @var DataGridServiceContainer
*/
protected $container;
/**
* @var array
*/
protected $params;

/**
* AbstractGridType constructor.
* @param DataGridServiceContainer $container
* @param array $params
*/
public function __construct(DataGridServiceContainer $container)
public function __construct(DataGridServiceContainer $container, array $params = [])
{
$this->container = $container;
$this->params = $params;
}

public abstract function buildGrid(DataGridBuilderInterface $builder): void;
Expand Down
4 changes: 2 additions & 2 deletions src/Grid/DataGridFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ public function __construct(DataGridServiceContainer $container, ConfigurationCo
}


public function createGrid(string $gridType, $dataSource): DataGridInterface
public function createGrid(string $gridType, $dataSource, array $params = []): DataGridInterface
{
if (!is_subclass_of($gridType, AbstractGridType::class)) {
throw new InvalidArgumentException('Expected subclass of ' . AbstractGridType::class);
}
$provider = DataProvider::create($dataSource, $this->container->getDoctrine());

/** @var AbstractGridType $type */
$gridType = new $gridType($this->container);
$gridType = new $gridType($this->container, $params);


return new DataGrid($gridType, $provider, $this->defaultConfiguration, $this->container);
Expand Down
3 changes: 1 addition & 2 deletions tests/columns/ImageColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void
'alt' => function () {
return 'Test alt';
},
'noImageMessage' => 'Empty',
'emptyValue' => 'Empty',
'template' => $this->template
]);
}
Expand All @@ -49,7 +49,6 @@ public function testGetAlt(): void

public function testGetNoImageMessage(): void
{
$this->assertEquals('Empty', $this->testColumn->getNoImageMessage());
$entity = new class
{
public function getTestAttribute()
Expand Down

0 comments on commit ad2302a

Please sign in to comment.