


<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Learn DooPHP &#187; ORM</title>
	<atom:link href="http://learn.doophp.com/tag/orm/feed/" rel="self" type="application/rss+xml" />
	<link>http://learn.doophp.com</link>
	<description>Learn DooPHP - a high performance MVC based PHP framework</description>
	<lastBuildDate>Thu, 18 Aug 2011 19:47:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using DooModel for Database Operations</title>
		<link>http://learn.doophp.com/2009/09/using-doomodel-for-database-operations/</link>
		<comments>http://learn.doophp.com/2009/09/using-doomodel-for-database-operations/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 18:30:31 +0000</pubDate>
		<dc:creator>Leng</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[DooModel]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=86</guid>
		<description><![CDATA[<p>If you have ever read DooPHP <a href="http://doophp.com/doc/guide/basic/model">guide</a> on model, you will see that a basic Model class does not have to extend any superclass.</p>
<p>A basic Model class looks like this:</p>
<pre class="brush: php;">
class User{
    public $id;
    public $uname;
    public $pwd;
    public $group;
    public $vip;

    public $_table = 'user';
    public $_primarykey = 'id';
    public $_fields = array('id', 'uname', 'pwd', 'group', 'vip');
}</pre>
<p>With the basic Model class, you can search for a database record by:</p>
<pre class="brush: php;">
//$this-&#62;db()-&#62;find('User');  is the same
Doo::db()-&#62;find('User');

//search for one record
Doo::db()-&#62;find('User', array('limit'=&#62;1) );

//search for a user named 'david'
Doo::db()-&#62;find('User', array('where'=&#62;&#34;uname='david'&#34;, 'limit'=&#62;1) );

//using prepared statement to avoid sql injection
Doo::db()-&#62;find('User', array(
                    'where' =&#62; 'user=?',
                    'param' =&#62; array($_GET['name']),
                    'limit' =&#62; 1
                )
           );

//Or simply use this for shorter code.
Doo::loadModel('User');
$u = new User;
$u-&#62;uname = $_GET['name'];
$result = Doo::db()-&#62;find($u, array('limit'=&#62;1));
</pre>
<p>Although the above code is pretty straightforward, we can make it even shorter and cleaner. First of all, we would need to have our Models to extend the DooModel class. We will have our Model class as the code below, notice the constructor:</p>
<pre class="brush: php; highlight: [14];">Doo::loadCore('db/DooModel');
class User extends DooModel {
    public $id;
    public $uname;
    public $pwd;
    public $group;
    public $vip;

    public $_table = 'user';
    public $_primarykey = 'id';
    public $_fields = array('id', 'uname', 'pwd', 'group', 'vip');

    function __construct(){
         parent::$className = __CLASS__;
    }
}
</pre>
<p>By</p>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/09/using-doomodel-for-database-operations/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Create a simple To Do List in DooPHP &#8211; Part 1</title>
		<link>http://learn.doophp.com/2009/09/create-a-simple-to-do-list-in-doophp-part-1/</link>
		<comments>http://learn.doophp.com/2009/09/create-a-simple-to-do-list-in-doophp-part-1/#comments</comments>
		<pubDate>Sun, 20 Sep 2009 17:07:35 +0000</pubDate>
		<dc:creator>Richard</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://learn.doophp.com/?p=13</guid>
		<description><![CDATA[<h2>Introduction</h2>
<p>This tutorial will guide you through all the steps required to get started using DooPHP through the creation of a simple To Do List Application. The tutorial is split into a number of sections and you will need to read the guide from the begining in order to understand whats going on.</p>
<ul>
<li><strong>Part 1 &#8211; Getting Started</strong></li>
<li><a href="http://learn.doophp.com/2009/09/create-a-simple-to-do-list-in-doophp-part-2/">Part 2 &#8211; The Signup Form</a></li>
<li>Part 3 &#8211; User Authentication &#8211; Coming Soon</li>
<li>Part 4 &#8211; The To Do List &#8211; Coming Soon</li>
<li>Part 5 &#8211; Adding AJAX Functionality &#8211; Coming Soon</li>
</ul>
<h2>Our Objective for this Tutorial</h2>
<p>In this tutorial we will be creating a simple To <em>Doo</em> List Manager Web Application and through the course of the tutorial we will be covering the following topics:</p>
<ul>
<li>Obtaining and Deploying the Base DooPHP Application</li>
<li>Setting up the MySQL Database</li>
<li>Creating the Models</li>
<li>Creating the To Do Manager Application
<ul>
<li>Signup Form</li>
<li>User Authentication</li>
<li>User Home Page</li>
<li>Task Actions</li>
<li>Enhancing you application with AJAX</li>
</ul>
</li>
</ul>
<p>You can view a demo of the finished project <a title="View a demo of the DooPHP Tutorial To Do List Application" href="http://doophp.com/demo/" target="_blank">here</a>. Some screen shots of the final application are also included below:</p>
<p>TODO: IMAGES TO GO IN HERE WHEN I FINISH!</p>
<p>TODO: UPDATE THE DEMO LINK ABOVE</p>
<p><span id="more-13"></span></p>
<h2>Obtaining and Deploying the Base DooPHP Application</h2>
<p>Before you can begin working on the To Doo List Manager you will need access to a Web Server. This guide assumes you already have webhosting or better yet</p>]]></description>
		<wfw:commentRss>http://learn.doophp.com/2009/09/create-a-simple-to-do-list-in-doophp-part-1/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
