Programming


Making use of Magento getSingleton method

Making use of Magento getSingleton method

In one of my previous articles I showed you how to use getModel and getData methods in Magento. Although we should not put those to methods at the same level, since I’d say the getModel is a bit more higher. Higher in sense, you first use the geModel to create the instance of object then you use getData to retrieve the data from that instance. I have said it before, and I’m saying it again; Magento is a great peace of full OOP power of PHP. It’s architecture is something not yet widely seen in CMS solutions.

One of the architectural goodies of Magento is it’s Singleton design pattern. In short, Singleton design pattern ensures a class has only one instance. Therefore one should provide a global point of access to that single instance of a class.

Read more