Re: [Maypole] Re: Maypole responding to requests very slowly (or, how to get just one associated record instead of getting the world)

From: Aaron Trevena (teejay at droogs.org)
Date: Mon Nov 22 2004 - 16:54:33 GMT


On Thu, 18 Nov 2004, Brian Glass wrote:
> Aaron Trevena wrote:
>> On Thu, 30 Sep 2004, Matt Adams wrote:
>>> Brian Glass wrote:
>>>
>>>> Regardless, I do agree with Simon that something needs to change in the
>>>> way Class::DBI::AsForm works in Maypole. It would make thinks
>>>> considerably snappier.
>>>
>>>
>>> A solution that I implemented yesterday involved addressing CDBI::AsForm's
>>> desire to create a drop-down every time it encounters a has_a
>>> relationship.
>>> To evade CDBI::AsForm's annoying habits I created a new View class,
>>> overloaded the vars() method supplied by Maypole::View::Base and changed
>>
>>
>> I've come accross the unnecessary use of collections of objects a few times
>> like this. There is no reason to fetch a bunch of objects, initialise and
>> instantiate them all for a dropdown or select.
>>
>> I would really like to get hasMany relationships pulled as simple 2d arrays
>> of id and name. I used this before when using tangram and drastically
>> reduced the time it took to fetch long lists for dropdowns and lists.
>>
>> Some kind of
>> $object->ForeignObjectName_asIndex($optional_id_column,$optional_title_column);
>> would be very useful in CDBI for these kinds of relationships.

> Did you ever come up with a solution for this? If so I'd like to see it.

I have implemented it in Class::DBI::Relationship::HasManyOrdered, it
should be trivial to copy to your own class.

I would like to see Maypole handle something like this for the many
occasions when you only use the name and id of a load of objects and don't
need the objects themselves.

If anybody gives me some pointers I would be happy to amend and release a
template and an updated view class or something (should be under an hours
work).

regards,

A.

-- 
Aaron J Trevena - Perl Hacker, Kung Fu Geek, Internet Consultant
AutoDia --- Automatic UML and HTML Specifications from Perl, C++ 
and Any Datasource with a Handler.     http://droogs.org/autodia

_______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT