[TYPO3-mvc] Extending Tx_Extbase_Domain_Model_FrontendUser

Johannes C. Schulz - EnzephaloN IT-Solutions info at enzephalon.de
Wed Jan 4 09:22:35 CET 2012


Hello Mark
Thanks a lot - this was the first step, because the error went away.
Something strange, because in the past it works without setting the
"mapOnProperty" with other extensions I wrote...
I deleted all of the "standard" fe_users-fields from my model (instead of
password, cause I will generate it here). 
It is right to begin the model with:
"class Tx_PsoaAccredit_Domain_Model_Feuser extends
Tx_Extbase_Domain_Model_FrontendUser {" ?
Because now no object-value is shown.
My feusers is a child-object of an "accreditation"-model, accessed in fluid
like {accreditation.user.company}.
Tx_PsoaAccredit_Domain_Model_Accreditation.user ->
Tx_PsoaAccredit_Domain_Model_Feuser
Best regards
Johannes

-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
Mark Kuiphuis
Gesendet: Mittwoch, 4. Januar 2012 08:54
An: typo3-project-typo3v4mvc at lists.typo3.org
Betreff: Re: [TYPO3-mvc] Extending Tx_Extbase_Domain_Model_FrontendUser

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
_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc




More information about the TYPO3-project-typo3v4mvc mailing list