Skip to content

Commit e8fed9c

Browse files
committed
Upgrade EasyAdmin to 4.29
1 parent 0e95d2a commit e8fed9c

22 files changed

Lines changed: 935 additions & 1964 deletions

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Docker commands
2+
.PHONY: node-modules-install
3+
node-modules-install:
4+
docker compose run --rm --user 1000:1000 node yarn install --frozen-lockfile
5+
26
.PHONY: build-assets
37
build-assets:
48
docker compose run --rm --user 1000:1000 node yarn build

assets/js/app.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1 @@
11
import '../css/app.css';
2-
3-
import ConfirmationModal from './confirmation-modal';
4-
5-
document.addEventListener('DOMContentLoaded', () => {
6-
App.createConfirmationActionModal();
7-
});
8-
9-
const App = (() => {
10-
const createConfirmationActionModal = () => {
11-
const confirmationModal = new ConfirmationModal();
12-
document.querySelectorAll("[data-protung-easyadmin-plus-extension-modal-confirm-trigger='1']").forEach((action) => {
13-
confirmationModal.create(action);
14-
});
15-
};
16-
17-
return {
18-
createConfirmationActionModal: createConfirmationActionModal,
19-
};
20-
})();

assets/js/confirmation-modal.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"php": "~8.4.0 || ~8.5.0",
2828
"ext-dom": "*",
2929
"azjezz/psl": "^2.9.1 || ^3.0.0 || ^4.0.0",
30-
"easycorp/easyadmin-bundle": "~4.27.7",
30+
"easycorp/easyadmin-bundle": "~4.29.1",
3131
"symfony/asset": "^6.4 || ^7.4",
3232
"symfony/cache": "^6.4 || ^7.4",
3333
"symfony/config": "^6.4 || ^7.4",

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"devDependencies": {
3-
"@babel/core": "^7.28.5",
4-
"@babel/preset-env": "^7.28.5",
3+
"@babel/core": "^7.29.0",
4+
"@babel/preset-env": "^7.29.0",
55
"@popperjs/core": "^2.11.8",
66
"@symfony/webpack-encore": "^5.3.1",
7-
"webpack": "^5.103.0",
7+
"webpack": "^5.105.3",
88
"webpack-cli": "^6.0.1"
99
},
1010
"license": "MIT",

psalm.baseline.xml

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.14.3@d0b040a91f280f071c1abcb1b77ce3822058725a">
2+
<files psalm-version="6.15.1@28dc127af1b5aecd52314f6f645bafc10d0e11f9">
33
<file src="src/Controller/BaseCrudController.php">
44
<ArgumentTypeCoercion>
55
<code><![CDATA[$apply]]></code>
@@ -84,6 +84,9 @@
8484
<code><![CDATA[$entityDto->getPrimaryKeyValue()]]></code>
8585
<code><![CDATA[$field->getValue()]]></code>
8686
</MixedArgument>
87+
<RedundantConditionGivenDocblockType>
88+
<code><![CDATA[invariant]]></code>
89+
</RedundantConditionGivenDocblockType>
8790
</file>
8891
<file src="src/Form/DataTransformer/EntityFieldDataTransformer.php">
8992
<MissingTemplateParam>
@@ -108,57 +111,14 @@
108111
<code><![CDATA[$menuItemQueryString]]></code>
109112
</PossiblyFalseArgument>
110113
</file>
111-
<file src="src/Orm/EntityRepository.php">
112-
<ArgumentTypeCoercion>
113-
<code><![CDATA[$targetCrudControllerFqcn]]></code>
114-
</ArgumentTypeCoercion>
115-
<InvalidArrayAccess>
116-
<code><![CDATA[$fieldMapping['type']]]></code>
117-
<code><![CDATA[$fieldMapping['type']]]></code>
118-
</InvalidArrayAccess>
119-
<InvalidOperand>
120-
<code><![CDATA[0 + $queryTerm]]></code>
121-
</InvalidOperand>
122-
<MixedArgument>
123-
<code><![CDATA[$entityDto->getClassMetadata()->getAssociationMapping($sortProperty)['mappedBy']]]></code>
124-
<code><![CDATA[$entityFqcn]]></code>
125-
<code><![CDATA[$idClassName]]></code>
126-
</MixedArgument>
127-
<MixedArgumentTypeCoercion>
128-
<code><![CDATA[$submittedData]]></code>
129-
</MixedArgumentTypeCoercion>
130-
<MixedMethodCall>
131-
<code><![CDATA[getFqcn]]></code>
132-
</MixedMethodCall>
133-
<MixedOperand>
134-
<code><![CDATA[$associationSortProperty]]></code>
135-
</MixedOperand>
136-
<MixedReturnTypeCoercion>
137-
<code><![CDATA[$searchablePropertiesConfig]]></code>
138-
<code><![CDATA[array<array{
139-
* entity_name: string,
140-
* property_data_type: string,
141-
* property_name: string,
142-
* is_boolean: bool,
143-
* is_small_integer: bool,
144-
* is_integer: bool,
145-
* is_numeric: bool,
146-
* is_text: bool,
147-
* is_guid: bool,
148-
* is_ulid: bool,
149-
* is_json: bool,
150-
* }>]]></code>
151-
</MixedReturnTypeCoercion>
152-
<PossiblyNullReference>
153-
<code><![CDATA[getRequest]]></code>
154-
</PossiblyNullReference>
155-
<PossiblyUndefinedMethod>
156-
<code><![CDATA[getName]]></code>
157-
</PossiblyUndefinedMethod>
158-
<TypeDoesNotContainType>
159-
<code><![CDATA[is_array($fieldMapping)]]></code>
160-
<code><![CDATA[is_array($fieldMapping)]]></code>
161-
</TypeDoesNotContainType>
114+
<file src="src/Orm/EntityPaginator.php">
115+
<TooManyArguments>
116+
<code><![CDATA[getResultsAsJson]]></code>
117+
<code><![CDATA[getResultsAsJson]]></code>
118+
<code><![CDATA[getResultsAsJson]]></code>
119+
<code><![CDATA[getResultsAsJson]]></code>
120+
<code><![CDATA[getResultsAsJson]]></code>
121+
</TooManyArguments>
162122
</file>
163123
<file src="src/Test/Controller/AdminControllerWebTestCase.php">
164124
<InvalidArgument>

