<?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: The irony of Model::deleteAll()</title>
	<atom:link href="http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Tue, 31 Jan 2012 15:12:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-2/#comment-102678</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 14 Aug 2008 16:34:27 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-102678</guid>
		<description>@Fordnox: Yes, that&#039;s a good alternative (at least if it is ok that auto_increment fields get reset).</description>
		<content:encoded><![CDATA[<p>@Fordnox: Yes, that&#8217;s a good alternative (at least if it is ok that auto_increment fields get reset).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fordnox</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-2/#comment-102593</link>
		<dc:creator>Fordnox</dc:creator>
		<pubDate>Wed, 13 Aug 2008 18:25:13 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-102593</guid>
		<description>Have not read all the comment and i do not know what is being discussed in there, but for me is is easier to write such function in app_model.php

	function truncate() {
		return $this-&gt;query(&quot;TRUNCATE &quot;.$this-&gt;table);
	}</description>
		<content:encoded><![CDATA[<p>Have not read all the comment and i do not know what is being discussed in there, but for me is is easier to write such function in app_model.php</p>
<p>	function truncate() {<br />
		return $this-&gt;query(&#8220;TRUNCATE &#8220;.$this-&gt;table);<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-2/#comment-59608</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 24 Jan 2008 18:08:59 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-59608</guid>
		<description>@Cameron: At least to me it is redundant if you have to write something like:
&lt;pre&gt;
$this-&gt;MyModel-&gt;deleteAll(DELETE_ALL_RECORDS);
&lt;/pre&gt;
But as you see in the other comments, half of the people think it is good to have such a flag, and the other half think it is not necessary ;-)</description>
		<content:encoded><![CDATA[<p>@Cameron: At least to me it is redundant if you have to write something like:</p>
<pre>
$this-&gt;MyModel-&gt;deleteAll(DELETE_ALL_RECORDS);
</pre>
<p>But as you see in the other comments, half of the people think it is good to have such a flag, and the other half think it is not necessary ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cameron Junge</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-2/#comment-58871</link>
		<dc:creator>Cameron Junge</dc:creator>
		<pubDate>Mon, 21 Jan 2008 23:19:16 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-58871</guid>
		<description>Ok, coming in a little late...

how about a constant?

define(&#039;DELETE_ALL_RECORDS&#039;, true); 
// ideally a class constant, maybe Model::$DELETE_ALL_RECORDS?

Just for use as a flag really. I like the idea of using &quot;true&quot; rather than just assuming blank conditions mean you want to do it (could be a bug for instance). A little conscious thought isn&#039;t always a bad thing, and TRUE is a lot more intuitive than &quot;1 = 1&quot;.</description>
		<content:encoded><![CDATA[<p>Ok, coming in a little late&#8230;</p>
<p>how about a constant?</p>
<p>define(&#8216;DELETE_ALL_RECORDS&#8217;, true);<br />
// ideally a class constant, maybe Model::$DELETE_ALL_RECORDS?</p>
<p>Just for use as a flag really. I like the idea of using &#8220;true&#8221; rather than just assuming blank conditions mean you want to do it (could be a bug for instance). A little conscious thought isn&#8217;t always a bad thing, and TRUE is a lot more intuitive than &#8220;1 = 1&#8243;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-1/#comment-49012</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Thu, 27 Dec 2007 16:02:58 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-49012</guid>
		<description>@Tim: Yes, that would be better :)</description>
		<content:encoded><![CDATA[<p>@Tim: Yes, that would be better :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Daldini</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-1/#comment-48307</link>
		<dc:creator>Tim Daldini</dc:creator>
		<pubDate>Tue, 25 Dec 2007 15:35:19 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-48307</guid>
		<description>what about the slightly less redundant $this-&gt;MyModel-&gt;deleteAll($confirmdelete = true);

Or something. I haven&#039;t tried it but I think it should pass a true boolean to the function.</description>
		<content:encoded><![CDATA[<p>what about the slightly less redundant $this-&gt;MyModel-&gt;deleteAll($confirmdelete = true);</p>
<p>Or something. I haven&#8217;t tried it but I think it should pass a true boolean to the function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-1/#comment-47701</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 24 Dec 2007 06:20:45 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-47701</guid>
		<description>@ifunk: Thanks for your comment!

Yes, if I read your snippet it is obvious what it does. On the other hand it introduces some redundancies...</description>
		<content:encoded><![CDATA[<p>@ifunk: Thanks for your comment!</p>
<p>Yes, if I read your snippet it is obvious what it does. On the other hand it introduces some redundancies&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ifunk</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-1/#comment-46999</link>
		<dc:creator>ifunk</dc:creator>
		<pubDate>Sat, 22 Dec 2007 17:09:11 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-46999</guid>
		<description>The solution to this problem....

$delete_all_records = 1;
$this-&gt;MyModel-&gt;deleteAll($delete_all_records);

It&#039;s obvious when you read over the code what it does and I doubt you could do it inadvertently :)</description>
		<content:encoded><![CDATA[<p>The solution to this problem&#8230;.</p>
<p>$delete_all_records = 1;<br />
$this-&gt;MyModel-&gt;deleteAll($delete_all_records);</p>
<p>It&#8217;s obvious when you read over the code what it does and I doubt you could do it inadvertently :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-1/#comment-44824</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 17 Dec 2007 06:47:58 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-44824</guid>
		<description>@purepear, Proleter: Thanks for your comments!

@Proleter: Yes, it is like the messages the OS shows you when you want to delete some files. They don&#039;t prevent that you delete the wrong files.</description>
		<content:encoded><![CDATA[<p>@purepear, Proleter: Thanks for your comments!</p>
<p>@Proleter: Yes, it is like the messages the OS shows you when you want to delete some files. They don&#8217;t prevent that you delete the wrong files.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Proleter</title>
		<link>http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/comment-page-1/#comment-44065</link>
		<dc:creator>Proleter</dc:creator>
		<pubDate>Sat, 15 Dec 2007 07:31:20 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/2007/12/06/the-irony-of-modeldeleteall/#comment-44065</guid>
		<description>dho, I think that such small glitches helps me a lot to understand the framework and go deeper into it. Thanks for that. 

The &quot;Are you sure?&quot; parameters are more like a personal preference than necessity in the core code. It doesn&#039;t hurts putting three letters and no it doesn&#039;t gives extra protection.  You can force the programmer to pass a parameter: &quot;array(&#039;1=Yes, I wan&#039;t to delete all the records. I&#039;m sure I want to do that. Yes I know what I&#039;m doing!&#039; &quot; and still to accedently delete all the records.

Mariano Iglesias, will you stop being bitch and start giving some productive (or at least technical) comments? You sound like a priest who gets offended about his religion.</description>
		<content:encoded><![CDATA[<p>dho, I think that such small glitches helps me a lot to understand the framework and go deeper into it. Thanks for that. </p>
<p>The &#8220;Are you sure?&#8221; parameters are more like a personal preference than necessity in the core code. It doesn&#8217;t hurts putting three letters and no it doesn&#8217;t gives extra protection.  You can force the programmer to pass a parameter: &#8220;array(&#8217;1=Yes, I wan&#8217;t to delete all the records. I&#8217;m sure I want to do that. Yes I know what I&#8217;m doing!&#8217; &#8221; and still to accedently delete all the records.</p>
<p>Mariano Iglesias, will you stop being bitch and start giving some productive (or at least technical) comments? You sound like a priest who gets offended about his religion.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

