Question

I'm working on getting an email newsletter set up in my Magento Store and as I was working through how the default setup does newsletters, I came across this bit of code in the createPostAction function in app/code/core/Mage/Customer/controllers/AccountController.php:

if ($this->getRequest()->getParam('is_subscribed', false)) {
    $customer->setIsSubscribed(1);
}

So I get what the conditional check is doing, but I can't for the life of me find what the function call setIsSubscribed() does. I get that I pass in either TRUE or FALSE and it sets that appropriately, but where is the function definition? Or is there some kind of PHP voodoo going on like in Ruby where this is calling a setter that's setting an instance variable somewhere? More or less, can someone tell me exactly what happens when setIsSubscribed is called and/or where I can find it in the code?

Was it helpful?

Solution

Yes, very Ruby-ish PHP overloading. See Varien_Object::__call()[link] - the inheritance is via Mage_Core_Model_Abstract.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top