<?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: CakePHP: grab only the data you need</title>
	<atom:link href="http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/feed/" rel="self" type="application/rss+xml" />
	<link>http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/</link>
	<description>A human weblog about Web technology and other ephemera</description>
	<lastBuildDate>Thu, 12 Jan 2012 10:22:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: othman ouahbi</title>
		<link>http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/comment-page-1/#comment-45585</link>
		<dc:creator>othman ouahbi</dc:creator>
		<pubDate>Sun, 18 Mar 2007 06:00:07 +0000</pubDate>
		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=304#comment-45585</guid>
		<description>&lt;p&gt;: to get ride of null, null, null, -1.
It&#039;s important to note that aa() and a() are slow functions so probably a little bit extra code wouldn&#039;t harm:
$this-&gt;Thing-&gt;recursive = -1;
$data = $this-&gt;Thing-&gt;findAll( array(&quot;Thing.user&lt;em&gt;id&quot; =&gt; $user&lt;/em&gt;id), array(&quot;id&quot;, &quot;name&quot;));&lt;/p&gt;

&lt;p&gt;problem with conditions is, it doesn&#039;t reach associations other than belongTo and you can&#039;t go deep in the association, same thing for the second param.
See: 
https://trac.cakephp.org/ticket/633
https://trac.cakephp.org/ticket/1037&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>: to get ride of null, null, null, -1.<br />
It&#8217;s important to note that aa() and a() are slow functions so probably a little bit extra code wouldn&#8217;t harm:<br />
$this-&gt;Thing-&gt;recursive = -1;<br />
$data = $this-&gt;Thing-&gt;findAll( array(&#8220;Thing.user<em>id&#8221; =&gt; $user</em>id), array(&#8220;id&#8221;, &#8220;name&#8221;));</p>
<p>problem with conditions is, it doesn&#8217;t reach associations other than belongTo and you can&#8217;t go deep in the association, same thing for the second param.<br />
See:<br />
<a href="https://trac.cakephp.org/ticket/633" rel="nofollow">https://trac.cakephp.org/ticket/633</a><br />
<a href="https://trac.cakephp.org/ticket/1037" rel="nofollow">https://trac.cakephp.org/ticket/1037</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olexandr Melnyk &#187; CakePHP: ungreedy grabbing</title>
		<link>http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/comment-page-1/#comment-35225</link>
		<dc:creator>Olexandr Melnyk &#187; CakePHP: ungreedy grabbing</dc:creator>
		<pubDate>Mon, 23 Oct 2006 19:21:53 +0000</pubDate>
		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=304#comment-35225</guid>
		<description>&lt;p&gt;[...] A while ago, working on a project in CakePHP, I needed to set up more complex fetching rules than just changing recursion depth. Fortunately, CakePHP offered such flexibility. [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] A while ago, working on a project in CakePHP, I needed to set up more complex fetching rules than just changing recursion depth. Fortunately, CakePHP offered such flexibility. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mladen Mihajlovic</title>
		<link>http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/comment-page-1/#comment-32870</link>
		<dc:creator>Mladen Mihajlovic</dc:creator>
		<pubDate>Fri, 22 Sep 2006 10:37:10 +0000</pubDate>
		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=304#comment-32870</guid>
		<description>&lt;p&gt;Hmm, maybe I should be a bit more rhobust in my example.&lt;/p&gt;

&lt;p&gt;class Thing {&lt;/p&gt;

&lt;p&gt;var $hasMany = array(
   &#039;AnotherThing&#039; =&gt; array(
      &#039;className&#039; =&gt; &#039;AnotherThing&#039;
   ),
   &#039;SomeOtherThing&#039; =&gt; array(
      &#039;className&#039; =&gt; &#039;SomeOtherThing&#039;
   ),
   &#039;YetAnotherThing&#039; =&gt; array(
      &#039;className&#039; =&gt; &#039;YetAnotherThing&#039;
   )
);
}&lt;/p&gt;

