Do not modify the queryData as the parameter, but instead return the
modified data:

function beforeFind($queryData)
{
        if (!empty($queryData['fields']))
        {
                foreach ($this->fieldsRequired as $required_field)
                {
                        if (!in_array($required_field,$queryData['fields']))
                        {
                                $queryData['fields'][] = $required_field;
                        }
                }
        }

        return $queryData;
}

You can see this on these lines in model_php4.php / model_php5.php:

$ret = $this->beforeFind($queryData);
if (is_array($ret)) {
        $queryData = $ret;
} elseif ($ret === false) {
        return null;
}

I haven't tried this so tell us if it works.

-MI

---------------------------------------------------------------------------

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar

-----Mensaje original-----
De: [email protected] [mailto:[EMAIL PROTECTED] En nombre
de Mikee Freedom
Enviado el: Domingo, 25 de Febrero de 2007 06:26 p.m.
Para: [email protected]
Asunto: Re: beforeFind example


my apologies.

could someone *please* have a look and see if they know what the
solution might be.

the queryData doesn't seem to be updated in the calling function even
though I'm using the &...

I'm pretty sure it will be something simple, just need a prod.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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