[TYPO3-mvc] Annotaion based relation-type-detection
Felix Oertel
mehl at foertel.com
Fri Apr 16 01:23:34 CEST 2010
Hey ho,
we all know, we had ... erm, let's say: "issues" with IRRE. ;-) The hole
system is not meant to be a good way to detect a databse-relation-type.
As we use annotations anyway, we should act consistently and detect the
database's relation-type by using an annotation.
This patch will introduce three new annotations:
@OneToOne
@OneToMany and
@ManyToMany
Just add them to your model's property like:
/**
* @var Tx_YourExt_Domain_Model_Foo $foo
* @oneToOne
*/
protected $foo;
and extbase will do the rest. Don't care for foreign_field, MM,
foreign_selector or some other magic field in TCA anymore.
I fear this patch is not yet complete and needs further testing. When I
tried the blog_example I expirienced a problem with the
Tx_BlogExample_Domain_Model_Person. It extends
Tx_Extbase_Domain_Model_FrontendUser which is mapped to fe_users by
ext_typoscript_setup.txt.
If I add @manyToMany to Tx_Extbase_Domain_Model_FrontendUser->usergroup,
extbase throws an exception because it is not able to find the
neccassary fields in TCA. Propably this is a common problem with mapped
models ...
regards, foertel
PS: As discussed with Jochen we want to replace (!) TCA detection with
annotation based detection, so TCA-config is not used at all and you
HAVE TO use the annotations.
More information about the TYPO3-project-typo3v4mvc
mailing list