[TYPO3-mvc] Extending Tx_Extbase_Domain_Model_FrontendUser
Mark Kuiphuis
spam at markyourweb.com
Wed Jan 4 08:53:40 CET 2012
On 4/01/12 5:16 PM, Johannes C. Schulz - EnzephaloN IT-Solutions wrote:
> Hello
>
> I have some trouble with extending Tx_Extbase_Domain_Model_FrontendUser.
> At first I added new fields to fe_users table. After that I made a new Model
> called Tx_PsoaAccredit_Domain_Model_Feuser and wrote down all fields from
> fe_users I need plus my additional fields. To map them, I added to the
> setup.txt the following lines:
> config.tx_extbase.persistence.classes{
> Tx_Psoaaccredit_Domain_Model_Feuser{
> mapping{
> tableName = fe_users
> }
> }
> }
>
> Taken from here: http://typo3.sfroemken.de/index.php?id=81
>
> I also included the setup to the page. I can see this mapping in the
> Object-Browser. Also I tried to map by
> "plugin.tx_psoaaccredit.persistence.classes" but this also doesn't work.
>
> But now I get an extbase-error: #1247602160: Table
> 'psoa.tx_psoaaccredit_domain_model_feuser' doesn't exist: SELECT
> tx_psoaaccredit_domain_model_feuser.* FROM
> tx_psoaaccredit_domain_model_feuser WHERE
> tx_psoaaccredit_domain_model_feuser.uid IN ('7') LIMIT 1
>
> What I have to do, to make this connection/extension working?
>
> Best regards
> Johannes
>
Hi Johannes,
I've done something similar in the past and didn't redeclare all fields of the FeUser
model.
You only need to declare the additional fields in your model as your model is already
extending the class Tx_Extbase_Domain_Model_FrontendUser
class Tx_YourExt_Domain_Model_Feuser extends Tx_Extbase_Domain_Model_FrontendUser {
// only your additional fields go here...
}
Then I used the following Typoscript to map the additional fields to a database field.
config.tx_extbase.persistence.classes {
Tx_PsoaAccredit_Domain_Model_Feuser {
mapping {
tableName = fe_users
recordType = Tx_PsoaAccredit_Domain_Model_Feuser
columns {
tx_psoaaccredit_mobile.mapOnProperty = mobile
tx_psoaaccredit_showEmail.mapOnProperty = showEmail
tx_psoaaccredit_showTelephone.mapOnProperty = showTelephone
tx_psoaaccredit_showMobile.mapOnProperty = showMobile
tx_psoaaccredit_inviteToken.mapOnProperty = inviteToken
//fieldnameinfeusertable.mapOnProperty = variableInModel
}
}
}
}
It looks like you have a created a new table for your members instead of extending
the existing table fe_users with your additional fields....
Cheers, Mark
More information about the TYPO3-project-typo3v4mvc
mailing list