Repository navigation
[6.x] Stop the Yii adapter from logging deprecations for its own calls - #19995
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
FieldsandSitesservices fired their Yii events throughCraft::$app->getFields()/getSites(), which log a deprecation on every call. They now fetch the Yii component directly.craft\config\GeneralConfigwas rebuilt through__set_state(), which set every property — including deprecated ones likeisSystemLiveandgenerateTransformsBeforePageLoad— and logged their deprecations even when the project never set them. Legacy configs are now copied instead.Craft::$app->getConfig()->getGeneral()callers (Localfilesystem,FileHelper,Paginate) now useCms::config().andWhere()/scalar(), and elements calledaddError(),setScenario(),getErrors()andgetErrorSummary(), which go through the deprecation-logging compatibility mixins. They now use the Laravel query methods (where(),whereIn(),value()) anderrors()/ruleset->useScenario(). This covers legacy tags, categories, global sets (incl. their GraphQL resolvers and settings template), the entrify/resave console controllers, theReplaceRelationsjob,Model::addModelErrors(), and thecraft\testhelpers.craft:utils:repair:category-group-structurenow hands its query to the coreRepairCommand::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 logsaddError/hasErrorsdeprecations.🤖 Generated with Claude Code