I am creating an application, built with PHP, MySQL and Doctrine v1.2, that deals with ordered groupings of items, which can contain different types of items. For example, the group My Last Vacation can have images, video and textual notes. These items would be sortable so that they appear in the order that the end user specifies.
Each different type of item will have their own properties. An image may have a caption, a video may have a link to the youtube URL, etc. Items may exist in more than one grouping. E.g. the same image of a boat may exist in the groupings My Last Vacation and Cool Vehicles.
I am searching for the best way of implementing the above scenario with Doctrine relations and how those relations would be represented in a YAML schema file.
In my PHP code it would be great to be able to do something such as:
$group = new Group();
$item1 = new Image();
$item1->caption = 'my caption'
$item2 = new Video();
$item2->url = 'youtube.com/1234';
$group->Items[0] = $item1;
$group->Items[1] = $item2;
$group->save();
Is this possible? If not are there alternatives to achieving a similar result?