Foreign Key to TYPO3 Frontend User

后端 未结 1 1876
野性不改
野性不改 2020-12-18 11:51

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

相关标签:
1条回答
  • 2020-12-18 12:26

    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

    builder sample

    0 讨论(0)
提交回复
热议问题