I\'m a little confused about calls I see to Mage::getSingleton
, and I\'m hoping someone can help me understand a little better.
I have seen a piece of core
Magento's getSingleton is almost the same as getModel. The difference is getModel always returns a new instance of a class, and getSingleton creates a new instance of a class only once and then always returns this instance. See the Mage::getSingleton
and Mage::getModel
methods.
Magento knows about looking to the Model folder because of configs in the config.xml
file (f.e. Mage/Customer/etc/config.xml
). See the Magento wiki for developers to know more about config files.
You do not specify customer directly. It's done automatically by Magento in parent classes of Mage_Customer_Model_Session
(see Mage_Core_Model_Session_Abstract_Varien::start()
method)
Magento has not one session class to discriminate session data. For example, customer ID is stored in Mage_Customer_Model_Session
and error flash message 'Product is not available' will be stored in the Mage_Catalog_Model_Session
class.