<?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 for lukebaker.org</title>
	<atom:link href="http://lukebaker.org/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://lukebaker.org</link>
	<description>lukebaker.org</description>
	<lastBuildDate>Thu, 15 Sep 2011 16:37:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>Comment on Documentation by Matt Borja</title>
		<link>http://lukebaker.org/projects/activerecord-in-php/documentation/comment-page-1/#comment-31792</link>
		<dc:creator>Matt Borja</dc:creator>
		<pubDate>Thu, 15 Sep 2011 16:37:33 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/projects/activerecord-in-php/documentation/#comment-31792</guid>
		<description>Update (replace previous comment):

If you don&#039;t explicitly check the types while making comparisons, you&#039;ll find that

int(0) == (string)&#039;all&#039; OR (string)&#039;first&#039;

This is why passing 0 doesn&#039;t work or will yield ALL results. Find these lines in ActiveRecord.php (around 362-367) and add the === comparison operator (!== for bool NOT):

      if (is_array($id))
        $where = &quot;{$item-&gt;primary_key} IN (&quot; . implode(&quot;,&quot;, $id) . &quot;)&quot;;
      elseif ($id === &#039;first&#039;) 
        $limit = &#039;1&#039;;
      elseif ($id !== &#039;all&#039;)
        $where = &quot;{$item-&gt;table_name}.{$item-&gt;primary_key} = $id&quot;;</description>
		<content:encoded><![CDATA[<p>Update (replace previous comment):</p>
<p>If you don&#8217;t explicitly check the types while making comparisons, you&#8217;ll find that</p>
<p>int(0) == (string)&#8217;all&#8217; OR (string)&#8217;first&#8217;</p>
<p>This is why passing 0 doesn&#8217;t work or will yield ALL results. Find these lines in ActiveRecord.php (around 362-367) and add the === comparison operator (!== for bool NOT):</p>
<p>      if (is_array($id))<br />
        $where = &#8220;{$item-&gt;primary_key} IN (&#8221; . implode(&#8220;,&#8221;, $id) . &#8220;)&#8221;;<br />
      elseif ($id === &#8216;first&#8217;)<br />
        $limit = &#8217;1&#8242;;<br />
      elseif ($id !== &#8216;all&#8217;)<br />
        $where = &#8220;{$item-&gt;table_name}.{$item-&gt;primary_key} = $id&#8221;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Documentation by Matt Borja</title>
		<link>http://lukebaker.org/projects/activerecord-in-php/documentation/comment-page-1/#comment-31790</link>
		<dc:creator>Matt Borja</dc:creator>
		<pubDate>Thu, 15 Sep 2011 16:24:25 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/projects/activerecord-in-php/documentation/#comment-31790</guid>
		<description>Also, I had to add/modify these lines to pass 0 as a parameter of User::find((int)$id) in the event none was specified.

After $select = &#039;*&#039; on Line 361 of ActiveRecord.php
      if(is_numeric($id)) 
        $where = &quot;{$item-&gt;table_name}.{$item-&gt;primary_key} = $id&quot;;
      elseif (is_array($id))
        $where = &quot;{$item-&gt;primary_key} IN (&quot; . implode(&quot;,&quot;, $id) . &quot;)&quot;;</description>
		<content:encoded><![CDATA[<p>Also, I had to add/modify these lines to pass 0 as a parameter of User::find((int)$id) in the event none was specified.</p>
<p>After $select = &#8216;*&#8217; on Line 361 of ActiveRecord.php<br />
      if(is_numeric($id))<br />
        $where = &#8220;{$item-&gt;table_name}.{$item-&gt;primary_key} = $id&#8221;;<br />
      elseif (is_array($id))<br />
        $where = &#8220;{$item-&gt;primary_key} IN (&#8221; . implode(&#8220;,&#8221;, $id) . &#8220;)&#8221;;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Documentation by Matt Borja</title>
		<link>http://lukebaker.org/projects/activerecord-in-php/documentation/comment-page-1/#comment-31789</link>
		<dc:creator>Matt Borja</dc:creator>
		<pubDate>Thu, 15 Sep 2011 16:09:49 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/projects/activerecord-in-php/documentation/#comment-31789</guid>
		<description>It appears that if you set more than one PRIMARY KEY, that Users::find($id) will look at the last PRIMARY KEY and I found the $where query in ActiveRecord::generate_find_query() to come out as follows:

WHERE: users.email = &#039;5&#039;

In my table, I have these fields set as PRIMARY KEYS in the following order:

id
username
email

Just wanted to give you a heads up. For my uses, I&#039;m going to [and might suggest] revising it to look at the first PRIMARY KEY which in most applications is going to be the AUTO_INCREMENT id field.

At any rate, this is why I was having this problem earlier; multiple PRIMARY KEYS.</description>
		<content:encoded><![CDATA[<p>It appears that if you set more than one PRIMARY KEY, that Users::find($id) will look at the last PRIMARY KEY and I found the $where query in ActiveRecord::generate_find_query() to come out as follows:</p>
<p>WHERE: users.email = &#8217;5&#8242;</p>
<p>In my table, I have these fields set as PRIMARY KEYS in the following order:</p>
<p>id<br />
username<br />
email</p>
<p>Just wanted to give you a heads up. For my uses, I&#8217;m going to [and might suggest] revising it to look at the first PRIMARY KEY which in most applications is going to be the AUTO_INCREMENT id field.</p>
<p>At any rate, this is why I was having this problem earlier; multiple PRIMARY KEYS.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Documentation by Matt Borja</title>
		<link>http://lukebaker.org/projects/activerecord-in-php/documentation/comment-page-1/#comment-31788</link>
		<dc:creator>Matt Borja</dc:creator>
		<pubDate>Thu, 15 Sep 2011 16:01:07 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/projects/activerecord-in-php/documentation/#comment-31788</guid>
		<description>Is there a reason why this is throwing the following:

Couldn&#039;t find anything.

Code:
    public function view($id = NULL) {
        try {
            $u = User::find(1);
        } catch (Exception $e) {
            echo $e-&gt;getMessage();
        }

        if (isset($u))
            echo &#039;Found &#039; . $u-&gt;username;
    }</description>
		<content:encoded><![CDATA[<p>Is there a reason why this is throwing the following:</p>
<p>Couldn&#8217;t find anything.</p>
<p>Code:<br />
    public function view($id = NULL) {<br />
        try {<br />
            $u = User::find(1);<br />
        } catch (Exception $e) {<br />
            echo $e-&gt;getMessage();<br />
        }</p>
<p>        if (isset($u))<br />
            echo &#8216;Found &#8216; . $u-&gt;username;<br />
    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on ActiveRecord in PHP by Mike</title>
		<link>http://lukebaker.org/projects/activerecord-in-php/comment-page-1/#comment-30593</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 17 Aug 2011 04:55:17 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/projects/activerecord-in-php/#comment-30593</guid>
		<description>I might be missing something but I came to the page and it was nothing but comments.  Where is the actual article?

Best.</description>
		<content:encoded><![CDATA[<p>I might be missing something but I came to the page and it was nothing but comments.  Where is the actual article?</p>
<p>Best.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Search Along A Driving Route by Everett</title>
		<link>http://lukebaker.org/archives/2007/04/19/search-along-a-driving-route/comment-page-1/#comment-29564</link>
		<dc:creator>Everett</dc:creator>
		<pubDate>Thu, 21 Jul 2011 13:36:10 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/archives/2007/04/19/search-along-a-driving-route/#comment-29564</guid>
		<description>I&#039;d like to be able to search local craigslist ads along a driving route.  Like the search tempest website but with a radius from a driving route instead of a single zip code.  Could you do something like this?</description>
		<content:encoded><![CDATA[<p>I&#8217;d like to be able to search local craigslist ads along a driving route.  Like the search tempest website but with a radius from a driving route instead of a single zip code.  Could you do something like this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Frangipani Flower by Cathy</title>
		<link>http://lukebaker.org/archives/2007/07/06/frangipani-flower/comment-page-1/#comment-27001</link>
		<dc:creator>Cathy</dc:creator>
		<pubDate>Mon, 23 May 2011 20:34:33 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/archives/2007/07/06/frangipani-flower/#comment-27001</guid>
		<description>I bow down humbly in the presence of such geratesns.</description>
		<content:encoded><![CDATA[<p>I bow down humbly in the presence of such geratesns.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Disc Golf Courses By County by obnoxify</title>
		<link>http://lukebaker.org/archives/2011/03/08/disc-golf-courses-by-county/comment-page-1/#comment-25532</link>
		<dc:creator>obnoxify</dc:creator>
		<pubDate>Thu, 10 Mar 2011 01:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/?p=81#comment-25532</guid>
		<description>OK, that&#039;s good dude! I&#039;ve attempting SVG/Illustrator/geostuff a few times for localized items - but not to this caliber. Sorry you&#039;re snowed in!</description>
		<content:encoded><![CDATA[<p>OK, that&#8217;s good dude! I&#8217;ve attempting SVG/Illustrator/geostuff a few times for localized items &#8211; but not to this caliber. Sorry you&#8217;re snowed in!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Documentation by Elia</title>
		<link>http://lukebaker.org/projects/activerecord-in-php/documentation/comment-page-1/#comment-25170</link>
		<dc:creator>Elia</dc:creator>
		<pubDate>Fri, 21 Jan 2011 08:37:21 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/projects/activerecord-in-php/documentation/#comment-25170</guid>
		<description>Thanks for providing this excellent lib! Is there an easy way to debug the SQL generated?</description>
		<content:encoded><![CDATA[<p>Thanks for providing this excellent lib! Is there an easy way to debug the SQL generated?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Documentation by Luke</title>
		<link>http://lukebaker.org/projects/activerecord-in-php/documentation/comment-page-1/#comment-25127</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Thu, 13 Jan 2011 00:53:45 +0000</pubDate>
		<guid isPermaLink="false">http://lukebaker.org/projects/activerecord-in-php/documentation/#comment-25127</guid>
		<description>Shawn, I can&#039;t think of a great way to do that.  You could do something like query the Tracks that are released and then get the albums associated with those tracks.  If you require that the album have to verify that ALL of its tracks are &#039;released&#039;, then you&#039;d probably have to do that in your PHP.  Something like:

$tracks = Track::find(&#039;all&#039;, array(&#039;conditions&#039; =&gt; &quot;status = &#039;released&#039;&quot;, &#039;include&#039; =&gt; &#039;album&#039;));

next you&#039;d have to loop through the tracks, grab all unique albums and verify that all their tracks have a status of &#039;released&#039;.  If that hurts performance-wise, you may have to do a manual SQL query.</description>
		<content:encoded><![CDATA[<p>Shawn, I can&#8217;t think of a great way to do that.  You could do something like query the Tracks that are released and then get the albums associated with those tracks.  If you require that the album have to verify that ALL of its tracks are &#8216;released&#8217;, then you&#8217;d probably have to do that in your PHP.  Something like:</p>
<p>$tracks = Track::find(&#8216;all&#8217;, array(&#8216;conditions&#8217; => &#8220;status = &#8216;released&#8217;&#8221;, &#8216;include&#8217; => &#8216;album&#8217;));</p>
<p>next you&#8217;d have to loop through the tracks, grab all unique albums and verify that all their tracks have a status of &#8216;released&#8217;.  If that hurts performance-wise, you may have to do a manual SQL query.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.269 seconds -->

