On 22 November 2012 17:03, Stephen Shorrock <stephen.shorr...@gmail.com>wrote:
> Hi Lukas, > > Firstly thanks and secondly I take your point regarding the relationships. > > It seems sensible that I should create an object to manipulate a > Montage rather than methods attached to other objects that seem to be > modifying something virtual. For example a Montage might have a > period associated to it so when I display the details the Montage > knowing it's period can identify the pictures from it's period > containing the user that belong to it and maybe on a picture rating > set by the user include them to be displayed. To always have to pass > start and end dates, and perhaps other Montage related attributes, to > a method in the users object doesn't see right. I hate to state the obvious (honest!) but shouldn't you at this point be adding a table for the montages? Otherwise, simply creating an object as Montage->new( user => $dbicUserObject, start => ..., end => ...) doesn't seem too bad. Pass the actual user row object in and it will allow you easy enough access to the pictures in a related table (e.g. something like $user->pictures_rs->search( { date => { '>=', $start, '<', $startPlusPeriod } } ) for the example you gave about periods).
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/