機能要望 > その他 > EC-CUBE で O/R Mapper 的なもの |
その他
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
ghana |
投稿日時: 2009/10/29 11:14
対応状況: −−−
|
新米 登録日: 2009/10/28 居住地: 投稿: 8 |
Re: EC-CUBE で O/R Mapper 的なもの 引用:
とあるので, JOIN を使用できるのは PHP5 のみ?! JOIN というか ClassBelongsTo() とか ClassHasMany() が PHP4 では使えないということみたいです。 引用: あと, id っていう名前の PRIMARY KEY を作るというのがデフォルトの規約みたいです. これは 引用: 14. Primary Keys ADOdb_Active_Record does not require the table to have a primary key. You can insert records for such a table, but you will not be able to update nor delete. Sometimes you are retrieving data from a view or table that has no primary key, but has a unique index. You can dynamically set the primary key of a table through the constructor, or using ADOdb_Active_Record::SetPrimaryKeys(): 引用: 15. Retrieval of Auto-incrementing ID When creating a new record, the retrieval of the last auto-incrementing ID is not reliable for databases that do not support the Insert_ID() function call (check $connection->hasInsertID). In this case we perform a SELECT MAX($primarykey) FROM $table, which will not work reliably in a multi-user environment. You can override the ADOdb_Active_Record::LastInsertID() function in this case. 引用: 22. TableKeyHasMany For some classes, the mapping between class name and table name (which is the pluralised version) might not match or the primary key is not the default id. For example, the class name might be person, but the table name might be people. So we have 2 tables, people (parent table) and children (child table) linked by people.pid = children.person_id. Then you use the following static function ADODB_Active_Record::TableKeyHasMany($table, $tablePKey, $relation, $foreignKey = '', $foreignClass = 'ADODB_Active_Record') like this: ADODB_Active_Record::TableKeyHasMany('people', 'pid', 'children', 'person_id') を読む限り id 以外のキーでも constructor でごにょごにょしてやれば使えます。 |
フラット表示 | 前のトピック | 次のトピック |