<?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: Using a table without corresponding model</title>
	<atom:link href="http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/feed/" rel="self" type="application/rss+xml" />
	<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/</link>
	<description>baking cakes with CakePHP</description>
	<lastBuildDate>Sat, 13 Mar 2010 15:19:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-107440</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Mon, 22 Sep 2008 15:04:58 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-107440</guid>
		<description>@skiedr: Yeah, the solution using the ClassRegistry looks cleaner. But personally I&#039;m not so happy about ClassRegistry::init(), as a) the method name is misnamed and b) I think this functionality should be somewhere else.

@Rafael: Yes, you are right, that also works. I would have expected this method to fail in such a case, because there is no such model to load. Anyway, thanks for the hint!</description>
		<content:encoded><![CDATA[<p>@skiedr: Yeah, the solution using the ClassRegistry looks cleaner. But personally I&#8217;m not so happy about ClassRegistry::init(), as a) the method name is misnamed and b) I think this functionality should be somewhere else.</p>
<p>@Rafael: Yes, you are right, that also works. I would have expected this method to fail in such a case, because there is no such model to load. Anyway, thanks for the hint!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rafaelbandeira3</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-107315</link>
		<dc:creator>rafaelbandeira3</dc:creator>
		<pubDate>Sun, 21 Sep 2008 16:24:04 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-107315</guid>
		<description>Now I was wondering, you could just use Controller::loadModel(), couldn&#039;t you?

$this-&gt;loadModel(&#039;Month&#039;);
$this-&gt;Month-&gt;find(&#039;all&#039;);

Cleaner and &quot;cakisher&quot;.</description>
		<content:encoded><![CDATA[<p>Now I was wondering, you could just use Controller::loadModel(), couldn&#8217;t you?</p>
<p>$this-&gt;loadModel(&#8216;Month&#8217;);<br />
$this-&gt;Month-&gt;find(&#8216;all&#8217;);</p>
<p>Cleaner and &#8220;cakisher&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rafaelbandeira3</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-107314</link>
		<dc:creator>rafaelbandeira3</dc:creator>
		<pubDate>Sun, 21 Sep 2008 16:22:01 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-107314</guid>
		<description>@Tim Koschuetzki: I wouldn&#039;t say &quot;a hack&quot; as it only works because Cake supports it, the already mentioned by hartjes: &quot;dynamic models&quot;, so, as commented about a feature in my blog: &quot;a valid solution&quot;.</description>
		<content:encoded><![CDATA[<p>@Tim Koschuetzki: I wouldn&#8217;t say &#8220;a hack&#8221; as it only works because Cake supports it, the already mentioned by hartjes: &#8220;dynamic models&#8221;, so, as commented about a feature in my blog: &#8220;a valid solution&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: skiedr</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-107299</link>
		<dc:creator>skiedr</dc:creator>
		<pubDate>Sun, 21 Sep 2008 12:42:41 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-107299</guid>
		<description>Solution with ClassRegistry looks more correct from ideology point of view.
Code that used ClassRegistry::init still work correctly in test suite without any changes.</description>
		<content:encoded><![CDATA[<p>Solution with ClassRegistry looks more correct from ideology point of view.<br />
Code that used ClassRegistry::init still work correctly in test suite without any changes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Koschuetzki</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-107236</link>
		<dc:creator>Tim Koschuetzki</dc:creator>
		<pubDate>Sat, 20 Sep 2008 22:47:02 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-107236</guid>
		<description>@Adny: Please explain your model setup.

Hrm seems like a hack to me. :) But if it gets the job done the client wont care much.</description>
		<content:encoded><![CDATA[<p>@Adny: Please explain your model setup.</p>
<p>Hrm seems like a hack to me. :) But if it gets the job done the client wont care much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cakebaker</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-107042</link>
		<dc:creator>cakebaker</dc:creator>
		<pubDate>Fri, 19 Sep 2008 14:35:26 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-107042</guid>
		<description>@all: Thanks for your comments!

@Stepan: At least according to &lt;a href=&quot;http://www.littlehart.net/atthekeyboard/2008/08/05/dynamic-models-in-cakephp-12/&quot; rel=&quot;nofollow&quot;&gt;Chris Hartjes&#039; article&lt;/a&gt; it is a feature. 

@Bruno: Yes, if you want to inherit app-specific functionality you have to instantiate the AppModel class. In that case you have to change the import statement of the first example to:
&lt;code&gt;
App::import(&#039;Model&#039;, &#039;App&#039;);
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>@all: Thanks for your comments!</p>
<p>@Stepan: At least according to <a href="http://www.littlehart.net/atthekeyboard/2008/08/05/dynamic-models-in-cakephp-12/" rel="nofollow">Chris Hartjes&#8217; article</a> it is a feature. </p>
<p>@Bruno: Yes, if you want to inherit app-specific functionality you have to instantiate the AppModel class. In that case you have to change the import statement of the first example to:<br />
<code>App::import('Model', 'App');</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruno Bergher</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-106857</link>
		<dc:creator>Bruno Bergher</dc:creator>
		<pubDate>Thu, 18 Sep 2008 16:49:31 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-106857</guid>
		<description>Considering what Stepan raises, shouldn&#039;t the first example instantiate AppModel, in order to inherit app-specific functionality, instead of the vanilla core Model?

This is pretty interesting by the way, thanks.</description>
		<content:encoded><![CDATA[<p>Considering what Stepan raises, shouldn&#8217;t the first example instantiate AppModel, in order to inherit app-specific functionality, instead of the vanilla core Model?</p>
<p>This is pretty interesting by the way, thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stepan Stolyarov</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-106854</link>
		<dc:creator>Stepan Stolyarov</dc:creator>
		<pubDate>Thu, 18 Sep 2008 16:19:45 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-106854</guid>
		<description>I&#039;ve noticed that CakePHP performs the same trick when you (accidentally) write something like 

&lt;code&gt;
class Foo extends AppModel {
  var $hasMany = array(&#039;Bars&#039;); // note plural
}
&lt;/code&gt;

Here, it instantiates AppModel to deal with bars table.

Took me a few hours to determine why Bar::afterSave() is not called — it was not the class I needed! Still don&#039;t know whether it&#039;s a bug or a feature. :)</description>
		<content:encoded><![CDATA[<p>I&#8217;ve noticed that CakePHP performs the same trick when you (accidentally) write something like </p>
<pre><code>class Foo extends AppModel {
  var $hasMany = array('Bars'); // note plural
}</code></pre>
<p>Here, it instantiates AppModel to deal with bars table.</p>
<p>Took me a few hours to determine why Bar::afterSave() is not called — it was not the class I needed! Still don&#8217;t know whether it&#8217;s a bug or a feature. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://cakebaker.42dh.com/2008/09/18/using-a-table-without-corresponding-model/comment-page-1/#comment-106852</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Thu, 18 Sep 2008 16:05:02 +0000</pubDate>
		<guid isPermaLink="false">http://cakebaker.42dh.com/?p=822#comment-106852</guid>
		<description>That&#039;s great. I&#039;ll use this for retrieving icons for a given mimetype.</description>
		<content:encoded><![CDATA[<p>That&#8217;s great. I&#8217;ll use this for retrieving icons for a given mimetype.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
