On Jan 18, 2008 2:46 AM, AD7six <[EMAIL PROTECTED]> wrote:
>
> 32MB of memory is a bit stingy.

Sure. But it seems to be it should be more than enough to handle 1000
records. I can bump it up but I'd like to ensure I'm not doing so
unnecessarily.

> How about
> 1) delete your afterFind method
> 2) include "CONCAT(". $model->escapeField('first_name').','.$model-
> >escapeField('last_name').') AS full_name'"

I use Postgres because I prefer to do things with Pl/PgSQL, Pl/Python,
etc. Doing the concat in SQL was my first plan. However, I wanted to
know how to properly use afterFind() because I'm probably going to
need it. Like with urlencode(), etc.

> 3) look for $result[0]['full_name'] instead of $result['User']
> ['first_name'] etc.

I was thinking that that wouldn't work when User is more deeply nested
(when it'spart of an association). But I just remembered that
afterFind() isn't called then, so ...

> 4) url_encode where you need it (in the view)

Well, I was thinking that that just wouldn't be the Cake way ;-) It
seems to me that this is a chore for the model to deal with,
considering that I'm creating a new field in the array.

> Alternatively, to use the set class to do it would be something like:
> $keyPath = '{n}.User.id';
> $valuePath = array('{0} {1}', '{n}.User.first_name',
> '{n}.User.last_name');
> $results = Set::combine($results, $keyPath, $valuePath);
>

Oooh, that looks tasty! I'll check that out. Set is still a bit of a
mystery to me.

I came across this interesting AutoField behavior last night:

http://cakeexplorer.wordpress.com/category/model/

I'd like to test it out but ran into some weirdness with configure.php
that I haven't resolved. I'll post another thread about the problem
once I'm satisfied that it's just not just something boneheaded on my
part.

b

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to