Skip to content

[3.5-RC1] Hard error on the enabledForSite element query param #6443

@khalwat

Description

@khalwat

Using Craft CMS 3.5.0RC1, the SEOmatic plugin uses ->enabledForSite() which is now deprecated:

https://github.com/nystudio107/craft-seomatic/blob/v3/src/seoelements/SeoEntry.php#L227

        return Entry::find()
            ->section($metaBundle->sourceHandle)
            ->id($elementId)
            ->siteId($siteId)
            ->enabledForSite(true)
            ->limit(1)
            ->one();
    }
The `enabledForSite` element query param has been deprecated. `status()` should be used instead.

...which is fine. But it results in a hard error, rather than a deprecation notice and a mapping to the new intended behavior:

2020-07-23 10:46:41 [-][-][-][error][craft\queue\QueueLogBehavior::afterError]  [8823] Generating notFound sitemap (attempt: 1) - Error (time: 0.086s): The `enabledForSite` element query param has been deprecated. `status()` should be used instead.
2020-07-23 10:46:41 [-][-][-][error][craft\errors\DeprecationException] craft\errors\DeprecationException: The `enabledForSite` element query param has been deprecated. `status()` should be used instead. in /home/forge/devmode.fm/releases/35afa05cf9c7234620d6d94438ca93d6dd7b7d0f/vendor/nystudio107/craft-seomatic/src/seoelements/SeoEntry.php:198
Stack trace:
#0 /home/forge/devmode.fm/releases/35afa05cf9c7234620d6d94438ca93d6dd7b7d0f/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1024): craft\services\Deprecator->log('ElementQuery::e...', 'The `enabledFor...')
#1 /home/forge/devmode.fm/releases/35afa05cf9c7234620d6d94438ca93d6dd7b7d0f/vendor/nystudio107/craft-seomatic/src/seoelements/SeoEntry.php(198): craft\elements\db\ElementQuery->enabledForSite(true)

Is this intended? If so, is moving to ->status() backwards compatible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions