Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Can’t Find Functions
 
yshahin
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-05-14
 

Hi, I wanted to look at the implementations of

getPasswordHash()
and
setWebsiteId()
to get a better understanding of the software but I cant find them

Can someone help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
alistek
Sr. Member
 
Total Posts:  293
Joined:  2008-04-02
Normal, IL
 

These are not defined functions in the code.  Magento abstracts the database calls this way.  $this->getPasswordHash() is linked to the password_hash column in the database table.  Here is the setWebsiteId() defined in a file.  Most of the time that is an automagic function but it does basically what that bottom function does.

app\code\core\Mage\ProductAlert\Model\Email.php

public function setWebsiteId($websiteId)
    
{
        $this
->_website Mage::app()->getWebsite($websiteId);
        return 
$this;
    
}

-Adam

 
Magento Community Magento Community
Magento Community
Magento Community
 
yshahin
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-05-14
 

Turns out that the automagic function is in Object.php in lib/Varian

called “__call”

this takes all calles made by the code and checks if it has the words “set” or “get” or “uns” or “has” at the start of the function name
then it executes the code

 
Magento Community Magento Community
Magento Community
Magento Community
 
alistek
Sr. Member
 
Total Posts:  293
Joined:  2008-04-02
Normal, IL
 

Yep, __call is actually a standard PHP 5 function (I think) and they may have just extended it.  But it makes nice work of that, once you understand what is going on of course.  Still working on that one myself smile

-Adam

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top