<?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"
	>
<channel>
	<title>Comments on: Zend Framework 1.5.1 and my Models code</title>
	<atom:link href="http://www.thehuey.com/blog/2008/04/01/zend-framework-151-and-my-models-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thehuey.com/blog/2008/04/01/zend-framework-151-and-my-models-code/</link>
	<description>News and other posts for friends and family</description>
	<pubDate>Tue, 06 Jan 2009 02:11:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Harlow</title>
		<link>http://www.thehuey.com/blog/2008/04/01/zend-framework-151-and-my-models-code/#comment-21860</link>
		<dc:creator>Harlow</dc:creator>
		<pubDate>Tue, 01 Apr 2008 23:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.thehuey.com/blog/archives/43#comment-21860</guid>
		<description>Hey thanks for helping me through this. Heres what I ended up with:

[ Config file: ]
[development] 
db.adapter = "Mysqli" 
db.params.host = "localhost" 
db.params.username = "user" 
db.params.password = "password"
db.params.dbname = "dbname"

[ Bootstrap: ]
# config
$config = new Zend_Config_Ini(APP_PATH.'/config/settings.ini', 'development');
	
# database 
$db = Zend_Db::factory($config-&#62;db); 
Zend_Db_Table::setDefaultAdapter($db);

[ Then the model: ]
class SomeModelName extends Zend_Db_Table
{
    protected $_name = 'db_table_name';
	
    public function findByPermalink($permalink = '')
	{
		return $this-&#62;fetchRow($this-&#62;select()-&#62;where('permalink = ?', $permalink));
	}
	
}

And viola! thats it. Minimal amount of code and all the DB functionality I need ;)</description>
		<content:encoded><![CDATA[<p>Hey thanks for helping me through this. Heres what I ended up with:</p>
<p>[ Config file: ]<br />
[development]<br />
db.adapter = &#8220;Mysqli&#8221;<br />
db.params.host = &#8220;localhost&#8221;<br />
db.params.username = &#8220;user&#8221;<br />
db.params.password = &#8220;password&#8221;<br />
db.params.dbname = &#8220;dbname&#8221;</p>
<p>[ Bootstrap: ]<br />
# config<br />
$config = new Zend_Config_Ini(APP_PATH.&#8217;/config/settings.ini&#8217;, &#8216;development&#8217;);</p>
<p># database<br />
$db = Zend_Db::factory($config-&gt;db);<br />
Zend_Db_Table::setDefaultAdapter($db);</p>
<p>[ Then the model: ]<br />
class SomeModelName extends Zend_Db_Table<br />
{<br />
    protected $_name = &#8216;db_table_name&#8217;;</p>
<p>    public function findByPermalink($permalink = &#8221;)<br />
	{<br />
		return $this-&gt;fetchRow($this-&gt;select()-&gt;where(&#8217;permalink = ?&#8217;, $permalink));<br />
	}</p>
<p>}</p>
<p>And viola! thats it. Minimal amount of code and all the DB functionality I need <img src='http://www.thehuey.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
