I've installed AdFab Avatar extension. It has 2 methods that interest me: getAvatarValid and setAvatar.

setAvatar is called on $_avatar in some .phtml files and getAvatarValid called via $customer->getAvatarValid() in Observer.php.

I wanted to check the source of these methods so I did grep -r "n setAvatar(for both functions) on the whole Magento folder. I didn't get any result. How come? Are they saved in the database :)?


It's most likely that setAvatar() is just calling a magic method to add a value into the data array of whatever object $_avatar is. The call to getAvatarValid() is probably also using a magic method to pull a value assigned to the $customer object in some other code.

See here for a little information on PHP magic methods.

  • Thanks Marius and Jonathan! I have read somwhere about magic methods before but completely forgot about it. – Alan Sep 9 '14 at 14:23

May be where you are finding that method is not available on your searching folders.

May be they are overloading customer and you will find the method over there "$customer"->getAvatarValid().

Find with grep -r "function getAvatarValid()" /root/magento/ you will get your method. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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