Instead of using $this->fetchAll('email = ?',$email)->current() inside the model class, is there a way to do $this->fetchByEmail($email) or $this->findByEmail($email) ?
There’s already a magic method like this for Zend_Log, where instead of $myLogger->log('Something went wrong',Zend_Log::CRIT) you just write $myLogger->crit('Something went wrong') and it automagically gets mapped ( via some funky reflection in the __call() method ).
Does anybody know if there is something like that in any of the Zend_Db classes, or am I going to have to write something to do this for me?
For the particular functionality that you want, you’ll need to build a custom function. Honestly, the logic behind the magic __call() function isn’t all that difficult.
Something like this should do the trick:
Obviously if you want it to handle more complex cases like arrays or multiple criteria parameters, you would need to implement better checking but this should provide the basic idea.