src/Controller/BaseController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Protung\EasyAdminPlusBundle\Controller;
66

7+
use EasyCorp\Bundle\EasyAdminBundle\Twig\Component\Option\AlertVariant;
78
use Override;
89
use Psl\Dict;
910
use Stringable;
@@ -17,20 +18,20 @@ abstract class BaseController extends AbstractController
1718
{
1819
protected function addFlashMessageSuccess(string|Stringable|TranslatableInterface $message): void
1920
{
20-
$this->addFlashMessage(Flash::Success, $message);
21+
$this->addFlashMessage(AlertVariant::Success, $message);
2122
}
2223

2324
protected function addFlashMessageWarning(string|Stringable|TranslatableInterface $message): void
2425
{
25-
$this->addFlashMessage(Flash::Warning, $message);
26+
$this->addFlashMessage(AlertVariant::Warning, $message);
2627
}
2728

2829
protected function addFlashMessageError(string|Stringable|TranslatableInterface $message): void
2930
{
30-
$this->addFlashMessage(Flash::Error, $message);
31+
$this->addFlashMessage(AlertVariant::Error, $message);
3132
}
3233

33-
protected function addFlashMessage(Flash $type, string|Stringable|TranslatableInterface $message): void
34+
protected function addFlashMessage(AlertVariant $type, string|Stringable|TranslatableInterface $message): void
3435
{
3536
// We check against TranslatableInterface because the implementation might be Stringable as well.
3637
if (! $message instanceof TranslatableInterface) {

src/Controller/BaseCrudController.php

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use EasyCorp\Bundle\EasyAdminBundle\Dto\ActionDto;
1212
use EasyCorp\Bundle\EasyAdminBundle\Dto\ActionGroupDto;
1313
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
14+
use EasyCorp\Bundle\EasyAdminBundle\Twig\Component\Option\AlertVariant;
1415
use Override;
1516
use Psl\Dict;
1617
use Psl\Iter;
@@ -29,9 +30,6 @@
2930
*/
3031
abstract class BaseCrudController extends AbstractCrudController
3132
{
32-
protected const string FIELD_SORT_ASC = 'ASC';
33-
protected const string FIELD_SORT_DESC = 'DESC';
34-
3533
/**
3634
* Calling this method will disable all standard actions.
3735
*/
@@ -97,24 +95,6 @@ final protected function applyToAllActions(Actions $actions, callable $apply): A
9795
return $actions;
9896
}
9997

100-
protected function addConfirmationForAction(
101-
Action $action,
102-
string|Stringable|TranslatableInterface $title,
103-
string|Stringable|TranslatableInterface $description,
104-
): Action {
105-
$action
106-
->getAsDto()
107-
->addHtmlAttributes(
108-
[
109-
'data-protung-easyadmin-plus-extension-modal-confirm-trigger' => '1',
110-
'data-protung-easyadmin-plus-extension-modal-confirm-title' => $this->translate($title),
111-
'data-protung-easyadmin-plus-extension-modal-confirm-description' => $this->translate($description),
112-
],
113-
);
114-
115-
return $action;
116-
}
117-
11898
/**
11999
* @return AdminContext<TEntity>
120100
*/
@@ -130,20 +110,20 @@ protected function currentAdminContext(): AdminContext
130110

131111
protected function addFlashMessageSuccess(string|Stringable|TranslatableInterface $message): void
132112
{
133-
$this->addFlashMessage(Flash::Success, $message);
113+
$this->addFlashMessage(AlertVariant::Success, $message);
134114
}
135115

136116
protected function addFlashMessageWarning(string|Stringable|TranslatableInterface $message): void
137117
{
138-
$this->addFlashMessage(Flash::Warning, $message);
118+
$this->addFlashMessage(AlertVariant::Warning, $message);
139119
}
140120

141121
protected function addFlashMessageError(string|Stringable|TranslatableInterface $message): void
142122
{
143-
$this->addFlashMessage(Flash::Error, $message);
123+
$this->addFlashMessage(AlertVariant::Error, $message);
144124
}
145125

146-
protected function addFlashMessage(Flash $type, string|Stringable|TranslatableInterface $message): void
126+
protected function addFlashMessage(AlertVariant $type, string|Stringable|TranslatableInterface $message): void
147127
{
148128
$this->addFlash($type->value, $this->translate($message));
149129
}

src/Controller/BaseCrudDtoController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function edit(AdminContext $context): KeyValueStore|Response
115115
throw new InsufficientEntityPermissionException($context);
116116
}
117117

118-
$this->container->get(FieldFactory::class)->processFields($context->getEntity(), FieldCollection::new($this->configureFields(Crud::PAGE_EDIT)), Crud::PAGE_EDIT);
118+
$this->container->get(FieldFactory::class)->processFields($context->getEntity(), new FieldCollection($this->configureFields(Crud::PAGE_EDIT)), Crud::PAGE_EDIT);
119119
$context->getCrud()->setFieldAssets($this->getFieldAssets($context->getEntity()->getFields()));
120120
$this->container->get(ActionFactory::class)->processEntityActions($context->getEntity(), $context->getCrud()->getActionsConfig());
121121
/** @var TDto $dto */
@@ -129,9 +129,9 @@ public function edit(AdminContext $context): KeyValueStore|Response
129129
if (!$this->isCsrfTokenValid(BooleanField::CSRF_TOKEN_NAME, $context->getRequest()->query->get('csrfToken'))) {
130130
if (class_exists(InvalidCsrfTokenException::class)) {
131131
throw new InvalidCsrfTokenException();
132-
} else {
133-
return new Response('Invalid CSRF token.', 400);
134132
}
133+
134+
return new Response('Invalid CSRF token.', 400);
135135
}
136136

137137
$fieldName = $context->getRequest()->query->get('fieldName');
@@ -218,7 +218,7 @@ public function new(AdminContext $context): KeyValueStore|Response
218218

219219
$context->getEntity()->setInstance(null);
220220
$context->getEntity()->setInstance($this->createDto());
221-
$this->container->get(FieldFactory::class)->processFields($context->getEntity(), FieldCollection::new($this->configureFields(Crud::PAGE_NEW)), Crud::PAGE_NEW);
221+
$this->container->get(FieldFactory::class)->processFields($context->getEntity(), new FieldCollection($this->configureFields(Crud::PAGE_NEW)), Crud::PAGE_NEW);
222222
$context->getCrud()->setFieldAssets($this->getFieldAssets($context->getEntity()->getFields()));
223223
$this->container->get(ActionFactory::class)->processEntityActions($context->getEntity(), $context->getCrud()->getActionsConfig());
224224

src/Controller/Flash.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)