Deprecation: #107229 - Deprecate
Annotation namespace of Extbase attributes
See forge#107229
Description
With the removed support for PHP annotations in Extbase,
the class namespace
\TYPO3\ no longer reflects
classes with PHP annotations; it contains PHP attributes only. The class
namespace of all PHP attributes with support for Models, DTOs, and controller
actions in Extbase context is moved to
\TYPO3\.
Developers and integrators are advised to migrate existing class usages to the
new namespace. The deprecated namespace will be removed in TYPO3 v15.
Impact
Usage of the deprecated class namespace is no longer recommended, but will continue working until TYPO3 v15.
Affected installations
Instances using the deprecated class namespaces for Extbase attributes in Models, DTOs, and controller actions are affected.
Migration
Albeit from migrating PHP annotations to PHP attributes,
existing usages of the class namespace
\TYPO3\
should be migrated to
\TYPO3\:
-TYPO3\CMS\Extbase\Annotation
+TYPO3\CMS\Extbase\Attribute
Before:
use TYPO3\CMS\Extbase\Annotation as Extbase;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
class MyModel extends AbstractEntity
{
#[Extbase\Validate(['validator' => 'NotEmpty'])]
protected string $foo = '';
}
After:
use TYPO3\CMS\Extbase\Attribute as Extbase;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
class MyModel extends AbstractEntity
{
#[Extbase\Validate(['validator' => 'NotEmpty'])]
protected string $foo = '';
}