Breaking: #110028 - LoggerAwareInterface removed from FormEngine base classes
See forge#110028
Description
The FormEngine base classes
\TYPO3\ and
\TYPO3\
no longer implement
\Psr\ and no longer use
\Psr\.
Both base classes never read the injected logger themselves. The node hierarchy
built on
Abstract does not use a logger at all. The two data provider
subclasses that did log,
\TYPO3\
and
\TYPO3\, now receive a
\Psr\ through their constructor instead.
Impact
Subclasses of these base classes, for example custom FormEngine nodes or custom
database record providers shipped by extensions, are no longer recognized as
\Psr\ instances and no longer have a logger
injected automatically. The inherited
set method is gone, and
reading the previously inherited
$logger property raises an error.
Affected installations
Instances with third-party extensions that subclass
\TYPO3\ or
\TYPO3\
and rely on the automatically injected logger.
Migration
Request a
\Psr\ as a constructor argument in the
affected subclass. The subclass must be registered as a public service using the
# attribute, so that the FormEngine
\TYPO3\ obtains it through the dependency
injection container, which then resolves the constructor argument automatically.
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Backend\Form\AbstractNode;
#[Autoconfigure(public: true)]
final class MyFormElement extends AbstractNode
{
public function __construct(
private readonly LoggerInterface $logger,
) {}
public function render(): array
{
$this->logger->warning('Something the element wants to log');
// ...
}
}