On Thu, Nov 22, 2012 at 5:20 PM, Will Crawford
<billcrawford1...@gmail.com> wrote:
> 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).

Thanks Will,

I think I'm having problems with it be just that; too obvious?! True I
could create a Montages table though Montages can exists with any
start end point so this would just have to be a cache. Also (perhaps I
should really go away an investigate) is it possible to extend a
DBIx::Class objects with extra Moose attributes?  without being able
to it would mean that all my attributes must be columns in the cache
table.  I do remember using custom result sets once so something like:

result_source_instance->name($select_query )

I was perhaps hoping that relationships would then work in this user
defined instance but the method didn;t seem to work well with my more
recent DBIC.

But like you say this seems to be going a little too far and I would
have to manually set start and end anyway ( Montage->New(...))  so
perhaps I'll just stick with what I have.


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/

Reply via email to