I'm hoping there are some fellow doctrine users out there.
Here is a simplified YAML of my relationships:
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
I want a collection to be able to hold many copies of the same item, but when I use the generated classes to load items like so:
$collection = Doctrine::getTable('Collection')->find(1);
$items = $collection->Items;
$items doesn't contain my duplicates. The generated sql seems to correctly return duplicate rows:
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)
I know I can get around this my making specific dql queries instead but does anyone know if there is simple setting somewhere to allow the Items collection to have duplicates?