On Wed, Feb 25, 2009 at 5:58 PM, mscdex <[email protected]> wrote: > > 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 shouldn't rely on a space being present, as many people don't bother with it. I often don't, because--surprise, surprise--some online forms won't accept it. I guess you could simply check to see if the first 3 chars are letter-number-letter. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
