Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 115013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:57:07+00:00 2026-05-11T02:57:07+00:00

Instead of using $this->fetchAll(’email = ?’,$email)->current() inside the model class, is there a way

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:57:08+00:00Added an answer on May 11, 2026 at 2:57 am

    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:

    public function __call($function, $args) {     // Expects findBy to be the first part of the function     $criteria = substr($function, 6);     $criteria = strtolower($criteria);      $select = $this->select()                 ->from($this->_name)                 ->where($criteria . ' = ?', $args); } 

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any advantage to using __construct() instead of the class's name for a
I'm using this database where the date colomn is a numeric value instead of
I would like to know, if there are any performance differences using NFS instead
Background I'm using POST form submissions instead of links with concatenated arguments inside a
...instead of using the Atom syndication format? Atom is a well-defined , general-purpose XML
When I use conditional breakpoint in VS2005 instead of using temporary code to check
I heard that you could right-shift a number by .5 instead of using Math.floor().
What is the benefit of using singleton instead of global for database connections in
When using the pImpl idiom is it preferable to use a boost:shared_ptr instead of
EDIT I solved the issue by forking the process instead of using threads. From

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.