Skip to content

Commit

Permalink
Adding support for the create action
Browse files Browse the repository at this point in the history
  • Loading branch information
mamazu committed Nov 1, 2022
1 parent 9067e27 commit d73396f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"require": {
"symplify/php-config-printer": "^9.4",
"symfony/yaml": "^5.3",
"symplify/php-config-printer": "^9.4.70",
"symfony/yaml": "^v5.4.14",
"sylius/grid-bundle": "dev-master",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5.26"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion src/ClassConfigConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Sylius\Bundle\GridBundle\Builder\Action\DeleteAction;
use Sylius\Bundle\GridBundle\Builder\Action\ShowAction;
use Sylius\Bundle\GridBundle\Builder\Action\UpdateAction;
use Sylius\Bundle\GridBundle\Builder\Action\CreateAction;
use Sylius\Bundle\GridBundle\Builder\Field\Field;
use Sylius\Bundle\GridBundle\Builder\Filter\Filter;
use Sylius\Bundle\GridBundle\Builder\GridBuilder;
Expand Down Expand Up @@ -116,6 +117,7 @@ public function handleGrid(string $gridName, array $gridConfiguration): array
GridBuilder::class,
Action::class,
ShowAction::class,
CreateAction::class,
UpdateAction::class,
DeleteAction::class,
DateTimeField::class,
Expand All @@ -141,7 +143,7 @@ public function handleGrid(string $gridName, array $gridConfiguration): array
$this->createStaticFunction('getResourceClass', $resourceClass),
],
],
[]
[
);
} else {
$className = $gridName;
Expand Down
3 changes: 3 additions & 0 deletions src/GridBuilderCalls.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public function convertActionsToFunctionParameters(array $actions): array
$field = [];
foreach ($actions as $actionName => $actionConfiguration) {
switch ($actionConfiguration['type']) {
case 'create':
$field[] = new Node\Expr\StaticCall(new Name('CreateAction'), 'create');
break;
case 'show':
$field[] = new Node\Expr\StaticCall(new Name('ShowAction'), 'create');
break;
Expand Down

0 comments on commit d73396f

Please sign in to comment.