[TYPO3-mvc] Extending an existing model and adding fields
Franz Koch
typo3.RemoveForMessage at elements-net.de
Thu Dec 23 09:49:27 CET 2010
Hey Zoran,
>> you can only do this by extending the FrontentUser class and add the
>> new fields in your own class and use this class throughout your
>> extension. Mixins (which would be needed to merge additional fields in
>> existing classes) are not supported yet.
>>
> This is exactly what i plan to do. I'm not sure what to store in my
> model's table though.
What do you mean? I suppose your model belongs to a fe_user and you're
not sure how to set up everything to use your fe_user model instead of
the default one?
I see two options here:
a) use single table inheritance by adding a new option to the
tx_extbase_type field of the fe_users and make it default for all of
your users. This only works as long as you don't have to extend the
fe_users from a second extension also.
b) directly assign and use your extended fe_user model throughout your
extension. To get this working all you have to do is to also create your
own repository to fetch the user objects (probably extending the fe_user
repository) and provide a mapping information via TS:
config.tx_extbase.persistence.classes {
// name of your own fe_user class name
Tx_YourExt_Domain_Model_User {
mapping {
tableName = fe_users
columns {
lockToDomain.mapOnProperty = lockToDomain
}
}
}
}
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list