<?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: CodeIgniter and Doctrine from scratch. Day 9 – Templates &amp; Data Hydrators</title>
	<atom:link href="http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators</link>
	<description>PHP, JS, CSS, jQuery, CodeIgniter, Doctrine</description>
	<lastBuildDate>Sat, 04 Sep 2010 17:13:31 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Gareth</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-11729</link>
		<dc:creator>Gareth</dc:creator>
		<pubDate>Fri, 06 Aug 2010 03:50:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-11729</guid>
		<description>Sorry, completely didn&#039;t see the &amp; before the variable name! I didn&#039;t even know what that did, but i do now!

You are correct, afterall :P</description>
		<content:encoded><![CDATA[<p>Sorry, completely didn&#8217;t see the &amp; before the variable name! I didn&#8217;t even know what that did, but i do now!</p>
<p>You are correct, afterall <img src='http://www.phpandstuff.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gareth</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-11718</link>
		<dc:creator>Gareth</dc:creator>
		<pubDate>Fri, 06 Aug 2010 02:47:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-11718</guid>
		<description>When you create getThreadsArray, should line 35 (return $threads) not be return $thread?

You create the newly structure $thread array and then return the array first obtained by the first DQL query..</description>
		<content:encoded><![CDATA[<p>When you create getThreadsArray, should line 35 (return $threads) not be return $thread?</p>
<p>You create the newly structure $thread array and then return the array first obtained by the first DQL query..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yoursjazz</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-8802</link>
		<dc:creator>yoursjazz</dc:creator>
		<pubDate>Thu, 15 Jul 2010 11:02:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-8802</guid>
		<description>Sorry ,This is my fault~,I copy getThreadsArray function to controller...</description>
		<content:encoded><![CDATA[<p>Sorry ,This is my fault~,I copy getThreadsArray function to controller&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yoursjazz</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-8788</link>
		<dc:creator>yoursjazz</dc:creator>
		<pubDate>Thu, 15 Jul 2010 07:49:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-8788</guid>
		<description>Hi, I download your day9 source code,then run it ,Iget the error as bellow:
Fatal error: Uncaught exception &#039;Doctrine_Record_Exception&#039; with message &#039;Unknown method Forum::getThreadsArray&#039; in D:\wamp\www\hmvc\system\application\plugins\doctrine\lib\Doctrine\Record.php:2533 Stack trace: #0 [internal function]: Doctrine_Record-&gt;__call(&#039;getThreadsArray&#039;, Array) #1 D:\wamp\www\hmvc\system\application\modules\user\controllers\forums.php(7): Forum-&gt;getThreadsArray() #2 [internal function]: Forums-&gt;display(&#039;10&#039;) #3 D:\wamp\www\hmvc\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #4 D:\wamp\www\hmvc\index.php(115): require_once(&#039;D:\wamp\www\hmv...&#039;) #5 {main} thrown in D:\wamp\www\hmvc\system\application\plugins\doctrine\lib\Doctrine\Record.php on line 2533

Help......</description>
		<content:encoded><![CDATA[<p>Hi, I download your day9 source code,then run it ,Iget the error as bellow:<br />
Fatal error: Uncaught exception &#8216;Doctrine_Record_Exception&#8217; with message &#8216;Unknown method Forum::getThreadsArray&#8217; in D:\wamp\www\hmvc\system\application\plugins\doctrine\lib\Doctrine\Record.php:2533 Stack trace: #0 [internal function]: Doctrine_Record-&gt;__call(&#8217;getThreadsArray&#8217;, Array) #1 D:\wamp\www\hmvc\system\application\modules\user\controllers\forums.php(7): Forum-&gt;getThreadsArray() #2 [internal function]: Forums-&gt;display(&#8217;10&#8242;) #3 D:\wamp\www\hmvc\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #4 D:\wamp\www\hmvc\index.php(115): require_once(&#8217;D:\wamp\www\hmv&#8230;&#8217;) #5 {main} thrown in D:\wamp\www\hmvc\system\application\plugins\doctrine\lib\Doctrine\Record.php on line 2533</p>
<p>Help&#8230;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Pakele</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-8762</link>
		<dc:creator>James Pakele</dc:creator>
		<pubDate>Thu, 15 Jul 2010 02:30:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-8762</guid>
		<description>I don&#039;t know if I&#039;m doing something wrong somewhere, but I had to make the following changes to the getThreadArray() function in the Forum Model for the code to run correctly on my system.

changed line 23:
from: -&gt;where(&#039;p.id = ?&#039;, $thread[&#039;Posts&#039;][0][&#039;first_post_id&#039;])
to:  -&gt;where(&#039;p.id = ?&#039;, $thread[&#039;first_post_id&#039;])

changed line 27:
from: $thread[&#039;num_replies&#039;] = $thread[&#039;Posts&#039;][0][&#039;num_replies&#039;];
to: $thread[&#039;num_replies&#039;] = $thread[&#039;num_replies&#039;];


BTW: This tutorial has swayed me from using DataMapper OZ edition for my current project.  By the looks of this it seems that by doing so I have saved a bunch of time and gained a lot more functionality.  Most comprehensive web tutorial I have EVER gone through on ANY subject EVER.  You should definitely consider putting out a book.   

*Have you considered doing using CI+Doctrine with MondoDB?

Aloha

James</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know if I&#8217;m doing something wrong somewhere, but I had to make the following changes to the getThreadArray() function in the Forum Model for the code to run correctly on my system.</p>
<p>changed line 23:<br />
from: -&gt;where(&#8217;p.id = ?&#8217;, $thread['Posts'][0]['first_post_id'])<br />
to:  -&gt;where(&#8217;p.id = ?&#8217;, $thread['first_post_id'])</p>
<p>changed line 27:<br />
from: $thread['num_replies'] = $thread['Posts'][0]['num_replies'];<br />
to: $thread['num_replies'] = $thread['num_replies'];</p>
<p>BTW: This tutorial has swayed me from using DataMapper OZ edition for my current project.  By the looks of this it seems that by doing so I have saved a bunch of time and gained a lot more functionality.  Most comprehensive web tutorial I have EVER gone through on ANY subject EVER.  You should definitely consider putting out a book.   </p>
<p>*Have you considered doing using CI+Doctrine with MondoDB?</p>
<p>Aloha</p>
<p>James</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K. Beau Beauchamp</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-7969</link>
		<dc:creator>K. Beau Beauchamp</dc:creator>
		<pubDate>Tue, 06 Jul 2010 09:51:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-7969</guid>
		<description>I love your site and it&#039;s been very helpful in getting me started with Doctrine. However, I note that you&#039;re putting SQL (DQL) calls in your controllers. Ouch. In N-tier architecture this is generally a major violation of abstraction. Should  you not be placing these SQL (DQL) calls in a CI model?</description>
		<content:encoded><![CDATA[<p>I love your site and it&#8217;s been very helpful in getting me started with Doctrine. However, I note that you&#8217;re putting SQL (DQL) calls in your controllers. Ouch. In N-tier architecture this is generally a major violation of abstraction. Should  you not be placing these SQL (DQL) calls in a CI model?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-6903</link>
		<dc:creator>Richard</dc:creator>
		<pubDate>Thu, 17 Jun 2010 20:45:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-6903</guid>
		<description>found if using hydrate_array outside of a model I need to use the following
$q-&gt;setHydrationMode(Doctrine_Core::HYDRATE_ARRAY);
doctrine_core not just doctrine otherwise I get an error on the dql. took me a few days to find that tip.</description>
		<content:encoded><![CDATA[<p>found if using hydrate_array outside of a model I need to use the following<br />
$q-&gt;setHydrationMode(Doctrine_Core::HYDRATE_ARRAY);<br />
doctrine_core not just doctrine otherwise I get an error on the dql. took me a few days to find that tip.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Bosinger</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-6898</link>
		<dc:creator>Ryan Bosinger</dc:creator>
		<pubDate>Thu, 17 Jun 2010 16:30:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-6898</guid>
		<description>Looks like you put a lot of work into this.  Good job.  I wished I would have used Doctrine (or some form of ORM) when I started by big CI project a year ago.  Now it&#039;s going to be a pain to make the switch...</description>
		<content:encoded><![CDATA[<p>Looks like you put a lot of work into this.  Good job.  I wished I would have used Doctrine (or some form of ORM) when I started by big CI project a year ago.  Now it&#8217;s going to be a pain to make the switch&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Burak</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-3207</link>
		<dc:creator>Burak</dc:creator>
		<pubDate>Mon, 29 Mar 2010 01:07:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-3207</guid>
		<description>See Day 11 about this.</description>
		<content:encoded><![CDATA[<p>See Day 11 about this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Burak</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-3206</link>
		<dc:creator>Burak</dc:creator>
		<pubDate>Mon, 29 Mar 2010 01:06:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-3206</guid>
		<description>If I remember correctly, I encountered some strange behavior in Doctrine where I couldn&#039;t COUNT a column unless I also selected it too.</description>
		<content:encoded><![CDATA[<p>If I remember correctly, I encountered some strange behavior in Doctrine where I couldn&#8217;t COUNT a column unless I also selected it too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elbi</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-3194</link>
		<dc:creator>Elbi</dc:creator>
		<pubDate>Sun, 28 Mar 2010 17:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-3194</guid>
		<description>So the second question got answered by part 11 :-)</description>
		<content:encoded><![CDATA[<p>So the second question got answered by part 11 <img src='http://www.phpandstuff.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elbi</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-3191</link>
		<dc:creator>Elbi</dc:creator>
		<pubDate>Sun, 28 Mar 2010 15:50:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-3191</guid>
		<description>Another question:
If we profile this you can see that theres a query per thread. Doesn&#039;t that mean we access the DB 1 time for each thread?
Since the DQL is executed one at a time.
Aren&#039;t there ways to optimize this, maybe accessing the database just once and executing all the queries at once, or perhaps getting all the data in the first query with a better DQL query ?
Or maybe its worth it to just duplicate the values in the database in terms of performance?

-Thanks</description>
		<content:encoded><![CDATA[<p>Another question:<br />
If we profile this you can see that theres a query per thread. Doesn&#8217;t that mean we access the DB 1 time for each thread?<br />
Since the DQL is executed one at a time.<br />
Aren&#8217;t there ways to optimize this, maybe accessing the database just once and executing all the queries at once, or perhaps getting all the data in the first query with a better DQL query ?<br />
Or maybe its worth it to just duplicate the values in the database in terms of performance?</p>
<p>-Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elbi</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-3190</link>
		<dc:creator>Elbi</dc:creator>
		<pubDate>Sun, 28 Mar 2010 15:35:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-3190</guid>
		<description>-&gt;addSelect(&#039;p.id, (COUNT(p.id) - 1) as num_replies&#039;)

why is it important to select the post id and not just
COUNT(p.id)
?</description>
		<content:encoded><![CDATA[<p>-&gt;addSelect(&#8217;p.id, (COUNT(p.id) &#8211; 1) as num_replies&#8217;)</p>
<p>why is it important to select the post id and not just<br />
COUNT(p.id)<br />
?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Burak</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-2055</link>
		<dc:creator>Burak</dc:creator>
		<pubDate>Sat, 13 Feb 2010 22:37:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-2055</guid>
		<description>I looked at the core hydration modes, but I don&#039;t think any of them gives exactly what you are asking.

You can write your own hydration method if you want: 
http://www.doctrine-project.org/documentation/manual/1_2/en/data-hydrators#writing-hydration-method</description>
		<content:encoded><![CDATA[<p>I looked at the core hydration modes, but I don&#8217;t think any of them gives exactly what you are asking.</p>
<p>You can write your own hydration method if you want:<br />
<a href="http://www.doctrine-project.org/documentation/manual/1_2/en/data-hydrators#writing-hydration-method" rel="nofollow">http://www.doctrine-project.org/documentation/manual/1_2/en/data-hydrators#writing-hydration-method</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ricardo</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-2009</link>
		<dc:creator>Ricardo</dc:creator>
		<pubDate>Thu, 11 Feb 2010 13:49:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-2009</guid>
		<description>Hi Burak! Great tut!!

I&#039;m trying to create a CI form_dropdown, using doctrine to create the options array... is there a way, or a hydrator type, that can return an array with the same format as the form_dropdown needs as parameter?

Thank you very much in advance!</description>
		<content:encoded><![CDATA[<p>Hi Burak! Great tut!!</p>
<p>I&#8217;m trying to create a CI form_dropdown, using doctrine to create the options array&#8230; is there a way, or a hydrator type, that can return an array with the same format as the form_dropdown needs as parameter?</p>
<p>Thank you very much in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CodeIgniter and Doctrine from scratch. Day 11 – Record Hooks &#124; PHP and Stuff</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-1961</link>
		<dc:creator>CodeIgniter and Doctrine from scratch. Day 11 – Record Hooks &#124; PHP and Stuff</dc:creator>
		<pubDate>Mon, 08 Feb 2010 21:26:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-1961</guid>
		<description>[...] Day 9: Templates &amp; Data Hydrators [...]</description>
		<content:encoded><![CDATA[<p>[...] Day 9: Templates &amp; Data Hydrators [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohamed Mahmoud</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-1942</link>
		<dc:creator>Mohamed Mahmoud</dc:creator>
		<pubDate>Sun, 07 Feb 2010 14:09:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-1942</guid>
		<description>ops .. ididn&#039;t saw burak comment 

just saw it after i added mine</description>
		<content:encoded><![CDATA[<p>ops .. ididn&#8217;t saw burak comment </p>
<p>just saw it after i added mine</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohamed Mahmoud</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-1941</link>
		<dc:creator>Mohamed Mahmoud</dc:creator>
		<pubDate>Sun, 07 Feb 2010 14:08:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-1941</guid>
		<description>Hi Piyush 

i think maybe i can help you 

$result = Doctrine_Query::create()
-&gt;select(&#039;*&#039;)
-&gt;from(&#039; Module_Name &#039;)
-&gt;where(&#039;cityid = ?&#039;, $cityid)
-&gt;wherein(&#039;status_id&#039;, array(1, 4, 7))
-&gt;execute();

and i won&#039;t forget to send many thanks to Burak on this great tuts :) 

Thanks From Sphinx in Egypt ;)</description>
		<content:encoded><![CDATA[<p>Hi Piyush </p>
<p>i think maybe i can help you </p>
<p>$result = Doctrine_Query::create()<br />
-&gt;select(&#8217;*')<br />
-&gt;from(&#8217; Module_Name &#8216;)<br />
-&gt;where(&#8217;cityid = ?&#8217;, $cityid)<br />
-&gt;wherein(&#8217;status_id&#8217;, array(1, 4, 7))<br />
-&gt;execute();</p>
<p>and i won&#8217;t forget to send many thanks to Burak on this great tuts <img src='http://www.phpandstuff.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>Thanks From Sphinx in Egypt <img src='http://www.phpandstuff.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Burak</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-1931</link>
		<dc:creator>Burak</dc:creator>
		<pubDate>Sun, 07 Feb 2010 00:38:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-1931</guid>
		<description>select(&#039;*&#039;)-&gt;
from(&#039;table_name&#039;)-&gt;
where(&#039;city_id = ?&#039;, $cityid)-&gt;
andWhereIn(&#039;status_id&#039;, array(1,4,7))</description>
		<content:encoded><![CDATA[<p>select(&#8217;*')-><br />
from(&#8217;table_name&#8217;)-><br />
where(&#8217;city_id = ?&#8217;, $cityid)-><br />
andWhereIn(&#8217;status_id&#8217;, array(1,4,7))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: piyush</title>
		<link>http://www.phpandstuff.com/articles/codeigniter-doctrine-scratch-day-9-templates-data-hydrators/comment-page-1#comment-1783</link>
		<dc:creator>piyush</dc:creator>
		<pubDate>Wed, 03 Feb 2010 16:05:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpandstuff.com/?p=704#comment-1783</guid>
		<description>Hi Burak, what would be the dql  query for this 
select * from table name where city_id=&#039;$cityid &#039; and (status_id=1 or status_id=4 or status_id=7);
even i am not sure that it is correct mysql query.

actually my objective is to get all the records having cityid=&#039;some_id&#039; and having status_id either 1 , 4 or 7.

Thanks
piyush</description>
		<content:encoded><![CDATA[<p>Hi Burak, what would be the dql  query for this<br />
select * from table name where city_id=&#8217;$cityid &#8216; and (status_id=1 or status_id=4 or status_id=7);<br />
even i am not sure that it is correct mysql query.</p>
<p>actually my objective is to get all the records having cityid=&#8217;some_id&#8217; and having status_id either 1 , 4 or 7.</p>
<p>Thanks<br />
piyush</p>
]]></content:encoded>
	</item>
</channel>
</rss>
