On Feb 25, 4:47 pm, psujohn <[email protected]> wrote: > What I'd like is some way to magically alter the magic findByZip > method so that is provides the desired behavior without having to > resort to changing every place that calls the method. Ideas?
I think going the custom model method way is the way I'd go. You could probably cut the call to findByZip down to one by checking if $zip has a space in it. If it does, then change $zip to the first 3 characters, otherwise leave $zip as-is. Then call $this->findByZip. You could also implement a beforeFind callback that essentially contains the same code (e.g. changing the query conditions based on if there's a space or whatnot and modifying the conditions appropriately) and then returns true to allow the query to happen. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
