Download the PHP package tastaturberuf/contao-datacontainer-bundle without Composer
On this page you can find all versions of the php package tastaturberuf/contao-datacontainer-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tastaturberuf/contao-datacontainer-bundle
More information about tastaturberuf/contao-datacontainer-bundle
Files in tastaturberuf/contao-datacontainer-bundle
Package contao-datacontainer-bundle
Short Description Define data container configuration with classes/services instead of plain php files
License LGPL-3.0-or-later
Informations about the package contao-datacontainer-bundle
From Data Container Array to Data Container Class
Define data container configuration with classes/services instead of plain PHP files.
Why?
- Real Dependency Injection
- Don't deal with DCA files and wild names because of the prefixes like
tl_vendor_bundle_tablename
. Just define your table names one time and forget about it later. See advanced usage below. - Define private callbacks and logic methods in class scope like in Contao 2 or 3.
- Define whatever you need, it's your class.
- It's still possible to override definitions with dca files.
How?
A compiler pass tag all classes which implement Tastaturberuf\ContaoDataContainerBundle\DataContainerInterface
with the tag tastaturberuf.datacontainer.autoload
.
An event listener with the iterable classes listen to the loadDataContainer
hook and recursive merge the array if the table name matches.
Litte bit of magic:
On migrations the table name is unknown if the are no DCA files present. The hook sqlGetFromDca
take care that the definitions get loaded properly.
All logic happen in this file: https://github.com/Tastaturberuf/contao-datacontainer-bundle/blob/main/src/EventListener/DataContainerListener.php
Install
via Composer
Basic usage
Define a class and implement DataContainerInterface
.
Advanced usage
Maintainer
Tastaturberuf with ♥ and Contao