<?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: Extended Model for CodeIgniter</title>
	<atom:link href="http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/feed/" rel="self" type="application/rss+xml" />
	<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-model-for-codeigniter</link>
	<description>The everyday sharing of Emran Hasan on software development.</description>
	<lastBuildDate>Wed, 25 Jan 2012 15:11:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Steve N.</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-583</link>
		<dc:creator>Steve N.</dc:creator>
		<pubDate>Thu, 28 Oct 2010 18:50:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-583</guid>
		<description>Hi there,

Great library- thank you sharing.  I&#039;m having a bit of trouble though.  I&#039;m getting duplicate entry errors when I try to save a model object.  It appears that it&#039;s trying to insert when it should update.  Here&#039;s the code in one of my custom libraries that uses an extended model:
&lt;code&gt;
$this-&gt;CI-&gt;load-&gt;model(&#039;membership_model&#039;);
$membership = $this-&gt;CI-&gt;membership_model-&gt;find(&quot;merchantId = &#039;$merchantId&#039; AND customerId = &#039;$customerId&#039;&quot;);

if($membership) {  // this membership already exists
	$membership[&#039;points&#039;]++;
}
else {  // this is a new membership
	$this-&gt;CI-&gt;membership_model-&gt;create();
	$membership[&#039;merchantId&#039;] = $merchantId;
	$membership[&#039;customerId&#039;] = $customerId;
	$membership[&#039;points&#039;] = 1;
	$membership[&#039;created&#039;] = date(&quot;Y-m-d H:i:s&quot;);
}

$this-&gt;CI-&gt;membership_model-&gt;save($membership);
...
&lt;/code&gt;

And this is the constructor for &quot;membership_model.php&quot;:
&lt;code&gt;
function __construct() {
        // Call the Model constructor
        parent::__construct();
        $this-&gt;loadTable(&#039;memberships&#039;);
        $this-&gt;primaryKey = &#039;membershipId&#039;;
}
&lt;/code&gt;

What am I doing wrong here?</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>Great library- thank you sharing.  I&#8217;m having a bit of trouble though.  I&#8217;m getting duplicate entry errors when I try to save a model object.  It appears that it&#8217;s trying to insert when it should update.  Here&#8217;s the code in one of my custom libraries that uses an extended model:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$this-&amp;gt;CI-&amp;gt;load-&amp;gt;model('membership_model');<br />
$membership = $this-&amp;gt;CI-&amp;gt;membership_model-&amp;gt;find(&quot;merchantId = '$merchantId' AND customerId = '$customerId'&quot;);<br />
<br />
if($membership) { &nbsp;// this membership already exists<br />
&nbsp; &nbsp; $membership['points']++;<br />
}<br />
else { &nbsp;// this is a new membership<br />
&nbsp; &nbsp; $this-&amp;gt;CI-&amp;gt;membership_model-&amp;gt;create();<br />
&nbsp; &nbsp; $membership['merchantId'] = $merchantId;<br />
&nbsp; &nbsp; $membership['customerId'] = $customerId;<br />
&nbsp; &nbsp; $membership['points'] = 1;<br />
&nbsp; &nbsp; $membership['created'] = date(&quot;Y-m-d H:i:s&quot;);<br />
}<br />
<br />
$this-&amp;gt;CI-&amp;gt;membership_model-&amp;gt;save($membership);<br />
...</div></div>
<p>And this is the constructor for &#8220;membership_model.php&#8221;:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">function __construct() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Call the Model constructor<br />
&nbsp; &nbsp; &nbsp; &nbsp; parent::__construct();<br />
&nbsp; &nbsp; &nbsp; &nbsp; $this-&amp;gt;loadTable('memberships');<br />
&nbsp; &nbsp; &nbsp; &nbsp; $this-&amp;gt;primaryKey = 'membershipId';<br />
}</div></div>
<p>What am I doing wrong here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: reneegate</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-582</link>
		<dc:creator>reneegate</dc:creator>
		<pubDate>Fri, 09 Jul 2010 01:25:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-582</guid>
		<description>Hello,
very nice work,has anybody developed multi tables model using mysql views?

reneegate</description>
		<content:encoded><![CDATA[<p>Hello,<br />
very nice work,has anybody developed multi tables model using mysql views?</p>
<p>reneegate</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Code Updates (HTTP class, Extended CodeIgniter Model, Cross-domain AJAX transport) &#124; Md Emran Hasan (phpfour)</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-581</link>
		<dc:creator>Code Updates (HTTP class, Extended CodeIgniter Model, Cross-domain AJAX transport) &#124; Md Emran Hasan (phpfour)</dc:creator>
		<pubDate>Wed, 18 Feb 2009 21:27:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-581</guid>
		<description>[...] original version of the Extended Model for CodeIgniter has been serving many people well. Although most users loved [...]</description>
		<content:encoded><![CDATA[<p>[...] original version of the Extended Model for CodeIgniter has been serving many people well. Although most users loved [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: haran</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-563</link>
		<dc:creator>haran</dc:creator>
		<pubDate>Wed, 20 Aug 2008 15:20:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-563</guid>
		<description>Great work. It saves us a lot of time.</description>
		<content:encoded><![CDATA[<p>Great work. It saves us a lot of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mariano Iglesias</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-571</link>
		<dc:creator>Mariano Iglesias</dc:creator>
		<pubDate>Mon, 18 Aug 2008 19:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-571</guid>
		<description>@joshdavey: why do a lot of people INSIST ON NOT READING before posting? Check the previous messages, this was SOLVED long ago.</description>
		<content:encoded><![CDATA[<p>@joshdavey: why do a lot of people INSIST ON NOT READING before posting? Check the previous messages, this was SOLVED long ago.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joshdavey</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-572</link>
		<dc:creator>joshdavey</dc:creator>
		<pubDate>Mon, 18 Aug 2008 19:00:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-572</guid>
		<description>@Mariano Iglesias

You really want him to re-name &quot;query(), &quot;getNumRows()&quot;, &quot;$this-&gt;data&quot; and other method/property names? These are standard method names used by pretty much every database abstraction layer in the history of programming.

Saying phpfour isn&#039;t respecting the MIT license is a bit harsh. He&#039;s just looking at other libraries for inspiration and building his own. Nothing wrong with that.</description>
		<content:encoded><![CDATA[<p>@Mariano Iglesias</p>
<p>You really want him to re-name &#8220;query(), &#8220;getNumRows()&#8221;, &#8220;$this-&gt;data&#8221; and other method/property names? These are standard method names used by pretty much every database abstraction layer in the history of programming.</p>
<p>Saying phpfour isn&#8217;t respecting the MIT license is a bit harsh. He&#8217;s just looking at other libraries for inspiration and building his own. Nothing wrong with that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Emran Hasan</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-579</link>
		<dc:creator>Emran Hasan</dc:creator>
		<pubDate>Fri, 08 Aug 2008 13:34:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-579</guid>
		<description>@Ryan: I fully agree with Mariano and would misjudge the CI community in the same way, seeing your response.

What Mariano did was just to remind me something that I forgot, although in a bit rough way, but he had no bad intention in mind and I thanked him for that.

We&#039;re all community enthusiastic, let&#039;s not create divisions and point fingers.</description>
		<content:encoded><![CDATA[<p>@Ryan: I fully agree with Mariano and would misjudge the CI community in the same way, seeing your response.</p>
<p>What Mariano did was just to remind me something that I forgot, although in a bit rough way, but he had no bad intention in mind and I thanked him for that.</p>
<p>We&#8217;re all community enthusiastic, let&#8217;s not create divisions and point fingers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mariano Iglesias</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-580</link>
		<dc:creator>Mariano Iglesias</dc:creator>
		<pubDate>Fri, 08 Aug 2008 13:13:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-580</guid>
		<description>Having been (and currently beeing) on several open source projects I know this is not unheard of. But people like Ryan on his comment above (showing that his brain consists only of derogative terms) certainly do not help the projects.

For the sake of CI, I hope you have more of the &quot;other kind&quot; of people. You know, people that KNOW something about something, and HELP the project back, for a change.</description>
		<content:encoded><![CDATA[<p>Having been (and currently beeing) on several open source projects I know this is not unheard of. But people like Ryan on his comment above (showing that his brain consists only of derogative terms) certainly do not help the projects.</p>
<p>For the sake of CI, I hope you have more of the &#8220;other kind&#8221; of people. You know, people that KNOW something about something, and HELP the project back, for a change.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-578</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Sun, 03 Aug 2008 01:39:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-578</guid>
		<description>@Mariano Douchebag Boy

Go away you miserable creature.  Take your nastiness to a cake forum.</description>
		<content:encoded><![CDATA[<p>@Mariano Douchebag Boy</p>
<p>Go away you miserable creature.  Take your nastiness to a cake forum.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stensi</title>
		<link>http://phpfour.com/blog/2008/07/extended-model-for-codeigniter/#comment-566</link>
		<dc:creator>stensi</dc:creator>
		<pubDate>Wed, 23 Jul 2008 02:22:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpfour.com/blog/?p=104#comment-566</guid>
		<description>Although after testing, that doesn&#039;t work o.O

Leaving out the CI_ and putting it in application/libraries allows it to run perfectly fine.

I wonder why CodeIgniter doesn&#039;t allow the CI_ override for the Model?</description>
		<content:encoded><![CDATA[<p>Although after testing, that doesn&#8217;t work o.O</p>
<p>Leaving out the CI_ and putting it in application/libraries allows it to run perfectly fine.</p>
<p>I wonder why CodeIgniter doesn&#8217;t allow the CI_ override for the Model?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: phpfour.com @ 2012-02-07 19:32:59 -->
