TYPO3/如何从现有表fe_users中创建存储库? [英] TYPO3 / How to make repository from existing table fe_users?

查看:79
本文介绍了TYPO3/如何从现有表fe_users中创建存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Extbase和Fluid创建一个特殊的BE模块,并且我需要一个域对象,该对象将代表标准的FE用户.当我创建新的域对象时,例如 Feuser 并保存,扩展构建器将创建特殊的存储库,并且还希望在数据库中创建特殊的表 tx_myextkey_feuser .但是该表已经以 fe_users 的形式存在.

I am creating a special BE module with Extbase and Fluid and I need a domain object which would be representing standard FE user. When I create new domain object called e.g. Feuser and save it, the extension builder creates special repository and also wants to create special table tx_myextkey_feuser in database. But this table already exists as fe_users.

是否可以告诉typo3 Feuser 对象的存储库已经存在(如 fe_users 表),并且typo3应该使用现有的存储库?我怎样才能做到这一点?

Is possible to tell typo3 that the repository for Feuser objects already exists (as fe_users table) and that typo3 should use the existing one? How can I do that?

我需要它,因为扩展名(包括此BE模块)需要将所有逻辑和控件放在同一位置(此BE模块).

I need it because the extension (including this BE module) needs to have every logic and controls on the same place (this BE module).

通常来说,如果可能,我需要在两个地方为新的FE用户使用相同的插入对话框.如果没有,我可以创建自己的新建/编辑/显示"操作,但是我需要告诉TYPO3它应该将现有存储库与FE用户一起使用.

Generally speaking I need the same insert dialog for new FE users on two places if possible. If not, I can create my own New/Edit/Show actions, but I need tell TYPO3 that it should use the existing repository with FE users.

我正在使用错字4.7.3.

I am using typo 4.7.3.

推荐答案

ExtBase已经为现有表fe_user提供了域模型.该域模型为:

ExtBase already comes with a domain model for the existing table fe_user. This domain model is:

Tx_Extbase_Domain_Model_FrontendUser

它包含TYPO3随附的所有默认fe_users字段.

It contains all default fe_users fields that come with TYPO3.

如果使用自己的字段扩展了fe_users,则还必须扩展Tx_Extbase_Domain_Model_FrontendUser域模型和关联的存储库,以便它知道您已添加到fe_users中的新字段.

If you have extended fe_users with your own fields, you also have to extend the Tx_Extbase_Domain_Model_FrontendUser domain model and the associated repository so it knows the new fields you have added to fe_users.

关联的存储库为:

Tx_Extbase_Domain_Repository_FrontendUserRepository

您必须为存储库设置存储PID,以便它可以找到您的fe_users.

You have to set the storage PID(s) for the repository, so it can find your fe_users.

对于前端插件中使用的控制器操作,请使用:

For controller actions used in frontend plugins use:

plugin.your_plugin {
    persistence {
        storagePid = somePid, anotherPid
    }
}

如果后端模块中使用的控制器操作使用:

If controller actions used in backend modules use:

module.your_module {
    persistence {
        storagePid = somePid, anotherPid
    }
}

据我所知,对于您自己的扩展,无法使用TYPO3随附的相同对话框,因此您必须在后端模块中创建自己的操作(新/编辑/显示)和表单.

As far as I know it is not possible to use the same dialogs which come with TYPO3 for your own extension, so you have to create your own actions (new/edit/show) and forms in your backend module.

默认情况下,ExtBase假定所有fe_users都分配了一个记录类型.当您打开一个前端用户时,您将看到扩展"选项卡包含一个下拉字段,该字段标记为记录类型".如果未设置此字段,ExtBase将无法使用存储库中的一种查找方法来找到fe_user.

By default, ExtBase assumes, that all fe_users have assigned a record type. When you open one of your frontend users, you will see the tab "extended" contains a dropdown field, which is labeled "record type". If this field is not set, ExtBase will not be able to find the fe_user by using one of the find-methods from the repository.

您应该为所有fe_users设置记录类型(推荐方式),或者可以通过在设置中使用以下TS来禁用到字段的映射

You should set the record type for all fe_users (recommended way) or you can disable the mapping to the field by using the following TS in your setup

config.tx_extbase.persistence.classes {
    Tx_Extbase_Domain_Model_FrontendUser {
        mapping.recordType >
    }
}

对于新创建的fe_users或fe_groups,您可以通过将以下TS添加到根页面TS中来为记录类型"字段设置默认值

For newly created fe_users or fe_groups, you can set the default value for the field "record type" by adding the following TS to your root pageTS

TCAdefaults.fe_users.tx_extbase_type = Tx_Extbase_Domain_Model_FrontendUser
TCAdefaults.fe_groups.tx_extbase_type = Tx_Extbase_Domain_Model_FrontendUserGroup

这篇关于TYPO3/如何从现有表fe_users中创建存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