<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 22 May 2013 18:55:04 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Blog.szajbe.pl:  Not so obvious behavior of $uses in CakePHP]]></title>
      <guid>http://www.phpdeveloper.org/news/10570</guid>
      <link>http://www.phpdeveloper.org/news/10570</link>
      <description><![CDATA[<p>
In <a href="http://blog.szajbe.pl/2008/07/07/not-so-obvious-behavior-of-uses-in-cakephp/">this new post</a> to the blog.szajbe.pl site a dilemma is presented - CakePHP models are not working they way one would think they should.
</p>
<blockquote>
In CakePHP you declare what models you're going to use in a controller by defining $uses variable. You can also define it in AppController to have a certain set of models available in every controller. However be careful when doing it because you may put yourself in an unexpected situation as I did recently.
</blockquote>
<p>
As soon as he made his script include a 'User' model in every quest, his logins stopped working. His script errored with a "Database table sessions for model Session was not found" message and refused to work. Digging deeper, he found that CakePHP merges an AppController's $uses value with the SessionControler's values. One overrides the other and your 'User' gets lost in the shuffle.
</p>
<blockquote>
Do you have a rational explanation for such behavior? I have none. It's very unintuitive for me.
</blockquote>]]></description>
      <pubDate>Wed, 09 Jul 2008 12:02:41 -0500</pubDate>
    </item>
  </channel>
</rss>
