<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Making use of Magento getSingleton method</title>
	<atom:link href="http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/feed/" rel="self" type="application/rss+xml" />
	<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/</link>
	<description>Magento Design and Magento Development Professionals - Inchoo</description>
	<lastBuildDate>Fri, 12 Mar 2010 10:40:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Hui W</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-6325</link>
		<dc:creator>Hui W</dc:creator>
		<pubDate>Fri, 26 Feb 2010 17:48:57 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-6325</guid>
		<description>i am aware of that, but not familiar with it. i came from a J2EE background and just started to pick up php/magento two months ago. so if i understand correctly from your answer, the singleton object does not persist across multiple requests?</description>
		<content:encoded><![CDATA[<p>i am aware of that, but not familiar with it. i came from a J2EE background and just started to pick up php/magento two months ago. so if i understand correctly from your answer, the singleton object does not persist across multiple requests?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morriz</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-5789</link>
		<dc:creator>Morriz</dc:creator>
		<pubDate>Wed, 06 Jan 2010 11:16:48 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-5789</guid>
		<description>are you aware that PHP is a scripting language?</description>
		<content:encoded><![CDATA[<p>are you aware that PHP is a scripting language?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hui W</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-5787</link>
		<dc:creator>Hui W</dc:creator>
		<pubDate>Wed, 06 Jan 2010 05:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-5787</guid>
		<description>i have a question about using singleton for checkout session. there is a instance variable $_quote in Mage_Checkout_Model_Session class. getQuote function will set this instance variable based on the user session data if this variable is not set yet. 
if ($this-&gt;_quote === null) {
....
this-&gt;_quote = quote;
}
if the session instance is singleton, and the _quote instance inside singleton session instance should be singleton too. wouldn&#039;t that make the second user get the first user&#039;s quote?</description>
		<content:encoded><![CDATA[<p>i have a question about using singleton for checkout session. there is a instance variable $_quote in Mage_Checkout_Model_Session class. getQuote function will set this instance variable based on the user session data if this variable is not set yet.<br />
if ($this-&gt;_quote === null) {<br />
&#8230;.<br />
this-&gt;_quote = quote;<br />
}<br />
if the session instance is singleton, and the _quote instance inside singleton session instance should be singleton too. wouldn&#8217;t that make the second user get the first user&#8217;s quote?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morriz</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-5661</link>
		<dc:creator>Morriz</dc:creator>
		<pubDate>Thu, 24 Dec 2009 14:06:18 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-5661</guid>
		<description>I agree, I am currently doing a Magento contract (did 5 extensions n 3 months) and have seen a lot of its code. It smells like UML models being sent to the Ukraine, with undocumented shortcut code being sent back. Thank you Varien, for calling that open source and putting it out there. Sure, it does the marketing trick quite well, because we, developers think it coulnd&#039;t be all that bad, when so may people are talking about it and using it.
But the devs on the bottom are the ones getting beat on because your code is so faulty and we can&#039;t even work around it in many cases.

I do like the fact that it has so much functionality tho, but more from an end user perspective than the purist coder that I am.</description>
		<content:encoded><![CDATA[<p>I agree, I am currently doing a Magento contract (did 5 extensions n 3 months) and have seen a lot of its code. It smells like UML models being sent to the Ukraine, with undocumented shortcut code being sent back. Thank you Varien, for calling that open source and putting it out there. Sure, it does the marketing trick quite well, because we, developers think it coulnd&#8217;t be all that bad, when so may people are talking about it and using it.<br />
But the devs on the bottom are the ones getting beat on because your code is so faulty and we can&#8217;t even work around it in many cases.</p>
<p>I do like the fact that it has so much functionality tho, but more from an end user perspective than the purist coder that I am.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Ribakoff</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-3714</link>
		<dc:creator>Josh Ribakoff</dc:creator>
		<pubDate>Sat, 07 Nov 2009 07:11:28 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-3714</guid>
		<description>I Couldn&#039;t agree more with Joy except to say that the mess is not caused by ZF, it was caused by Magentos &quot;design decision&quot; to override parts of ZF that in my opinion they should not have.

They also screwed up big time with the .xml thing, plus implicit interfaces and magic getters are a major code smell. To the person writing such a system I&#039;m sure it works great and yes it saves them time, but an overall goal should be to build understanding into the system, not to cut corners</description>
		<content:encoded><![CDATA[<p>I Couldn&#8217;t agree more with Joy except to say that the mess is not caused by ZF, it was caused by Magentos &#8220;design decision&#8221; to override parts of ZF that in my opinion they should not have.</p>
<p>They also screwed up big time with the .xml thing, plus implicit interfaces and magic getters are a major code smell. To the person writing such a system I&#8217;m sure it works great and yes it saves them time, but an overall goal should be to build understanding into the system, not to cut corners</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike D</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-3002</link>
		<dc:creator>Mike D</dc:creator>
		<pubDate>Fri, 07 Aug 2009 21:31:28 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-3002</guid>
		<description>Hey, I ran accross this while trying to trouble shoot a call to Mage::getSingleton(&#039;core/session&#039;);

I am trying to get session data from with in &quot;Mage_Core_Model_Cookie&quot;.
And as soon as I add the above code the browser gives me the following error: &quot;The connection to the server was reset while the page was loading.&quot;

I am able to use &quot;Mage::getModel(&#039;catalog/product&#039;)-&gt;getCollection()&quot;. So I am confused as to why I can not get the session. Can anyone shed some light on this? Thanks A Million.</description>
		<content:encoded><![CDATA[<p>Hey, I ran accross this while trying to trouble shoot a call to Mage::getSingleton(&#8216;core/session&#8217;);</p>
<p>I am trying to get session data from with in &#8220;Mage_Core_Model_Cookie&#8221;.<br />
And as soon as I add the above code the browser gives me the following error: &#8220;The connection to the server was reset while the page was loading.&#8221;</p>
<p>I am able to use &#8220;Mage::getModel(&#8216;catalog/product&#8217;)-&gt;getCollection()&#8221;. So I am confused as to why I can not get the session. Can anyone shed some light on this? Thanks A Million.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dumbrava Razvan Aurel</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-1661</link>
		<dc:creator>Dumbrava Razvan Aurel</dc:creator>
		<pubDate>Wed, 06 May 2009 21:01:38 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-1661</guid>
		<description>Hi Branko,

I&#039;m currently working on a custom import module for magento, and i&#039;ve overridden the product adapter for that. I&#039;m importing a column for manufacturer and in the case in which the manufacturer value for the current imported line is new (does not exists as an attribute option in the system) i&#039;m adding it to the system. For that i use the following code:
&lt;pre&gt;
$l_aOption = array(
                    		&#039;attribute_id&#039; =&gt; $attribute-&gt;getAttributeId(),
                    		&#039;value&#039; =&gt; array(
                    			&#039;new_option&#039; =&gt; array($value)
                    		)
                    	);

                    	$l_oEavEntitySetupResource = new Mage_Eav_Model_Entity_Setup(&#039;eav_setup&#039;);

                    	$l_oEavEntitySetupResource-&gt;addAttributeOption($l_aOption);
&lt;/pre&gt;
It is working. My question is: is there a better way to get an instance of  Mage_Eav_Model_Entity_Setup then using &#039;new Mage_Eav_Model_Entity_Setup&#039;, for example getSingleton or another function ?

Thx and appreciate you effort in posting usefull tips bigtime!</description>
		<content:encoded><![CDATA[<p>Hi Branko,</p>
<p>I&#8217;m currently working on a custom import module for magento, and i&#8217;ve overridden the product adapter for that. I&#8217;m importing a column for manufacturer and in the case in which the manufacturer value for the current imported line is new (does not exists as an attribute option in the system) i&#8217;m adding it to the system. For that i use the following code:</p>
<pre>
$l_aOption = array(
                    		'attribute_id' =&gt; $attribute-&gt;getAttributeId(),
                    		'value' =&gt; array(
                    			'new_option' =&gt; array($value)
                    		)
                    	);

                    	$l_oEavEntitySetupResource = new Mage_Eav_Model_Entity_Setup('eav_setup');

                    	$l_oEavEntitySetupResource-&gt;addAttributeOption($l_aOption);
</pre>
<p>It is working. My question is: is there a better way to get an instance of  Mage_Eav_Model_Entity_Setup then using &#8216;new Mage_Eav_Model_Entity_Setup&#8217;, for example getSingleton or another function ?</p>
<p>Thx and appreciate you effort in posting usefull tips bigtime!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-1473</link>
		<dc:creator>Gary</dc:creator>
		<pubDate>Tue, 31 Mar 2009 03:21:28 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-1473</guid>
		<description>I&#039;ve spent most of the past 2 days trying to override an admin module. I&#039;ve got the book and manuals and google at my disposal, but still can&#039;t figure it out. Worst of all is that modules are automagically loaded, and seem to fail silently. This means you are left with trial and error or scrutinising the differences between what does work against your own.

I come from 16 years dev experience, 2 of those with Ruby and Rails. Anyone should look at Rails before panning MVC. I&#039;ve also found there are different interpretations of MVC. eg. In Rails, the controller uses the models (or anything else) to gather data for rendering in the view. In Adobe Flex Cairngorm framework, the view is bound to the model, and the controller updates the model. (I much prefer Rails).

I was drawn to Magento with the idea that I would add a full featured cart to my skillset for large jobs, while using Rails when I need to build from first principles. I&#039;m finding for this my first Magento job which is quite simple, that I could have built the functionality I want from Magento more than once over if I had used Rails from the beginning. Its just so hard to first figure out what I need to do, and then very slow to get things done - largely because of the deep directory trees and the lack of debugging.

Its great that Magento has taken on ecommerce with a view to do things &#039;properly&#039; ie structured, but it feels more like bondage and discipline, without any assistance from the framework when things just don&#039;t work. I&#039;ve already decided to do future jobs with a minimal cart front end and an accounting system backend. I&#039;m now even contemplating renegotiating this project and leaving Magento behind (sadly).</description>
		<content:encoded><![CDATA[<p>I&#8217;ve spent most of the past 2 days trying to override an admin module. I&#8217;ve got the book and manuals and google at my disposal, but still can&#8217;t figure it out. Worst of all is that modules are automagically loaded, and seem to fail silently. This means you are left with trial and error or scrutinising the differences between what does work against your own.</p>
<p>I come from 16 years dev experience, 2 of those with Ruby and Rails. Anyone should look at Rails before panning MVC. I&#8217;ve also found there are different interpretations of MVC. eg. In Rails, the controller uses the models (or anything else) to gather data for rendering in the view. In Adobe Flex Cairngorm framework, the view is bound to the model, and the controller updates the model. (I much prefer Rails).</p>
<p>I was drawn to Magento with the idea that I would add a full featured cart to my skillset for large jobs, while using Rails when I need to build from first principles. I&#8217;m finding for this my first Magento job which is quite simple, that I could have built the functionality I want from Magento more than once over if I had used Rails from the beginning. Its just so hard to first figure out what I need to do, and then very slow to get things done &#8211; largely because of the deep directory trees and the lack of debugging.</p>
<p>Its great that Magento has taken on ecommerce with a view to do things &#8216;properly&#8217; ie structured, but it feels more like bondage and discipline, without any assistance from the framework when things just don&#8217;t work. I&#8217;ve already decided to do future jobs with a minimal cart front end and an accounting system backend. I&#8217;m now even contemplating renegotiating this project and leaving Magento behind (sadly).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Branko Ajzele</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-259</link>
		<dc:creator>Branko Ajzele</dc:creator>
		<pubDate>Thu, 23 Oct 2008 06:08:41 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-259</guid>
		<description>&quot;You are clearly uninformed of what true OOP is&quot;

I come from .NET (C#) and I belive I have a pretty good understanding of what OOP is. PHP 5 lacks great amount of features as a language to even compare to C#. However, it still functions as OOP language. Hopefuly version 6 will be better. 

I agree the code is... hmmm... would not say bad, but disconnected. There is simply to many of the M, V and C-s around. What makes it catastrophic is the full lack of good comments in the code and the general lack of good (aka MS SDK) documentation. System this big needs good IDE, since I can&#039;t imagine any &quot;expert&quot; memorizing all the method names therefore working without code completion features ans so on. Not to mention the debugging which is a big no with PHP.

About the MVC arhitecture itself... I&#039;m not a big fan of it. I find the ASP.Net and it&#039;s code behind files plus the App.config files to do the job just fine. However even ASP.Net has a MVC version nowdays, so I&#039;m guessing there&#039;s something to it.

About the Magento itself... I&#039;m currently loosing my mind with it :) I&#039;m always for learning new things, digging into something ans stuff like that but Magento makes the simplest things so hard (stuff like Module development). All I know for now is that one should be Zend Framework master to get thing rolling with Magento.

Hopefully no hard feelings for the things said here :) 

I really appreciate other people views on things, cause no one is perfect. Plus we all sometimes change our views on some topics over time. I entered Magento waters with great enthusiasm, therefore I said a lot of good stuff about it. For the last two weeks I&#039;m breaking my neck over it. So, as some of you might notice I paused my blogging for a while :)

All the best men. p.s. Feel free to put some comments on my site as well, http://activecodeline.com.

Thank you.</description>
		<content:encoded><![CDATA[<p>&#8220;You are clearly uninformed of what true OOP is&#8221;</p>
<p>I come from .NET (C#) and I belive I have a pretty good understanding of what OOP is. PHP 5 lacks great amount of features as a language to even compare to C#. However, it still functions as OOP language. Hopefuly version 6 will be better. </p>
<p>I agree the code is&#8230; hmmm&#8230; would not say bad, but disconnected. There is simply to many of the M, V and C-s around. What makes it catastrophic is the full lack of good comments in the code and the general lack of good (aka MS SDK) documentation. System this big needs good IDE, since I can&#8217;t imagine any &#8220;expert&#8221; memorizing all the method names therefore working without code completion features ans so on. Not to mention the debugging which is a big no with PHP.</p>
<p>About the MVC arhitecture itself&#8230; I&#8217;m not a big fan of it. I find the ASP.Net and it&#8217;s code behind files plus the App.config files to do the job just fine. However even ASP.Net has a MVC version nowdays, so I&#8217;m guessing there&#8217;s something to it.</p>
<p>About the Magento itself&#8230; I&#8217;m currently loosing my mind with it <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I&#8217;m always for learning new things, digging into something ans stuff like that but Magento makes the simplest things so hard (stuff like Module development). All I know for now is that one should be Zend Framework master to get thing rolling with Magento.</p>
<p>Hopefully no hard feelings for the things said here <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>I really appreciate other people views on things, cause no one is perfect. Plus we all sometimes change our views on some topics over time. I entered Magento waters with great enthusiasm, therefore I said a lot of good stuff about it. For the last two weeks I&#8217;m breaking my neck over it. So, as some of you might notice I paused my blogging for a while <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>All the best men. p.s. Feel free to put some comments on my site as well, <a href="http://activecodeline.com" rel="nofollow">http://activecodeline.com</a>.</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joy</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-256</link>
		<dc:creator>Joy</dc:creator>
		<pubDate>Thu, 23 Oct 2008 02:44:29 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-256</guid>
		<description>&lt;blockquote&gt;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.&lt;/blockquote&gt;
You are clearly uninformed of what true OOP is. Hopefully we will not see more CMS solutions with this architecture because it is truly a terrible way to do things.

There is nothing Object-Oriented about Magento. It is built on the Zend framework, so a lot of the mess is caused by that. This awful code is what I call &quot;object-based&quot;. Because the data and the methods to act on it are not totally encapsulated, you need kludgy functions like getSingleton and getData, so you can operate on some container of some values. You shouldn&#039;t need to do that in an object-oriented system. This generates a lot of code that is very similar and hard to debug and hard to maintain and has performance issues as well.

Sorry, I have nothing good to say about Magento, except that the concept is nice. The implementation is atrocious.  It reminds me of the code I was working on for the U.S. Postal system Point-of-Sale. It was so bad I  changed jobs. This code is very similar.  Awful!</description>
		<content:encoded><![CDATA[<blockquote><p>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.</p></blockquote>
<p>You are clearly uninformed of what true OOP is. Hopefully we will not see more CMS solutions with this architecture because it is truly a terrible way to do things.</p>
<p>There is nothing Object-Oriented about Magento. It is built on the Zend framework, so a lot of the mess is caused by that. This awful code is what I call &#8220;object-based&#8221;. Because the data and the methods to act on it are not totally encapsulated, you need kludgy functions like getSingleton and getData, so you can operate on some container of some values. You shouldn&#8217;t need to do that in an object-oriented system. This generates a lot of code that is very similar and hard to debug and hard to maintain and has performance issues as well.</p>
<p>Sorry, I have nothing good to say about Magento, except that the concept is nice. The implementation is atrocious.  It reminds me of the code I was working on for the U.S. Postal system Point-of-Sale. It was so bad I  changed jobs. This code is very similar.  Awful!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pointlessjon</title>
		<link>http://inchoo.net/ecommerce/magento/making-use-of-magento-getsingleton-method/comment-page-1/#comment-221</link>
		<dc:creator>Pointlessjon</dc:creator>
		<pubDate>Mon, 13 Oct 2008 18:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=170#comment-221</guid>
		<description>excellent. I can definitely see this helping when you&#039;re calling on data that has already been instantiated. Whereas other times, say, you want to get a different listing of products from a category than the one magento will already be loading, you would then instantiate an entirely new object utilizing the other methods. thanks again for sharing the infos Branko</description>
		<content:encoded><![CDATA[<p>excellent. I can definitely see this helping when you&#8217;re calling on data that has already been instantiated. Whereas other times, say, you want to get a different listing of products from a category than the one magento will already be loading, you would then instantiate an entirely new object utilizing the other methods. thanks again for sharing the infos Branko</p>
]]></content:encoded>
	</item>
</channel>
</rss>
