Skip to content

[6.x] Stop the Yii adapter from logging deprecations for its own calls - #19995

Merged
brandonkelly merged 4 commits into
6.xfrom
bugfix/adapter-internal-deprecations
Oct 16, 2026
Merged

brandonkelly merged 4 commits into
6.xfrom
bugfix/adapter-internal-deprecations

Conversation

@brandonkelly

Copy link
Copy Markdown
Member

Description

The Yii adapter was calling deprecated APIs internally, so the Deprecation Warnings utility listed warnings that no project or plugin code had triggered. This updates the adapter's own code to use the non-deprecated APIs:

  • The legacy Fields and Sites services fired their Yii events through Craft::$app->getFields()/getSites(), which log a deprecation on every call. They now fetch the Yii component directly.
  • A project's general config built with the legacy craft\config\GeneralConfig was rebuilt through __set_state(), which set every property — including deprecated ones like isSystemLive and generateTransformsBeforePageLoad — and logged their deprecations even when the project never set them. Legacy configs are now copied instead.
  • Craft::$app->getConfig()->getGeneral() callers (Local filesystem, FileHelper, Paginate) now use Cms::config().
  • Element queries called andWhere()/scalar(), and elements called addError(), setScenario(), getErrors() and getErrorSummary(), which go through the deprecation-logging compatibility mixins. They now use the Laravel query methods (where(), whereIn(), value()) and errors()/ruleset->useScenario(). This covers legacy tags, categories, global sets (incl. their GraphQL resolvers and settings template), the entrify/resave console controllers, the ReplaceRelations job, Model::addModelErrors(), and the craft\test helpers.
  • craft:utils:repair:category-group-structure now hands its query to the core RepairCommand::repairStructure(), which already applies the same structure join and draft filtering, rather than rebuilding it in Yii syntax.

Not addressed here: Tag, Category and GlobalSet still run yii validators against the element itself, so a failing legacy rule (and GlobalSet's UniqueValidator, on every validation) still logs addError/hasErrors deprecations.

🤖 Generated with Claude Code

brandonkelly and others added 4 commits October 16, 2026 03:43
The adapter was calling deprecated APIs itself, so deprecation warnings
showed up that no project or plugin code had triggered:

- The legacy Fields and Sites services fired their Yii events through
  `Craft::$app->getFields()`/`getSites()`; they now fetch the component
  directly.
- Project config built with the legacy `GeneralConfig` was rebuilt through
  `__set_state()`, setting deprecated properties to their defaults; it's now
  copied instead.
- `Config::getGeneral()` callers now use `Cms::config()`.
- Element queries used `andWhere()`/`scalar()`, and elements used
  `addError()`/`setScenario()`/`getErrors()`/`getErrorSummary()`, which go
  through the deprecation-logging compatibility mixins. They now use the
  Laravel query methods and `errors()`/`ruleset`.
- The category group structure repair command hands its query to the core
  `repairStructure()` rather than rebuilding it in Yii syntax.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brandonkelly
brandonkelly merged commit 620f94a into 6.x Oct 16, 2026
7 checks passed
@brandonkelly
brandonkelly deleted the bugfix/adapter-internal-deprecations branch October 16, 2026 12:03
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