问题
How can I set a ForeignKey to the TYPO3 FrontendUsers in the Extension Builder?
Do I have to set the param map to existing table? oder make a relation?
What I want to do:
I've got a Model (People) with its own fields and values. and now I want to have a new Releation between this Model and the TYPO3 FE Users
PeopleNr = fe_user with uid 123
回答1:
Note: As stated in other question creating relations between tables/models doesn't require adding foreign keys
I'm not quite sure what do you need it for, but here's description of two most common cases (screenshot shows how to achieve each case with Extension Builder)
Creating relation to FrontendUser
model / fe_user
table
In TYPO3 ver. 6.2 fe_user
has a model as well: \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
, you can just add this as common relation in Builder modeling tool (fig. 2 at screenshot) in the field \Fully\Qualified\Classname
(you need to Show advanced fields
to set it (fig. 1) use this FrontendUser
and it will create proper SQL
and TCA
definitions.
Real extending FrontendUser
(FU) model
On the other hand if your People
* model just extends the fe_user
table, because you want to reuse existing fe_user table for your people, you can also extend FrontendUser
model for real (fig. 3) in that case you'll inherit all getters, setters from FU etc. and you won't need to write them yourself.
In such case your model will be a separate type of fe_user
, the discriminator field is by default: tx_extbase_type
and builder will add new type like Tx_YourExt_Employee
*
note: For model names you should use singular form i.e Man
instead of People
来源:https://stackoverflow.com/questions/27601254/foreign-key-to-typo3-frontend-user