<?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: Zend_Db Insert and Read</title>
	<atom:link href="http://www.zendcasts.com/zend_db-insert-and-read/2009/04/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/</link>
	<description>free Zend Framework screencasts. Video tutorials to get you up to speed with different parts of the Zend Framework and enterprise PHP development.</description>
	<lastBuildDate>Wed, 01 Feb 2012 00:49:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: chris2011</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-25944</link>
		<dc:creator>chris2011</dc:creator>
		<pubDate>Wed, 16 Nov 2011 18:50:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-25944</guid>
		<description>If you get  Fatal error: Class ‘UsersTable’ error, on ZendFramework 1.11,  update the include path in  /public/index.php  to be like this

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . &#039;/../library&#039;),
    realpath(APPLICATION_PATH . &#039;/models&#039;),
    
    get_include_path(),
)));

It works for me</description>
		<content:encoded><![CDATA[<p>If you get  Fatal error: Class ‘UsersTable’ error, on ZendFramework 1.11,  update the include path in  /public/index.php  to be like this</p>
<p>// Ensure library/ is on include_path<br />
set_include_path(implode(PATH_SEPARATOR, array(<br />
    realpath(APPLICATION_PATH . &#8216;/../library&#8217;),<br />
    realpath(APPLICATION_PATH . &#8216;/models&#8217;),</p>
<p>    get_include_path(),<br />
)));</p>
<p>It works for me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toy</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-12470</link>
		<dc:creator>toy</dc:creator>
		<pubDate>Tue, 16 Nov 2010 06:02:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-12470</guid>
		<description>hey patryk

as it turned out - 
my models were NOT being autoloaded
for whatever reason
and this is what i ended adding that wroked:

	protected function _initAutoload()
	{
		$loader = new Zend_Application_Module_Autoloader(array(
					&quot;namespace&quot; =&gt; &quot;&quot;,
					&quot;basePath&quot; =&gt; APPLICATION_PATH));

		// autoload					
		$loader-&gt;addResourceType(&quot;model&quot;, &quot;models&quot;, &quot;Model&quot;);
	}</description>
		<content:encoded><![CDATA[<p>hey patryk</p>
<p>as it turned out &#8211;<br />
my models were NOT being autoloaded<br />
for whatever reason<br />
and this is what i ended adding that wroked:</p>
<p>	protected function _initAutoload()<br />
	{<br />
		$loader = new Zend_Application_Module_Autoloader(array(<br />
					&#8220;namespace&#8221; =&gt; &#8220;&#8221;,<br />
					&#8220;basePath&#8221; =&gt; APPLICATION_PATH));</p>
<p>		// autoload<br />
		$loader-&gt;addResourceType(&#8220;model&#8221;, &#8220;models&#8221;, &#8220;Model&#8221;);<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patryk Hanckowiak</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-12348</link>
		<dc:creator>Patryk Hanckowiak</dc:creator>
		<pubDate>Sun, 14 Nov 2010 15:52:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-12348</guid>
		<description>Reply to toy.
By default ZF 1.10 should autoload files in the directories: application/models and application/models/DbTable. The class prefix Model_SomeName and Model_DbTable_SomeName should be defined in application/models/SomeName.php and application/models/DbTable/SomeName.php. (the class Model_DbTable_SomeName should extend Zend_Db_Table_Abstract).

If you have defined a namespace in _initAutoload (in Bootstrap.php) the prefixes will change to YourNamespace_Model_SomeName and YourNamespace_Model_DbTable_SomeName.

You can change your models directory in the application.ini file with this line of code:
resources.frontController.modelsDirectory = APPLICATION_PATH &quot;/my_models&quot;

You can probably also add any directory to autoload.

Hope this helped to resolve your problems.</description>
		<content:encoded><![CDATA[<p>Reply to toy.<br />
By default ZF 1.10 should autoload files in the directories: application/models and application/models/DbTable. The class prefix Model_SomeName and Model_DbTable_SomeName should be defined in application/models/SomeName.php and application/models/DbTable/SomeName.php. (the class Model_DbTable_SomeName should extend Zend_Db_Table_Abstract).</p>
<p>If you have defined a namespace in _initAutoload (in Bootstrap.php) the prefixes will change to YourNamespace_Model_SomeName and YourNamespace_Model_DbTable_SomeName.</p>
<p>You can change your models directory in the application.ini file with this line of code:<br />
resources.frontController.modelsDirectory = APPLICATION_PATH &#8220;/my_models&#8221;</p>
<p>You can probably also add any directory to autoload.</p>
<p>Hope this helped to resolve your problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toy</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-12242</link>
		<dc:creator>toy</dc:creator>
		<pubDate>Fri, 12 Nov 2010 22:17:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-12242</guid>
		<description>@patryk
hi again - 
i took out the _initAutoload function
it seemed redundant
and i changed Application_Model_Press to Model_Press
and my press service layer is still returning:

Fatal error: Class &#039;Model_Press&#039; not found in
/path/to/library/MyLib/Db/PressService.php

im wondering why ZF 1.10 is not autoloading my model...</description>
		<content:encoded><![CDATA[<p>@patryk<br />
hi again &#8211;<br />
i took out the _initAutoload function<br />
it seemed redundant<br />
and i changed Application_Model_Press to Model_Press<br />
and my press service layer is still returning:</p>
<p>Fatal error: Class &#8216;Model_Press&#8217; not found in<br />
/path/to/library/MyLib/Db/PressService.php</p>
<p>im wondering why ZF 1.10 is not autoloading my model&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toy</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-12235</link>
		<dc:creator>toy</dc:creator>
		<pubDate>Fri, 12 Nov 2010 19:50:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-12235</guid>
		<description>hey patryk
thanks for your reply

actually my dir structure is NOT
models/db it is the same as yours
i think you are referring to this:
/var/local/virtuals/www.acemetrix.com/library/AM/Db/PressService.php
which i should have generalised it as the path to db service layer
which resides in the library
ie, /path/to/library/MyCustomLib/Db/dbServiceLayer.php
which is how jon&#039;s example here is setup

one last thing
yes you are correct about me running ZF1.10 not ZF1.18
i made a typo there
so if the Nayre posting above says the foloowing
&quot;rename UsersTable into Application_Model_UsersTable&quot;
which is now what you are telling me is wrong?

its now become pretty clear to me 
that my issue is is that the when the service layer is called
the model for my object &#039;press&#039; is not in the include path
or has not been loaded
which is weird since
1) if i print out the path
its has application/models in the path
and 
2) i thought ZF 1.10 was supposed to autoload the models
nad if not then the init autoload statement would take care ofit

am i confusing the issue here?</description>
		<content:encoded><![CDATA[<p>hey patryk<br />
thanks for your reply</p>
<p>actually my dir structure is NOT<br />
models/db it is the same as yours<br />
i think you are referring to this:<br />
/var/local/virtuals/www.acemetrix.com/library/AM/Db/PressService.php<br />
which i should have generalised it as the path to db service layer<br />
which resides in the library<br />
ie, /path/to/library/MyCustomLib/Db/dbServiceLayer.php<br />
which is how jon&#8217;s example here is setup</p>
<p>one last thing<br />
yes you are correct about me running ZF1.10 not ZF1.18<br />
i made a typo there<br />
so if the Nayre posting above says the foloowing<br />
&#8220;rename UsersTable into Application_Model_UsersTable&#8221;<br />
which is now what you are telling me is wrong?</p>
<p>its now become pretty clear to me<br />
that my issue is is that the when the service layer is called<br />
the model for my object &#8216;press&#8217; is not in the include path<br />
or has not been loaded<br />
which is weird since<br />
1) if i print out the path<br />
its has application/models in the path<br />
and<br />
2) i thought ZF 1.10 was supposed to autoload the models<br />
nad if not then the init autoload statement would take care ofit</p>
<p>am i confusing the issue here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patryk Hanckowiak</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-12131</link>
		<dc:creator>Patryk Hanckowiak</dc:creator>
		<pubDate>Wed, 10 Nov 2010 12:34:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-12131</guid>
		<description>Reply to toy :)
My directory structure is models and models/DbTable and NOT &quot;Db&quot; like yo seem to have ... by default, that is. Also ZF 1.10, by default there is no &quot;Application&quot; prefix so the model class starts with &quot;Model_...&quot; ... this might change depending on your _initAutoLoad() function.</description>
		<content:encoded><![CDATA[<p>Reply to toy <img src='http://www.zendcasts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
My directory structure is models and models/DbTable and NOT &#8220;Db&#8221; like yo seem to have &#8230; by default, that is. Also ZF 1.10, by default there is no &#8220;Application&#8221; prefix so the model class starts with &#8220;Model_&#8230;&#8221; &#8230; this might change depending on your _initAutoLoad() function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toy</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-12101</link>
		<dc:creator>toy</dc:creator>
		<pubDate>Tue, 09 Nov 2010 21:11:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-12101</guid>
		<description>hey all
i hate to beat a dead horse
but i think between all the updates in the ZF
and the orig posting of this vid
its been a trying time for me to get rid of  this error:

Fatal error: Class &#039;Application_Model_Press&#039; not found in /var/local/virtuals/www.acemetrix.com/library/AM/Db/PressService.php on line 32

first off im running ZF1.8
my include path looks like this:
/path/to/library:/path/to/application/models

ive tried adding this to my bootstrap (according to brett above):
protected function _initAutoload()
{
$autoloader = new Zend_Application_Module_Autoloader(array(
‘namespace’ =&gt; ‘Application’,
‘basePath’ =&gt; dirname(__FILE__),
));
return $autoloader;
}

ive also tried adding this to my bootstrap (according to http://www.zendcasts.com/forum/post/65/#p65)
	protected function _initAutoload()
	{
		$moduleLoader = new Zend_Application_Module_Autoloader(array(
					&quot;namespace&quot; =&gt; &quot;&quot;,
					&quot;basePath&quot; =&gt; APPLICATION_PATH));
					
        /** auto load */
		$autoloader = Zend_Loader_Autoloader::getInstance();
		$autoloader-&gt;setFallbackAutoloader(true);
		return $moduleLoader;
	}

ive tried cross referencing with the code jon has uploaded up on google
but obviously im missing something
pls help!
thanks</description>
		<content:encoded><![CDATA[<p>hey all<br />
i hate to beat a dead horse<br />
but i think between all the updates in the ZF<br />
and the orig posting of this vid<br />
its been a trying time for me to get rid of  this error:</p>
<p>Fatal error: Class &#8216;Application_Model_Press&#8217; not found in /var/local/virtuals/www.acemetrix.com/library/AM/Db/PressService.php on line 32</p>
<p>first off im running ZF1.8<br />
my include path looks like this:<br />
/path/to/library:/path/to/application/models</p>
<p>ive tried adding this to my bootstrap (according to brett above):<br />
protected function _initAutoload()<br />
{<br />
$autoloader = new Zend_Application_Module_Autoloader(array(<br />
‘namespace’ =&gt; ‘Application’,<br />
‘basePath’ =&gt; dirname(__FILE__),<br />
));<br />
return $autoloader;<br />
}</p>
<p>ive also tried adding this to my bootstrap (according to <a href="http://www.zendcasts.com/forum/post/65/#p65" rel="nofollow">http://www.zendcasts.com/forum/post/65/#p65</a>)<br />
	protected function _initAutoload()<br />
	{<br />
		$moduleLoader = new Zend_Application_Module_Autoloader(array(<br />
					&#8220;namespace&#8221; =&gt; &#8220;&#8221;,<br />
					&#8220;basePath&#8221; =&gt; APPLICATION_PATH));</p>
<p>        /** auto load */<br />
		$autoloader = Zend_Loader_Autoloader::getInstance();<br />
		$autoloader-&gt;setFallbackAutoloader(true);<br />
		return $moduleLoader;<br />
	}</p>
<p>ive tried cross referencing with the code jon has uploaded up on google<br />
but obviously im missing something<br />
pls help!<br />
thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nayre</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-11476</link>
		<dc:creator>Nayre</dc:creator>
		<pubDate>Sat, 23 Oct 2010 18:23:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-11476</guid>
		<description>@Pip to ZF 1.10
rename UsersTable into Application_Model_UsersTable</description>
		<content:encoded><![CDATA[<p>@Pip to ZF 1.10<br />
rename UsersTable into Application_Model_UsersTable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Emrah Mehmedov</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-9599</link>
		<dc:creator>Emrah Mehmedov</dc:creator>
		<pubDate>Wed, 18 Aug 2010 06:47:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-9599</guid>
		<description>@Pip

you should configure code for 1.10 :D.</description>
		<content:encoded><![CDATA[<p>@Pip</p>
<p>you should configure code for 1.10 <img src='http://www.zendcasts.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pip</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-9596</link>
		<dc:creator>Pip</dc:creator>
		<pubDate>Wed, 18 Aug 2010 03:42:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-9596</guid>
		<description>I am using Zend 1.10 and this code is no longer working.</description>
		<content:encoded><![CDATA[<p>I am using Zend 1.10 and this code is no longer working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gizmo</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-9077</link>
		<dc:creator>Gizmo</dc:creator>
		<pubDate>Tue, 03 Aug 2010 18:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-9077</guid>
		<description>What is user in db exists?
public function NewUser($nick, $pass, $mail, $name, $lname, $loc, $fg, $gt){
		$params = array(
		&#039;username&#039; =&gt; $nick,
		&#039;password&#039; =&gt; md5($pass),
		&#039;mail&#039; =&gt; $mail,
		&#039;fname&#039; =&gt; $name,
		&#039;lname&#039; =&gt; $lname,
		&#039;date&#039; =&gt; strftime(&quot;%Y/%m/%d&quot;),
		&#039;location&#039; =&gt; $loc,
		&#039;fgame&#039; =&gt; $fg,
		&#039;gtype&#039; =&gt; $gt,
		&#039;acccreated&#039; =&gt; strftime(&quot;%Y/%m/%d&quot;),
		&#039;ban&#039; =&gt; &#039;0&#039;
		);
		$this-&gt;users-&gt;insert($params);
	}

how i can check for that info, i have that nick in db or its free to use?</description>
		<content:encoded><![CDATA[<p>What is user in db exists?<br />
public function NewUser($nick, $pass, $mail, $name, $lname, $loc, $fg, $gt){<br />
		$params = array(<br />
		&#8216;username&#8217; =&gt; $nick,<br />
		&#8216;password&#8217; =&gt; md5($pass),<br />
		&#8216;mail&#8217; =&gt; $mail,<br />
		&#8216;fname&#8217; =&gt; $name,<br />
		&#8216;lname&#8217; =&gt; $lname,<br />
		&#8216;date&#8217; =&gt; strftime(&#8220;%Y/%m/%d&#8221;),<br />
		&#8216;location&#8217; =&gt; $loc,<br />
		&#8216;fgame&#8217; =&gt; $fg,<br />
		&#8216;gtype&#8217; =&gt; $gt,<br />
		&#8216;acccreated&#8217; =&gt; strftime(&#8220;%Y/%m/%d&#8221;),<br />
		&#8216;ban&#8217; =&gt; &#8217;0&#8242;<br />
		);<br />
		$this-&gt;users-&gt;insert($params);<br />
	}</p>
<p>how i can check for that info, i have that nick in db or its free to use?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patryk Hanckowiak</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-7379</link>
		<dc:creator>Patryk Hanckowiak</dc:creator>
		<pubDate>Mon, 17 May 2010 13:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-7379</guid>
		<description>Great screencasts - one of the reasons I still haven&#039;t switched to a different framework, or programming language :)

The Zend documentation in Zend Framework 1.10 shows how to use a mapper with Zend_Db_Table. Is this analogues to the services you use in this screencast?

The default directory structure seems to be:
application/models - 
application/models/DbTable - table classes
application/models/mappers - mappers (this part is from Rob Allen&#039;s getting started tutorial)</description>
		<content:encoded><![CDATA[<p>Great screencasts &#8211; one of the reasons I still haven&#8217;t switched to a different framework, or programming language <img src='http://www.zendcasts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The Zend documentation in Zend Framework 1.10 shows how to use a mapper with Zend_Db_Table. Is this analogues to the services you use in this screencast?</p>
<p>The default directory structure seems to be:<br />
application/models &#8211;<br />
application/models/DbTable &#8211; table classes<br />
application/models/mappers &#8211; mappers (this part is from Rob Allen&#8217;s getting started tutorial)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: didymus</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-6255</link>
		<dc:creator>didymus</dc:creator>
		<pubDate>Sun, 21 Mar 2010 23:41:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-6255</guid>
		<description>Brett &amp; Nicola: Thanks for the comments on the &quot;class table not found&quot; error.  Brett&#039;s last suggestion works (along with Jon&#039;s blog post article on namespace registration).  I think that most people forget to add the &quot;Model_&quot; to the class name and any calls to it.</description>
		<content:encoded><![CDATA[<p>Brett &amp; Nicola: Thanks for the comments on the &#8220;class table not found&#8221; error.  Brett&#8217;s last suggestion works (along with Jon&#8217;s blog post article on namespace registration).  I think that most people forget to add the &#8220;Model_&#8221; to the class name and any calls to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: didymus</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-6251</link>
		<dc:creator>didymus</dc:creator>
		<pubDate>Sun, 21 Mar 2010 17:20:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-6251</guid>
		<description>Oops, I just posted comment to wrong article...  With respect to converting database feed into JSON using JQuery, I&#039;m not sure how to do that but maybe there is an article out there I can find.  Do you prefer JQuery for this sort of task?  I did find this one that uses php&#039;s json_encode: http://net.tutsplus.com/tutorials/php/asynchronous-comments-with-jquery-and-json/</description>
		<content:encoded><![CDATA[<p>Oops, I just posted comment to wrong article&#8230;  With respect to converting database feed into JSON using JQuery, I&#8217;m not sure how to do that but maybe there is an article out there I can find.  Do you prefer JQuery for this sort of task?  I did find this one that uses php&#8217;s json_encode: <a href="http://net.tutsplus.com/tutorials/php/asynchronous-comments-with-jquery-and-json/" rel="nofollow">http://net.tutsplus.com/tutorials/php/asynchronous-comments-with-jquery-and-json/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: didymus</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-6250</link>
		<dc:creator>didymus</dc:creator>
		<pubDate>Sun, 21 Mar 2010 17:12:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-6250</guid>
		<description>Jon, yes, I&#039;m using JQuery following your tutorial on Zend View Helpers with AJAX.  The flickr object is not recognized by the helper.  I tried accessing it from the view and tried passing it through to the helper as input parameter but in either case I found it to be inaccessible.</description>
		<content:encoded><![CDATA[<p>Jon, yes, I&#8217;m using JQuery following your tutorial on Zend View Helpers with AJAX.  The flickr object is not recognized by the helper.  I tried accessing it from the view and tried passing it through to the helper as input parameter but in either case I found it to be inaccessible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nicola</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-6246</link>
		<dc:creator>nicola</dc:creator>
		<pubDate>Sun, 21 Mar 2010 12:42:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-6246</guid>
		<description>Hi didymus, you have try with JQuery?</description>
		<content:encoded><![CDATA[<p>Hi didymus, you have try with JQuery?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: didymus</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-6234</link>
		<dc:creator>didymus</dc:creator>
		<pubDate>Sun, 21 Mar 2010 07:58:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-6234</guid>
		<description>Jon: I&#039;m wondering how one would fetch db table data and transform it into JSON data object at page load.  Is there a library function for such a task?</description>
		<content:encoded><![CDATA[<p>Jon: I&#8217;m wondering how one would fetch db table data and transform it into JSON data object at page load.  Is there a library function for such a task?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brett</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-4536</link>
		<dc:creator>Brett</dc:creator>
		<pubDate>Sat, 09 Jan 2010 23:48:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-4536</guid>
		<description>nicola,

Try adding this to your bootstrap php file:

protected function _initAutoload()
{
$autoloader = new Zend_Application_Module_Autoloader(array(
&#039;namespace&#039; =&gt; &#039;App&#039;,
&#039;basePath&#039;  =&gt; dirname(__FILE__),
));
return $autoloader;
}

then UserService.php would be
$this-&gt;users = new App_Model_UsersTable();

and

UsersTable.php would be
class App_Model_UsersTable extends Zend_Db_Table_Abstract</description>
		<content:encoded><![CDATA[<p>nicola,</p>
<p>Try adding this to your bootstrap php file:</p>
<p>protected function _initAutoload()<br />
{<br />
$autoloader = new Zend_Application_Module_Autoloader(array(<br />
&#8216;namespace&#8217; =&gt; &#8216;App&#8217;,<br />
&#8216;basePath&#8217;  =&gt; dirname(__FILE__),<br />
));<br />
return $autoloader;<br />
}</p>
<p>then UserService.php would be<br />
$this-&gt;users = new App_Model_UsersTable();</p>
<p>and</p>
<p>UsersTable.php would be<br />
class App_Model_UsersTable extends Zend_Db_Table_Abstract</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nicola</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-3888</link>
		<dc:creator>nicola</dc:creator>
		<pubDate>Sat, 12 Dec 2009 18:19:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-3888</guid>
		<description>Hi Anarxi, I added this code in index.php:

// Ensure library/ is on include_path
    set_include_path(implode(PATH_SEPARATOR, array(
        realpath(APPLICATION_PATH . &#039;/../library&#039;),realpath(APPLICATION_PATH . &#039;/models/&#039;),
        get_include_path()
    )));

As you can see the path for the models already exist. Do you have any other ideas?
Thank you.</description>
		<content:encoded><![CDATA[<p>Hi Anarxi, I added this code in index.php:</p>
<p>// Ensure library/ is on include_path<br />
    set_include_path(implode(PATH_SEPARATOR, array(<br />
        realpath(APPLICATION_PATH . &#8216;/../library&#8217;),realpath(APPLICATION_PATH . &#8216;/models/&#8217;),<br />
        get_include_path()<br />
    )));</p>
<p>As you can see the path for the models already exist. Do you have any other ideas?<br />
Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anarxi</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-3839</link>
		<dc:creator>Anarxi</dc:creator>
		<pubDate>Thu, 10 Dec 2009 04:57:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-3839</guid>
		<description>For those who are having Fatal error: Class ‘UsersTable’ error, add include path to /public/index.php

set_include_path(
    APPLICATION_PATH . &#039;/models&#039;
    . PATH_SEPARATOR . get_include_path()
);</description>
		<content:encoded><![CDATA[<p>For those who are having Fatal error: Class ‘UsersTable’ error, add include path to /public/index.php</p>
<p>set_include_path(<br />
    APPLICATION_PATH . &#8216;/models&#8217;<br />
    . PATH_SEPARATOR . get_include_path()<br />
);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nicola</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-3253</link>
		<dc:creator>nicola</dc:creator>
		<pubDate>Wed, 04 Nov 2009 21:57:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-3253</guid>
		<description>error_reporting(E_ALL&#124;&#124;E_STRICT);
ini_set(&#039;display_error&#039;,&#039;1&#039;);

// Define path to application directory
defined(&#039;APPLICATION_PATH&#039;)
    &#124;&#124; define(&#039;APPLICATION_PATH&#039;, realpath(dirname(__FILE__).&quot;/../application/&quot; ));

// Define application environment
defined(&#039;APPLICATION_ENV&#039;)
    &#124;&#124; define(&#039;APPLICATION_ENV&#039;, (getenv(&#039;APPLICATION_ENV&#039;) ? getenv(&#039;APPLICATION_ENV&#039;) : &#039;production&#039;));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . &#039;/../library&#039;),realpath(APPLICATION_PATH . &#039;/models/&#039;),
    get_include_path()
)));

/** Zend_Application */
require_once &#039;Zend/Application.php&#039;;  

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV, 
    APPLICATION_PATH . &#039;/configs/application.ini&#039;
);
$application-&gt;bootstrap()
            -&gt;run();</description>
		<content:encoded><![CDATA[<p>error_reporting(E_ALL||E_STRICT);<br />
ini_set(&#8216;display_error&#8217;,&#8217;1&#8242;);</p>
<p>// Define path to application directory<br />
defined(&#8216;APPLICATION_PATH&#8217;)<br />
    || define(&#8216;APPLICATION_PATH&#8217;, realpath(dirname(__FILE__).&#8221;/../application/&#8221; ));</p>
<p>// Define application environment<br />
defined(&#8216;APPLICATION_ENV&#8217;)<br />
    || define(&#8216;APPLICATION_ENV&#8217;, (getenv(&#8216;APPLICATION_ENV&#8217;) ? getenv(&#8216;APPLICATION_ENV&#8217;) : &#8216;production&#8217;));</p>
<p>// Ensure library/ is on include_path<br />
set_include_path(implode(PATH_SEPARATOR, array(<br />
    realpath(APPLICATION_PATH . &#8216;/../library&#8217;),realpath(APPLICATION_PATH . &#8216;/models/&#8217;),<br />
    get_include_path()<br />
)));</p>
<p>/** Zend_Application */<br />
require_once &#8216;Zend/Application.php&#8217;;  </p>
<p>// Create application, bootstrap, and run<br />
$application = new Zend_Application(<br />
    APPLICATION_ENV,<br />
    APPLICATION_PATH . &#8216;/configs/application.ini&#8217;<br />
);<br />
$application-&gt;bootstrap()<br />
            -&gt;run();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nicola</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-3252</link>
		<dc:creator>nicola</dc:creator>
		<pubDate>Wed, 04 Nov 2009 21:56:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-3252</guid>
		<description>Thanks Jon, I use Zend Studio 7.0, when I create a new Zend Framework project, a bootstrap file is generated.I modified it according your tutorial, but when I include the path of the &quot;models&quot; I always get the above error &quot;Fatal error: Class&#039; UsersTable &#039;not found in C: \ Sites \ zendcast \ library \ App \ UserService.php on line 23 &quot;. Where am I wrong? As I wrote you in my last post, I have to rename the model&#039;s class in order to solve the problem.
I attach you the bootstrap file:
bootstrap()
            -&gt;run();
?&gt;</description>
		<content:encoded><![CDATA[<p>Thanks Jon, I use Zend Studio 7.0, when I create a new Zend Framework project, a bootstrap file is generated.I modified it according your tutorial, but when I include the path of the &#8220;models&#8221; I always get the above error &#8220;Fatal error: Class&#8217; UsersTable &#8216;not found in C: \ Sites \ zendcast \ library \ App \ UserService.php on line 23 &#8220;. Where am I wrong? As I wrote you in my last post, I have to rename the model&#8217;s class in order to solve the problem.<br />
I attach you the bootstrap file:<br />
bootstrap()<br />
            -&gt;run();<br />
?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jon</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-3242</link>
		<dc:creator>jon</dc:creator>
		<pubDate>Tue, 03 Nov 2009 22:01:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-3242</guid>
		<description>Hi Nicola,

Model_* is the default namespace for models in the Zend Framework. I believe I got around it by including the &#039;models&#039; folder in my include paths for that particular video.</description>
		<content:encoded><![CDATA[<p>Hi Nicola,</p>
<p>Model_* is the default namespace for models in the Zend Framework. I believe I got around it by including the &#8216;models&#8217; folder in my include paths for that particular video.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nicola</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-3239</link>
		<dc:creator>nicola</dc:creator>
		<pubDate>Tue, 03 Nov 2009 20:28:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-3239</guid>
		<description>Hi Jon I&#039;m using the framework 1.9 and following your video tutorial I always get the following error: &quot;Fatal error: Class &#039;UsersTable&#039; not found in C: \ Sites \ zendcast \ library \ App \ UserService.php on line 23&quot;. After reading some articles, I resolved this problem renaming the model&#039;s class: &quot;Model_UsersTable&quot;. Is it correct? Can you tell me if I should do something else?
thank you for your attention

Nicola</description>
		<content:encoded><![CDATA[<p>Hi Jon I&#8217;m using the framework 1.9 and following your video tutorial I always get the following error: &#8220;Fatal error: Class &#8216;UsersTable&#8217; not found in C: \ Sites \ zendcast \ library \ App \ UserService.php on line 23&#8243;. After reading some articles, I resolved this problem renaming the model&#8217;s class: &#8220;Model_UsersTable&#8221;. Is it correct? Can you tell me if I should do something else?<br />
thank you for your attention</p>
<p>Nicola</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jon</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-2699</link>
		<dc:creator>jon</dc:creator>
		<pubDate>Sun, 20 Sep 2009 04:24:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-2699</guid>
		<description>Hi Magnus,

The model is a fine place to do this depending on the size of your application. The use of a service layer is likely to make sense if your models are complex or are linked to multiple data sources. In such an instance, you might want to create a service layer that acts as a facade and brokers the commits across multiple persistence mechanisms.</description>
		<content:encoded><![CDATA[<p>Hi Magnus,</p>
<p>The model is a fine place to do this depending on the size of your application. The use of a service layer is likely to make sense if your models are complex or are linked to multiple data sources. In such an instance, you might want to create a service layer that acts as a facade and brokers the commits across multiple persistence mechanisms.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magnus von Bromsen</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-2689</link>
		<dc:creator>Magnus von Bromsen</dc:creator>
		<pubDate>Sat, 19 Sep 2009 14:32:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-2689</guid>
		<description>Thanks for great  tutorials.

ZF is very new for me, so therefor I have this newbee question:

Why a service layer? Why not put this code for select, insert, update ... in the Model?

Sorry for this dump question ;)

Regards, Magnus</description>
		<content:encoded><![CDATA[<p>Thanks for great  tutorials.</p>
<p>ZF is very new for me, so therefor I have this newbee question:</p>
<p>Why a service layer? Why not put this code for select, insert, update &#8230; in the Model?</p>
<p>Sorry for this dump question <img src='http://www.zendcasts.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Regards, Magnus</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rmh23</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-2367</link>
		<dc:creator>rmh23</dc:creator>
		<pubDate>Tue, 01 Sep 2009 20:14:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-2367</guid>
		<description>Hi im having the same issues with the &#039;class not found&#039;.  Im using zend 1.8 and have tried Jons method with no avail.  I understand the namespace for App in the library folder but its looking for the UsersTable.php in the /library/App/UserService.php when the Userstable.php is located in the modules folder.  Any ideas of where I have gone wrong?</description>
		<content:encoded><![CDATA[<p>Hi im having the same issues with the &#8216;class not found&#8217;.  Im using zend 1.8 and have tried Jons method with no avail.  I understand the namespace for App in the library folder but its looking for the UsersTable.php in the /library/App/UserService.php when the Userstable.php is located in the modules folder.  Any ideas of where I have gone wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jon</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-2166</link>
		<dc:creator>jon</dc:creator>
		<pubDate>Sat, 15 Aug 2009 05:43:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-2166</guid>
		<description>hey Spinto, it sounds like your not registering your namespace in the bootstrap file. I&#039;ve written about it here on the forum:
http://www.zendcasts.com/forum/post/65/#p65</description>
		<content:encoded><![CDATA[<p>hey Spinto, it sounds like your not registering your namespace in the bootstrap file. I&#8217;ve written about it here on the forum:<br />
<a href="http://www.zendcasts.com/forum/post/65/#p65" rel="nofollow">http://www.zendcasts.com/forum/post/65/#p65</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: spinto</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-2157</link>
		<dc:creator>spinto</dc:creator>
		<pubDate>Fri, 14 Aug 2009 10:53:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-2157</guid>
		<description>Good work here!!!!

I´m following the example but i can&#039;t instanciate App_UserService in the controller it throw me a error of class not found . I´m using Zend 1.9. Does anyone have this problem?? Need same help here.... thank you

Spinto</description>
		<content:encoded><![CDATA[<p>Good work here!!!!</p>
<p>I´m following the example but i can&#8217;t instanciate App_UserService in the controller it throw me a error of class not found . I´m using Zend 1.9. Does anyone have this problem?? Need same help here&#8230;. thank you</p>
<p>Spinto</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alessio</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-1994</link>
		<dc:creator>Alessio</dc:creator>
		<pubDate>Mon, 03 Aug 2009 13:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-1994</guid>
		<description>I&#039;m using the &#039;latest version of zend framework 1.9,

if I want to use the configurations included in the db application.ini what should include in __construct and bootstarp ??


thanks</description>
		<content:encoded><![CDATA[<p>I&#8217;m using the &#8216;latest version of zend framework 1.9,</p>
<p>if I want to use the configurations included in the db application.ini what should include in __construct and bootstarp ??</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russ</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-1406</link>
		<dc:creator>Russ</dc:creator>
		<pubDate>Fri, 26 Jun 2009 19:37:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-1406</guid>
		<description>I finally figured out my problem.  I went through and did the 1.8 installation and then followed the new quick start guide.  In that guide, they use the namespace of Default_Model_  for all of the model classes.  Once I updated the respective classes and controller, everything worked great.</description>
		<content:encoded><![CDATA[<p>I finally figured out my problem.  I went through and did the 1.8 installation and then followed the new quick start guide.  In that guide, they use the namespace of Default_Model_  for all of the model classes.  Once I updated the respective classes and controller, everything worked great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tommy</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-1240</link>
		<dc:creator>Tommy</dc:creator>
		<pubDate>Thu, 11 Jun 2009 22:07:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-1240</guid>
		<description>More info:
I already have my include path set to application/models.  I think the problem might have something to do with the fact that when you use Zend_Loader it gives you a warning saying it&#039;s outdated, so we&#039;re using Zend_Loader_Autoloader.  I had to add a namespace of App_ to the autoloader to get it to load things in library/app, and I&#039;m guessing it&#039;s the same for models, but since there&#039;s no namespace involved it just doesn&#039;t try it.  I&#039;m not sure.</description>
		<content:encoded><![CDATA[<p>More info:<br />
I already have my include path set to application/models.  I think the problem might have something to do with the fact that when you use Zend_Loader it gives you a warning saying it&#8217;s outdated, so we&#8217;re using Zend_Loader_Autoloader.  I had to add a namespace of App_ to the autoloader to get it to load things in library/app, and I&#8217;m guessing it&#8217;s the same for models, but since there&#8217;s no namespace involved it just doesn&#8217;t try it.  I&#8217;m not sure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tommy</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-1237</link>
		<dc:creator>Tommy</dc:creator>
		<pubDate>Thu, 11 Jun 2009 20:41:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-1237</guid>
		<description>I&#039;m having the same problem as Russ.  Is there a way to make it autodetect things in my models folder?</description>
		<content:encoded><![CDATA[<p>I&#8217;m having the same problem as Russ.  Is there a way to make it autodetect things in my models folder?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russ</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-1033</link>
		<dc:creator>Russ</dc:creator>
		<pubDate>Thu, 28 May 2009 21:58:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-1033</guid>
		<description>I&#039;m using netbeans if that makes any difference to this problem and maybe my installation needs to be altered, but I&#039;m not sure how.  I keep getting the Fatal error: Class &#039;UsersTable&#039; not found when I try the first test.</description>
		<content:encoded><![CDATA[<p>I&#8217;m using netbeans if that makes any difference to this problem and maybe my installation needs to be altered, but I&#8217;m not sure how.  I keep getting the Fatal error: Class &#8216;UsersTable&#8217; not found when I try the first test.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kisin</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-156</link>
		<dc:creator>kisin</dc:creator>
		<pubDate>Tue, 21 Apr 2009 14:23:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-156</guid>
		<description>very interesting.

looking forward for the next webcast about zend_db</description>
		<content:encoded><![CDATA[<p>very interesting.</p>
<p>looking forward for the next webcast about zend_db</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: james</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-155</link>
		<dc:creator>james</dc:creator>
		<pubDate>Tue, 21 Apr 2009 13:21:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-155</guid>
		<description>there&#039;s a wider article about service layers and zend here:

http://www.angryobjects.com/2009/03/30/writing-robust-php-backends-with-zend-framework/

albeit without the actual demo or code

just to add, these casts are excellent</description>
		<content:encoded><![CDATA[<p>there&#8217;s a wider article about service layers and zend here:</p>
<p><a href="http://www.angryobjects.com/2009/03/30/writing-robust-php-backends-with-zend-framework/" rel="nofollow">http://www.angryobjects.com/2009/03/30/writing-robust-php-backends-with-zend-framework/</a></p>
<p>albeit without the actual demo or code</p>
<p>just to add, these casts are excellent</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arro</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-152</link>
		<dc:creator>Arro</dc:creator>
		<pubDate>Mon, 20 Apr 2009 20:58:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-152</guid>
		<description>very interesting, to have some kind of adapter thing between .. thnx</description>
		<content:encoded><![CDATA[<p>very interesting, to have some kind of adapter thing between .. thnx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-146</link>
		<dc:creator>James</dc:creator>
		<pubDate>Sat, 18 Apr 2009 05:07:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-146</guid>
		<description>Interesting. Perhaps a mixture of the two styles would work, simple stuff in the table ($user-&gt;CreateTestRecord()), and more complicated / higher level work in the service layer?

Though a lot of the simple operations (and some more complex ones, as I understand it) should be handled by Zend_Db_Table_Abstract&#039;s magic functions.

Just thinking in-text here... Assuming you declare all the available tables in the service layer, you could make them publicly available and still have the table functionality ($service-&gt;users-&gt;CreateTestUser()), while also having the ability to just load the one particular table you need if your action is only working on one table (say, updating a user&#039;s email address).

Just throwing this out there, I don&#039;t quite have the experience to dictate either way. :)

Thanks for posting the video, your casts are very helpful.</description>
		<content:encoded><![CDATA[<p>Interesting. Perhaps a mixture of the two styles would work, simple stuff in the table ($user-&gt;CreateTestRecord()), and more complicated / higher level work in the service layer?</p>
<p>Though a lot of the simple operations (and some more complex ones, as I understand it) should be handled by Zend_Db_Table_Abstract&#8217;s magic functions.</p>
<p>Just thinking in-text here&#8230; Assuming you declare all the available tables in the service layer, you could make them publicly available and still have the table functionality ($service-&gt;users-&gt;CreateTestUser()), while also having the ability to just load the one particular table you need if your action is only working on one table (say, updating a user&#8217;s email address).</p>
<p>Just throwing this out there, I don&#8217;t quite have the experience to dictate either way. <img src='http://www.zendcasts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks for posting the video, your casts are very helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jon</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-145</link>
		<dc:creator>jon</dc:creator>
		<pubDate>Sat, 18 Apr 2009 04:17:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-145</guid>
		<description>Hey James,

that&#039;s a great point, however often when you&#039;re managing relationships between tables (e.g. a user with many posts, a post with many tags), then the relationships don&#039;t belong in either table. The &quot;service&quot; layer is a very light version of what Evans&#039; would call an aggregate root, or an entry point into a domain. The thinking here is that you want to encapsulate the complexity of multiple Zend_Db_Table&#039;s (and perhaps other non-database related data sources) in a class that hides the implementation details from its consumers. Also, if you&#039;re just doing simple CRUD, then the Active Record pattern (implemented in Doctrine as well as Propel) makes more sense since it really works well in handling the simple saves on one table. This pattern falls apart when you need to do joins that are more dynamic, or you need to start aggregating or doing reporting against larger data sets.

my 2 cents.</description>
		<content:encoded><![CDATA[<p>Hey James,</p>
<p>that&#8217;s a great point, however often when you&#8217;re managing relationships between tables (e.g. a user with many posts, a post with many tags), then the relationships don&#8217;t belong in either table. The &#8220;service&#8221; layer is a very light version of what Evans&#8217; would call an aggregate root, or an entry point into a domain. The thinking here is that you want to encapsulate the complexity of multiple Zend_Db_Table&#8217;s (and perhaps other non-database related data sources) in a class that hides the implementation details from its consumers. Also, if you&#8217;re just doing simple CRUD, then the Active Record pattern (implemented in Doctrine as well as Propel) makes more sense since it really works well in handling the simple saves on one table. This pattern falls apart when you need to do joins that are more dynamic, or you need to start aggregating or doing reporting against larger data sets.</p>
<p>my 2 cents.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://www.zendcasts.com/zend_db-insert-and-read/2009/04/comment-page-1/#comment-144</link>
		<dc:creator>James</dc:creator>
		<pubDate>Sat, 18 Apr 2009 04:00:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.zendcasts.com/?p=179#comment-144</guid>
		<description>What do you think of skipping the service class in favor of keeping table-specific logic in the table class itself?

so more like:
$users = new UsersTable();
$users-&gt;CreateTestUser();

Thinking after a few tables, keeping all the CRUD in a single class might be a bit unwieldy, and this is the other approach I&#039;ve seen while researching Zend_Db.</description>
		<content:encoded><![CDATA[<p>What do you think of skipping the service class in favor of keeping table-specific logic in the table class itself?</p>
<p>so more like:<br />
$users = new UsersTable();<br />
$users-&gt;CreateTestUser();</p>
<p>Thinking after a few tables, keeping all the CRUD in a single class might be a bit unwieldy, and this is the other approach I&#8217;ve seen while researching Zend_Db.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

