[TYPO3-mvc] FYI: Progress in implementing support for generic domain models
Jochen Rau
jochen.rau at typoplanet.de
Fri Jul 17 18:06:06 CEST 2009
Hi.
I just wanted to inform you about the progress I make on implementing
support for generic domain models like FrontendUser (=fe_users).
My current sketch (not committed yet) is that you can say
--8<--- snip -----
class Tx_BlogExample_Domain_Model_Administrator
extends Tx_Extbase_Domain_Model_FrontendUser {
// nothing to define
}
--8<--- snap -----
The generic domain model Tx_Extbase_Domain_Model_FrontendUser implements
all the class members and methods necessary to access the fields in
fe_users.
Inside the Blog you have
--8<--- snip -----
/**
* The Administrator of the blog
*
* @var Tx_Extbase_Domain_Model_FrontEndUser
*/
protected $administrator;
--8<--- snap -----
and in the $TCA you specify
--8<--- snip -----
'administrator' => Array (
[...]
'config' => Array (
'type' => 'select',
'foreign_table' => 'fe_users',
'foreign_class' => 'Tx_BlogExample_Domain_Model_Administrator',
'maxitems' => 1,
)
),
--8<--- snap -----
You don't need to configure any mapping for yourself.
I am a little bit enthusiastic about this feature because that enables
us to implement a lot of generic models for
- persons
- addresses
- places
- (calendar) events
...
No more reinventing the wheel by every extension developer!
I need to polish the things a little bit before I can commit it. And
maybe I have to wait for the refactoring of the whole PID stuff (done by
Sebastian next week).
Regards
Jochen
--
Every nit picked is a bug fixed
More information about the TYPO3-project-typo3v4mvc
mailing list