Tuesday, March 20, 2012

Are Custom find types limited for my use case?


Hi All,

I am having trouble implementing a custom find method in cakephp 2.1.0

My 'use case' is to cache a common pagination request ..using a custom find type.

So in my model I define my custom find :-

public $findMethods = array('primeimages' => true);

protected function _findPrimeimages($state, $query, $results = array()) {

switch ($state) {

case 'before':

// Check if cache has results exists. If so return false

// ( cached result can be inserted by afterfind().

return false; // query is not killed !!!!!

break;

case 'after':

// if results empty insert results from cache.~~~~

return $results;

break;



}

}

I have problems :-

1) In a normal beforeFind() function I would be able to kill the find by returning false... this does not work for custom find type.

2) the beforeFind() and afterFind() funcitons are no longer called..

Am I correct in concluding I can not longer kill the actual find while using custom find types..

this seems limiting..

Martin

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: