Skip to content

Upgrade plugin to support Sylius 2#38

Open
loevgaard wants to merge 4 commits into
3.xfrom
sylius-2-upgrade
Open

Upgrade plugin to support Sylius 2#38
loevgaard wants to merge 4 commits into
3.xfrom
sylius-2-upgrade

Conversation

@loevgaard

Copy link
Copy Markdown
Member

Summary

Upgrades the plugin from Sylius 1.10 to Sylius 2, following the Setono v1 -> v2 plugin upgrade playbook with the SyliusPluginSkeleton (2.2.x) as the reference and SyliusRedirectPlugin for the resource-specific mechanics.

Plugin

  • composer.json: PHP >=8.2, Symfony ^6.4 || ^7.4, split sylius/* ^2.0, setono/sylius-plugin ^2.0; dropped Psalm/PHPSpec/code-quality-pack
  • Layout moved out of src/Resources/ to repo-root config/ + translations/; services converted to the PHP DSL with FQCN ids + interface aliases
  • Bundle keeps AbstractResourceBundle but overrides getPath()/getModelNamespace()/getConfigFilesPath() to point Doctrine/validation at config/
  • Admin grid registered through Extension::prepend() (sylius_grid); routing uses /%sylius_admin.path_name% and @SyliusAdmin\shared\crud
  • Default command bus changed message_bus -> sylius.command_bus
  • Code modernised with Rector (promoted readonly constructors)

Tooling / CI

  • Added phpstan.neon (level max), ecs.php, rector.php, composer-dependency-analyser.php, infection.json5, two-suite phpunit.xml.dist, tests/PHPStan/*
  • CI switched to the setono/sylius-plugin/*@v2 composite-action workflow

Tests

  • 5 PHPSpec specs converted to PHPUnit under tests/Unit/; existing tests moved there too
  • Added tests/Functional/AdminRoutingTest
  • Test application rebuilt for Sylius 2.2

Verification

Locally green on PHP 8.4 / Symfony 7.4 / Sylius 2.2.6:

composer validate --strict · composer normalize · composer-dependency-analyser · phpstan (max) · ecs · phpunit (24 tests) · cache:warmup · lint:container · debug:router (6 resource routes) · doctrine:schema:create + schema:validate

Notes

  • The default command bus default changed (documented in UPGRADE.md).
  • The test application's Sylius API is disabled: loading API routes triggers a symfony/type-info 7.4 + API-Platform 4.3 union-type bug on PHP 8.4 that is unrelated to this (API-agnostic) plugin.

Follows the Setono Sylius v1 -> v2 plugin upgrade playbook, using the
SyliusPluginSkeleton as reference.

- Require PHP >=8.2, Symfony ^6.4 || ^7.4 and Sylius ^2.0
- Move configuration to repo-root config/ and translations/; convert
  service definitions from XML to the PHP DSL (config/services.php)
- Register the admin grid via the bundle extension prepend() instead of
  a grid YAML file; override getPath()/getConfigFilesPath() so Doctrine
  mapping, validation and translations resolve from the new layout
- Default the command bus to sylius.command_bus
- Replace Psalm/PHPSpec/code-quality-pack with setono/sylius-plugin
  (PHPStan max + PHPUnit); add ecs.php, rector.php, infection.json5 and
  composer-dependency-analyser.php
- Convert the PHPSpec specs to PHPUnit under tests/Unit and add a
  functional admin-routing test
- Rebuild the test application for Sylius 2.2
- Switch CI to the setono/sylius-plugin composite actions

See UPGRADE.md for consumer-facing changes.
- phpunit.xml.dist: restore the intended config (unit/functional test
  suites + <source> coverage filter); the previous commit accidentally
  kept the old single-suite config, which broke code coverage
- phpstan: drop doctrine objectManagerLoader (align with the skeleton);
  it booted a second kernel that failed under the static-analysis action
- composer-dependency-analyser: disable reporting of unmatched ignores
  (the sylius split-package ignores are resolution-dependent)
- add an (empty) templates/ directory so lint:twig has a target
- mark the backwards-compatibility job non-blocking for the major upgrade
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

- composer-dependency-analyser: ignore the optional Buzz classes as
  unknown (kriswallsmith/buzz is not installed when only production
  dependencies are analysed)
- remove the backwards-compatibility CI job for the 1.x -> 2.x upgrade
  (no 2.0 baseline yet; re-add after 2.0 is released)
Comment thread .github/workflows/build.yaml Outdated
Comment thread src/DependencyInjection/SetonoSyliusPartnerAdsExtension.php Outdated
Comment thread src/SetonoSyliusPartnerAdsPlugin.php Outdated
Comment thread tests/Application/config/bundles.php Outdated
Comment thread composer-dependency-analyser.php Outdated
Comment thread composer.json Outdated
- bundles.php: register the plugin before SyliusGridBundle (and document
  it in the README) instead of working around the grid/model-class
  parameter ordering in the extension's prepend()
- remove the now-unnecessary setParameter() workaround from prepend()
- drop the redundant getModelNamespace() override (it equals the
  AbstractResourceBundle default)
- do not hard-require a specific PSR-17 implementation: require
  php-http/discovery and discover the request/response factories at
  runtime; nyholm/psr7 becomes a dev dependency (used by the test app)
- composer-dependency-analyser: drop the sylius split-package ignores
  (not needed in CI)
- restore the backwards-compatibility CI job as-is
Comment on lines +38 to +45
protected function getConfigFilesPath(): string
{
return sprintf(
'%s/config/doctrine/%s',
$this->getPath(),
strtolower($this->getDoctrineMappingDirectory()),
);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct?

@loevgaard loevgaard changed the base branch from 2.x to 3.x June 15, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant