So for some reason we want to handle Canada differently from the US.
We have a model that has a zip and for US we do stuff like ->findByZip
('20007') but for Canada we want to put partial postal codes in the db
and have ->findByZip('N1M 1M2') match an entry in the db that has just
'N1M' listed as the zip code.My Canadian friends will have to forgive me for referring to their postal codes as zip codes but beyond that is there a good way to handle this? What I did was add a method in the model that I called getByZip and in there do: $x = $this->findByZip($zip); if (!$x) $x = $this->findByZip(substr($zip, 0, 3)) 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? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
