From a6490009a6cb11c1b8a63c6a444c33aa8e8175f8 Mon Sep 17 00:00:00 2001 From: Sebastian Riquelme Date: Wed, 3 Jun 2026 21:24:20 +0000 Subject: [PATCH] chore: migrate to OroCommerce 7.0 / Symfony 7 / PHP 8.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Routing\Annotation\Route (Doctrine annotations namespace) migrated to Routing\Attribute\Route (native PHP attributes), required since Symfony 7 removed the annotation loader. InlineClassRoutePrefixRector (detected by oro/upgrade-toolkit oro-70 set): the class-level #[Route('/ajax')] prefix on FavoriteButtonAjaxController must be inlined into each method route to comply with Symfony 7 conventions. Dead code removed in FavoriteDatagridListener: $repo was assigned but never read — $favoriteRepo performed the same lookup two lines below. Dev dependencies updated for Symfony 7 / PHP 8.5 compatibility: - grumphp ^1.5 → ^2.10 (symfony/yaml ~5.x||~6.x conflict with Oro 7.0) - phpspec dropped (no specs exist; package does not support PHP 8.5) - phpstan ^1.5 → ^2.0 - php-cs-fixer ~3.57.2 → ^3.57 (3.57.x does not support PHP 8.5) - .php-cs-fixer.cache added to .gitignore phpstan 2.x parses @SuppressWarnings(PHPMD.*) as PHPDoc and rejects it; suppressed via phpDoc.parseError identifier in phpstan.neon since these annotations are PHPMD-only and cannot be changed without breaking PHPMD. --- .gitignore | 2 +- README.md | 4 ++-- composer.json | 11 +++++------ ruleset/phpstan.neon | 4 ++-- .../Frontend/FavoriteButtonAjaxController.php | 7 +++---- .../Controller/Frontend/FavoriteController.php | 2 +- .../EventListener/FavoriteDatagridListener.php | 2 -- .../FrontendProductFavoriteDatagridListener.php | 2 +- .../Migrations/Schema/v1_1/AddSerializeDataColumn.php | 2 +- .../FavoriteBundle/Resources/config/oro/routing.yml | 4 ++-- 10 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index 16bc576..50bc37d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /.idea /vendor .php_cs.cache -/composer.lock \ No newline at end of file +/composer.lock.php-cs-fixer.cache diff --git a/README.md b/README.md index d63b186..66570dc 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ This plugin allows you to save products as favorite in OroCommerce | | Version | | :--- |:--------| -| PHP | 8.4 | -| OroCommerce | 6.1.* | +| PHP | 8.5 | +| OroCommerce | 7.0.* | ## Installation diff --git a/composer.json b/composer.json index 12d938c..ede64f3 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,8 @@ "exclude-from-classmap": ["/Tests/"] }, "require": { - "php": "~8.4.0", - "oro/commerce": "6.1.*" + "php": "~8.5.0", + "oro/commerce": "7.0.*" }, "repositories": { "oro": { @@ -32,12 +32,11 @@ "prefer-stable": true, "require-dev": { "enlightn/security-checker": "^1.9", - "friendsofphp/php-cs-fixer": "~3.57.2", + "friendsofphp/php-cs-fixer": "^3.57", "php-parallel-lint/php-parallel-lint": "^1.3", "phpmd/phpmd": "~2.15.0", - "phpro/grumphp": "^1.5", - "phpspec/phpspec": "^7.2", - "phpstan/phpstan": "^1.5" + "phpro/grumphp": "^2.10.0", + "phpstan/phpstan": "^2.0" }, "config": { "sort-packages": true, diff --git a/ruleset/phpstan.neon b/ruleset/phpstan.neon index 18b0548..a9fcf5c 100644 --- a/ruleset/phpstan.neon +++ b/ruleset/phpstan.neon @@ -1,7 +1,7 @@ parameters: level: 4 reportUnmatchedIgnoredErrors: false - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false + ignoreErrors: + - identifier: phpDoc.parseError bootstrapFiles: - ../vendor/autoload.php \ No newline at end of file diff --git a/src/Synolia/Bundle/FavoriteBundle/Controller/Frontend/FavoriteButtonAjaxController.php b/src/Synolia/Bundle/FavoriteBundle/Controller/Frontend/FavoriteButtonAjaxController.php index 003967d..fe6f342 100644 --- a/src/Synolia/Bundle/FavoriteBundle/Controller/Frontend/FavoriteButtonAjaxController.php +++ b/src/Synolia/Bundle/FavoriteBundle/Controller/Frontend/FavoriteButtonAjaxController.php @@ -9,14 +9,13 @@ use Oro\Bundle\SecurityBundle\Authentication\TokenAccessorInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; use Synolia\Bundle\FavoriteBundle\Handler\FavoriteButtonAjaxHandler; -#[Route('/ajax', options: ["expose"=>true])] - +#[Route(options: ["expose"=>true])] class FavoriteButtonAjaxController extends AbstractController { - #[Route('/update/{id}', name: 'synolia_favorite_button_ajax_update', requirements: ['id' => '\d+'], methods: ['POST'])] + #[Route('/ajax/update/{id}', name: 'synolia_favorite_button_ajax_update', requirements: ['id' => '\d+'], methods: ['POST'])] public function updateAction( Product $product, TokenAccessorInterface $tokenAccessor, diff --git a/src/Synolia/Bundle/FavoriteBundle/Controller/Frontend/FavoriteController.php b/src/Synolia/Bundle/FavoriteBundle/Controller/Frontend/FavoriteController.php index dc99821..3076abb 100644 --- a/src/Synolia/Bundle/FavoriteBundle/Controller/Frontend/FavoriteController.php +++ b/src/Synolia/Bundle/FavoriteBundle/Controller/Frontend/FavoriteController.php @@ -7,7 +7,7 @@ use Oro\Bundle\LayoutBundle\Attribute\Layout; use Oro\Bundle\SecurityBundle\Attribute\Acl; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Attribute\Route; use Synolia\Bundle\FavoriteBundle\Entity\Favorite; class FavoriteController extends AbstractController diff --git a/src/Synolia/Bundle/FavoriteBundle/EventListener/FavoriteDatagridListener.php b/src/Synolia/Bundle/FavoriteBundle/EventListener/FavoriteDatagridListener.php index 89c69a8..3d6aa39 100644 --- a/src/Synolia/Bundle/FavoriteBundle/EventListener/FavoriteDatagridListener.php +++ b/src/Synolia/Bundle/FavoriteBundle/EventListener/FavoriteDatagridListener.php @@ -35,8 +35,6 @@ public function onBuildAfter(BuildAfter $event): void return; } - /** @var FavoriteRepository $repo */ - $repo = $this->entityManager->getRepository(Favorite::class); $user = $this->tokenAccessor->getUser(); $organization = $this->tokenAccessor->getOrganization(); $favProductIds = []; diff --git a/src/Synolia/Bundle/FavoriteBundle/EventListener/FrontendProductFavoriteDatagridListener.php b/src/Synolia/Bundle/FavoriteBundle/EventListener/FrontendProductFavoriteDatagridListener.php index 0d928ac..f3aad9f 100644 --- a/src/Synolia/Bundle/FavoriteBundle/EventListener/FrontendProductFavoriteDatagridListener.php +++ b/src/Synolia/Bundle/FavoriteBundle/EventListener/FrontendProductFavoriteDatagridListener.php @@ -10,8 +10,8 @@ use Oro\Bundle\DataGridBundle\Event\BuildBefore; use Oro\Bundle\DataGridBundle\Extension\Formatter\Property\PropertyInterface; use Oro\Bundle\OrganizationBundle\Entity\Organization; -use Oro\Bundle\SecurityBundle\Authentication\TokenAccessorInterface; use Oro\Bundle\SearchBundle\Datagrid\Event\SearchResultAfter; +use Oro\Bundle\SecurityBundle\Authentication\TokenAccessorInterface; use Oro\Bundle\SecurityBundle\ORM\Walker\AclHelper; use Synolia\Bundle\FavoriteBundle\Entity\Favorite; use Synolia\Bundle\FavoriteBundle\Entity\Repository\FavoriteRepository; diff --git a/src/Synolia/Bundle/FavoriteBundle/Migrations/Schema/v1_1/AddSerializeDataColumn.php b/src/Synolia/Bundle/FavoriteBundle/Migrations/Schema/v1_1/AddSerializeDataColumn.php index c5cc830..6af1966 100644 --- a/src/Synolia/Bundle/FavoriteBundle/Migrations/Schema/v1_1/AddSerializeDataColumn.php +++ b/src/Synolia/Bundle/FavoriteBundle/Migrations/Schema/v1_1/AddSerializeDataColumn.php @@ -17,7 +17,7 @@ class AddSerializeDataColumn implements Migration public function up(Schema $schema, QueryBag $queries): void { $table = $schema->getTable('synolia_favorite'); - if($table->hasColumn('serialize_data')) { + if ($table->hasColumn('serialize_data')) { return; } $table->addColumn('serialized_data', Types::JSON, ['notnull' => false]); diff --git a/src/Synolia/Bundle/FavoriteBundle/Resources/config/oro/routing.yml b/src/Synolia/Bundle/FavoriteBundle/Resources/config/oro/routing.yml index 91ec1ec..4dba3da 100644 --- a/src/Synolia/Bundle/FavoriteBundle/Resources/config/oro/routing.yml +++ b/src/Synolia/Bundle/FavoriteBundle/Resources/config/oro/routing.yml @@ -1,13 +1,13 @@ synolia_ajax_button_favorite: resource: '@SynoliaFavoriteBundle/Controller/Frontend/FavoriteButtonAjaxController.php' - type: annotation + type: attribute prefix: /favorite options: frontend: true synolia_favorite_index: resource: '@SynoliaFavoriteBundle/Controller/Frontend/FavoriteController.php' - type: annotation + type: attribute prefix: /customer/favorite options: frontend: true