&lt;p&gt;so the above unbind model would remove the bindings for the 1st 2 associations and leave the third one.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hmm, maybe I should be a bit more rhobust in my example.</p>
<p>class Thing {</p>
<p>var $hasMany = array(<br />
   &#8216;AnotherThing&#8217; =&gt; array(<br />
      &#8216;className&#8217; =&gt; &#8216;AnotherThing&#8217;<br />
   ),<br />
   &#8216;SomeOtherThing&#8217; =&gt; array(<br />
      &#8216;className&#8217; =&gt; &#8216;SomeOtherThing&#8217;<br />
   ),<br />
   &#8216;YetAnotherThing&#8217; =&gt; array(<br />
      &#8216;className&#8217; =&gt; &#8216;YetAnotherThing&#8217;<br />
   )<br />
);<br />
}</p>
<p>so the above unbind model would remove the bindings for the 1st 2 associations and leave the third one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mladen Mihajlovic</title>
		<link>http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/comment-page-1/#comment-32869</link>
		<dc:creator>Mladen Mihajlovic</dc:creator>
		<pubDate>Fri, 22 Sep 2006 10:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=304#comment-32869</guid>
		<description>&lt;p&gt;Heh, yeah I struggled with it a bit in the beginning too. &lt;/p&gt;

&lt;p&gt;$this-&gt;Thing-&gt;unbindModel( array( &#039;hasMany&#039; =&gt; array(&#039;AnotherThing, &#039;SomeOtherThing&#039;) ) );&lt;/p&gt;

&lt;p&gt;Basically the first array holds the keywords &#039;hasMany&#039;, &#039;belongsTo&#039; etc.. each array within that would hold the names you gave the associations in your model.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Heh, yeah I struggled with it a bit in the beginning too. </p>
<p>$this-&gt;Thing-&gt;unbindModel( array( &#8216;hasMany&#8217; =&gt; array(&#8216;AnotherThing, &#8216;SomeOtherThing&#8217;) ) );</p>
<p>Basically the first array holds the keywords &#8216;hasMany&#8217;, &#8216;belongsTo&#8217; etc.. each array within that would hold the names you gave the associations in your model.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: olleolleolle</title>
		<link>http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/comment-page-1/#comment-32868</link>
		<dc:creator>olleolleolle</dc:creator>
		<pubDate>Fri, 22 Sep 2006 10:00:05 +0000</pubDate>
		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=304#comment-32868</guid>
		<description>&lt;p&gt;Thanks, Mladen. I could not figure out how unbindModel wanted its parameters, so after some digging, I asked the IRC hivemind about the thing, and AD7six piped up about the final param set to -1.&lt;/p&gt;

&lt;p&gt;If you have an &lt;code&gt;unbindModel&lt;/code&gt; example handy, I&#039;d be pleased to update the post with it.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks, Mladen. I could not figure out how unbindModel wanted its parameters, so after some digging, I asked the IRC hivemind about the thing, and AD7six piped up about the final param set to -1.</p>
<p>If you have an <code>unbindModel</code> example handy, I&#8217;d be pleased to update the post with it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mladen Mihajlovic</title>
		<link>http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/comment-page-1/#comment-32867</link>
		<dc:creator>Mladen Mihajlovic</dc:creator>
		<pubDate>Fri, 22 Sep 2006 09:55:29 +0000</pubDate>
		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=304#comment-32867</guid>
		<description>&lt;p&gt;Whoops, missed the -1 paramter there. Still the unbindModel stands as a suggestion in case you need to remove &lt;em&gt;some&lt;/em&gt; assications and leave others.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Whoops, missed the -1 paramter there. Still the unbindModel stands as a suggestion in case you need to remove <em>some</em> assications and leave others.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mladen Mihajlovic</title>
		<link>http://ollehost.dk/blog/2006/09/21/cakephp-optimization-hint/comment-page-1/#comment-32866</link>
		<dc:creator>Mladen Mihajlovic</dc:creator>
		<pubDate>Fri, 22 Sep 2006 09:53:28 +0000</pubDate>
		<guid isPermaLink="false">http://olle.ter.dk/blog/?p=304#comment-32866</guid>
		<description>&lt;p&gt;The other suggestion would be to use $this-&gt;Thing-&gt;unbindModel(...) to remove any unneeded associations.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The other suggestion would be to use $this-&gt;Thing-&gt;unbindModel(&#8230;) to remove any unneeded associations.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

