Skip to content

Upgrade plugin to CakePHP 6 - #351

Open
ADmad wants to merge 4 commits into
6.xfrom
cake-6
Open

ADmad wants to merge 4 commits into
6.xfrom
cake-6

Conversation

@ADmad

@ADmad ADmad commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Dependencies:

  • cakephp/cakephp ^6.0, php >=8.4, cakephp-codesniffer ^6.0, phpunit ^13.0, rector ~2.6.0 (plus minimum-stability dev).

Source changes (cakephp60 rector set + manual follow-up):

  • Entity access API renamed by Cake 6: setAccess()/accessibleFields became setPatchable()/patchableFields (Marshaller option included).
  • QueryInterface methods now declare static return types; Query::order() removed, applyOptions() maps order to orderBy().
  • Finder option arrays are rejected with an InvalidArgumentException pointing at named arguments instead of being deprecated.
  • FixtureInterface::insert()/truncate() return void.
  • Document stores the Elastica result in $searchResult, and its clean path writes values through setRawValue() so declared fields stay initialised.
  • Index::saveMany() assigns the ES id/version with set() instead of direct property writes (Property PHPStan error on EntityInterface).
  • ValidationRule is readonly in Cake 6: DocumentContext reads ->name/->pass.
  • Plugin classes drop the underscore prefix convention (Query, Index, Connection, Marshaller, DocumentContext, IsUnique, ElasticLogger, ...); dynamic ES fields such as _version are left untouched.
  • Test plugin classes added for TestPlugin/TestPluginTwo: Cake 6 removed the BasePlugin fallback in PluginCollection::create().

Tooling:

  • rector.php targets PHP 8.4 and skips rector 2.5/2.6 docblock removal rules, mirroring debug_kit, so composer rector-check stays green without losing @return $this that PHPStan needs for fluent interfaces.

CI/docs:

  • ci.yml pushes to 6.x, PHP matrix 8.4/8.5, prefer-lowest on 8.4.
  • docs-validation uses the cakephp/.github 6.x workflow.
  • deploy_docs_6x.yml added alongside the other major-version deployers.
  • README, docs version references and a new 6.0 upgrade guide.

@ADmad ADmad added this to the 6.x (CakePHP 6) milestone Sep 27, 2026
Dependencies:
- cakephp/cakephp ^6.0, php >=8.4, cakephp-codesniffer ^6.0,
  phpunit ^13.0, rector ~2.6.0 (plus minimum-stability dev).

Source changes (cakephp60 rector set + manual follow-up):
- Entity access API renamed by Cake 6: setAccess()/accessibleFields became
  setPatchable()/patchableFields (Marshaller option included).
- QueryInterface methods now declare `static` return types; Query::order()
  removed, applyOptions() maps `order` to orderBy().
- Finder option arrays are rejected with an InvalidArgumentException
  pointing at named arguments instead of being deprecated.
- FixtureInterface::insert()/truncate() return void.
- Document stores the Elastica result in $searchResult, and its clean path
  writes values through setRawValue() so declared fields stay initialised.
- Index::saveMany() assigns the ES id/version with set() instead of direct
  property writes (Property PHPStan error on EntityInterface).
- ValidationRule is readonly in Cake 6: DocumentContext reads ->name/->pass.
- Plugin classes drop the underscore prefix convention (Query, Index,
  Connection, Marshaller, DocumentContext, IsUnique, ElasticLogger, ...);
  dynamic ES fields such as `_version` are left untouched.
- Test plugin classes added for TestPlugin/TestPluginTwo: Cake 6 removed
  the BasePlugin fallback in PluginCollection::create().

Tooling:
- rector.php targets PHP 8.4 and skips rector 2.5/2.6 docblock removal
  rules, mirroring debug_kit, so `composer rector-check` stays green
  without losing `@return $this` that PHPStan needs for fluent interfaces.

CI/docs:
- ci.yml pushes to 6.x, PHP matrix 8.4/8.5, prefer-lowest on 8.4.
- docs-validation uses the cakephp/.github 6.x workflow.
- deploy_docs_6x.yml added alongside the other major-version deployers.
- README, docs version references and a new 6.0 upgrade guide.

Tests: 472 tests, 1375 assertions, 0 failures/errors against
Elasticsearch 9.1.5; phpcs and phpstan are clean.
Comment thread docs/en/6-0-upgrade-guide.md Outdated
Co-authored-by: Mark Story <mark@mark-story.com>
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.

2 participants