Consider the following code

$customer_email = "[email protected]";
$customer = Mage::getModel("customer/customer");

When looking through Mage_Customer_Model_Customer I could not find a loadByEmail method anywhere in it's inheritance chain. Then I looked at it's resource model, Mage_Customer_Model_Resource_Customer, and there it was.

My question is: how is it possible, that I load the model itself and get access to this method through the $customer_email variable?

  • I guess this question should be downvoted, so that noone gets tricked by it or closed or whatever.
    – dsplynm
    Commented Nov 29, 2013 at 9:53

1 Answer 1


I think you missed something. The method loadByEmail exists in the Mage_Customer_Model_Customer class: For Magento it starts at line 180 and looks like this:

public function loadByEmail($customerEmail)
    $this->_getResource()->loadByEmail($this, $customerEmail);
    return $this;

It's just a wrapper for Mage_Customer_Model_Resource_Customer::loadByEmail but it exists.

  • I feel so embarrassed. :D Thank you, you are right! I guess I should have used Ctrl + F.
    – dsplynm
    Commented Nov 29, 2013 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.