[CDBI] Adding metadata to objects
[prev]
[thread]
[next]
[Date index for 2005/09/27]
Does CDBI provide a way to add meta data to object instances?
I want to generate a list of CDs, say limited to a given genre. So
using Catalyst in this example, in the controller I might say:
$c->stash->{items} = Music::CD->search( { genre => 'Rock' } );
Now in the template I want to list the CDs, and also list the tracks
on the CD:
WHILE (item = items.next);
"Title = "; item.title;
# list tracks
tracks = item.tracks;
WHILE (track = tracks.next);
"* Track "; track.title;
END;
END;
Here's the question: assume that the CD has an overall genre, but
also each *individual* track also has a genre and I only want to list
tracks that have a genre that matches the genre used for the original
query on the CDs.
So above the "tracks = item.tracks" would only return tracks that also
have genre = 'Rock'.
So, what I want to do is add "genre => 'Rock'" as meta data to each CD
instance, and then when calling "tracks" on a CD have that method use
that genre in the query.
--
Bill Moseley
moseley@xxxx.xxx
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
|
[CDBI] Adding metadata to objects
Bill Moseley 19:42 on 27 Sep 2005
|