Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation: #97435 - Usage of SiteLanguageAwareTrait to denote site language awareness #3103

Closed
sabbelasichon opened this issue Aug 9, 2022 · 3 comments · Fixed by #3195 or #3221
Closed

Comments

@sabbelasichon
Copy link
Owner

Deprecation: #97435 - Usage of SiteLanguageAwareTrait to denote site language awareness

https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/12.0/Deprecation-97435-UsageOfSiteLanguageAwareTraitToDenoteSiteLanguageAwareness.html
.. include:: /Includes.rst.txt

=======================================================================================
Deprecation: #97435 - Usage of SiteLanguageAwareTrait to denote site language awareness

See :issue:97435

Description

The :php:TYPO3\CMS\Core\Site\SiteLanguageAwareTrait should not be used as
means to denote a class as aware of the site language anymore. Instead, the
:php:TYPO3\CMS\Core\Site\SiteLanguageAwareInterface should be implemented for
this purpose. The trait is an internal implementation and should not be used
in user land code.

Impact

If you are currently using the :php:SiteLanguageAwareTrait to denote a class
as aware of the site language, you should implement the
:php:SiteLanguageAwareInterface instead.

Affected Installations

All installations where the :php:SiteLanguageAwareTrait is used to denote
a class as aware of the site language.

Migration

Change classes that use the :php:SiteLanguageAwareTrait but not the
corresponding interface to implement the interface. Replace the usage of the
trait with an own trait, or implement the interface methods directly in the
class.

Example before the migration:

.. code-block:: php

use TYPO3\CMS\Core\Site\SiteLanguageAwareTrait;

class MyClass
{
    use SiteLanguageAwareTrait;
}

Example after the migration:

.. code-block:: php

use TYPO3\CMS\Core\Site\SiteLanguageAwareInterface;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;

class MyClass implements SiteLanguageAwareInterface
{

    protected SiteLanguage $siteLanguage;

    public function setSiteLanguage(SiteLanguage $siteLanguage)
    {
        $this->siteLanguage = $siteLanguage;
    }

    public function getSiteLanguage(): SiteLanguage
    {
        return $this->siteLanguage;
    }
}

.. index:: PHP-API, ext:core, NotScanned

@spoonerWeb
Copy link

Just tried it with my extension tcabuilder for v12 and the rector changes every class. In no class the trait was used, even simple Helper classes get the SiteLanguage stuff now.

@sabbelasichon
Copy link
Owner Author

I have done totally crap here. Sorry for that. Will be fixed in a minute.

@sabbelasichon
Copy link
Owner Author

@spoonerWeb I have released version 1.0.6. Sorry for the inconvenience. I must have been drunk i guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants