私はそこに何人かの仲間の教義ユーザーがいることを望んでいます。
これが私の関係の単純化されたYAMLです:
Collection:
columns:
id: { type: integer(4), notnull: true, primary: true, autoincrement: true }
name: { type: string(255), notnull: true, unique: true }
relations:
Items:
class: Item
refClass: CollectionItem
foreignAlias: Collections
type: many
foreignType: many
Item:
columns:
id: { type: integer(4), notnull: true, primary: true, autoincrement: true }
name: { type: string(255), notnull: true }
CollectionItem:
columns:
id: { type: integer(4), notnull: true, primary: true, autoincrement: true }
collection_id: { type: integer(4) }
item_id: { type: integer(4) }
relations:
Collection:
foreignAlias: CollectionItem
foreignType: one
Item:
foreignAlias: CollectionItem
foreignType: one
コレクションが同じアイテムの多くのコピーを保持できるようにしたいのですが、生成されたクラスを使用して次のようなアイテムをロードすると、次のようになります。
$collection = Doctrine::getTable('Collection')->find(1);
$items = $collection->Items;
$itemsには私の複製が含まれていません。生成されたSQLは重複した行を正しく返すようです:
SELECT i.id AS i__id, i.name AS i__name, c.id AS c__id, c.collection_id AS c__collection_id, c.item_id AS c__item_id, FROM item i LEFT JOIN collection_item c ON i.id = c.item_id WHERE c.collection_id IN (?) - (1)
代わりに特定のdqlクエリを作成することでこれを回避できることは知っていますが、Itemsコレクションに重複を許可する簡単な設定があるかどうか誰かが知っていますか?