[TYPO3-mvc] Thoughts regarding inter-extension communication
Joerg Schoppet
joerg at schoppet.de
Tue Oct 6 18:30:22 CEST 2009
Hi,
Prerequisite:
everything extbase-dependant
following scenario:
I wrote a general billing extension. And created a be-module, in which I
can create positions and finally invoices.
Now I have additional extensions, which should "hook" into the billing
extension to provide "specialized" billing-positions.
Actual solution:
In the billing-extension I created an own class, which is a singleton
and has a method called "registerExtension". All the specialized
extensions have a call in ext_tables.php, which registers an own class
as a string:
$obj = t3lib_div::makeInstance('Tx_JrCustomer_Utility_Billing');
$obj->registerExtension('Tx_JrDomainManagement_Utility_Billing');
In the class from the billing-extension I can then call the following
method:
public function fetchBillings($year, $month) {
foreach ($this->billings as $extension) {
$obj = t3lib_div::makeInstance($extension);
$this->positions =
array_merge($this->positions, $obj->fetchPositions($year, $month));
}
}
What I don't like at this solution is:
When ext_tables.php is executed the extbase-dispatcher is not loaded, so
I have to use "require_once"-call for the main class in ext_tables.php.
Because of this I also have to register the specialized classes as
strings, so that I haven't to include this all with require_once.
Is there a better solution for this usecase? Perhaps something
completely different?
Joerg
More information about the TYPO3-project-typo3v4mvc
mailing list