Hi to everyone,

im moving/converting all my "getFromUser()" methods from my models to:
find('fromUser') because now its the new cakephp way, so well..

but the problem that i find here is that i cannot assign the caching
logic to this methods, because the only things that them do is to
prepare the query and the params for the "real find" method.

Is there a way to combine this logic or i have to make a wrapper over
the new _findBlabla methods to make Caching logic. For ex.

public function getFromUser($userId)
{
    $cacheKey = 'blabla_from_users_' . $userId;
    if (($results = Cache::read($cacheKey)) === false) {
         $results = $this->find('fromUsers', array('conditions' =>
array('User.id' => $userId)));
         Cache::write($cacheKey, $results);
    }

    return $results;
}

It would not be convenient to have a way to "exit" the _find behavior
in the "before" state, so that this can be accomplished?

libs/model/model.php line 1787 (rc3)
                if ($type != 'all') {
                        if ($this->_findMethods[$type] === true) {
                                $query = $this->{'_find' . 
ucfirst($type)}('before', $query);
                        }
                }

maybe if the query has a "return" key, and assuming that it comes with
a value different than null (or false), the function will directly
return this. Only weird ideas...

Thanks in advance,
gonzalo




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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