简体   繁体   English

DataMapper和Codeigniter-如何完全管理多对多关系

[英]DataMapper and Codeigniter - how to fully manage a many-to-many relationship

I have the following relationship 我有以下关系

CType has many Field CType有很多字段
Field has many Ctype 字段有很多Ctype

and of course the tables used are fields, ctypes, and ctypes_fields. 当然,使用的表是字段,ctypes和ctypes_fields。 Normally, the ctypes_fields table should contain only ids referencing the other two tables. 通常,ctypes_fields表应仅包含引用其他两个表的ID。 However, i'd like to put there a "options" field that will contain some content for the concrete instance only. 但是,我想在此处放置一个“选项”字段,其中仅包含一些具体实例的内容。 I walked through all DataMapper tuts but I couldn't find relevant info on how I could extract these specific values (the ones in the relation table). 我遍历了所有DataMapper Tut,但找不到有关如何提取这些特定值(关系表中的值)的相关信息。

Should I create a separate model for this relation table or there is a clever way to do this? 我应该为此关系表创建一个单独的模型,还是有一个聪明的方法来做到这一点?

Datamapper OverZealous Edition (DMZ) allows you to do this. Datamapper OverZealous Edition(DMZ)允许您执行此操作。 It should be compatible with your existing Datamapper application. 它应该与您现有的Datamapper应用程序兼容。 http://codeigniter.com/forums/viewthread/149388/ http://codeigniter.com/forums/viewthread/149388/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM