<?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>A Path Less Taken &#187; orm</title>
	<atom:link href="http://www.legendrefamily.org/blog/tag/orm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.legendrefamily.org/blog</link>
	<description>Breaking with convention in a very conventional fashion.</description>
	<lastBuildDate>Tue, 11 Oct 2011 03:19:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Getting Started with Spot ORM</title>
		<link>http://www.legendrefamily.org/blog/2011/10/getting-started-with-spot-orm/</link>
		<comments>http://www.legendrefamily.org/blog/2011/10/getting-started-with-spot-orm/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 03:19:11 +0000</pubDate>
		<dc:creator>JJ</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.legendrefamily.org/blog/?p=1513</guid>
		<description><![CDATA[In a recent post I touted the coolness factor of the Spot ORM. Based on a response to that post I prepared this short tutorial on how to get started. This is culled from personal experience and guidance that I received from the software&#8217;s author. I hope this is helpful to you if you are [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>In a recent post I touted the coolness factor of the Spot ORM.  Based on a response to that post I prepared this short tutorial on how to get started.  This is culled from personal experience and guidance that I received from the software&#8217;s author.  I hope this is helpful to you if you are interested in giving Spot a try.</p>
<p><span id="more-1513"></span></p>
<p>First, download the code from github <a href="https://github.com/actridge/Spot" title="Github\Spot">here</a> and copy the included folder where it can be referenced by your project.  I renamed my folder Spot and put it in the modules folder for my project.  Your approach my vary.</p>
<p>Next we set up the Spot objects for use.  Here is a MySql example.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">&quot;modules/Spot/Config.php&quot;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$cfg</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Spot\Config <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$adapter</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addConnection</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mysql://username:password@localhost/databasename'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$mapper</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Spot\Mapper <span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Right away you can see that Spot uses the namespace Spot.  It&#8217;s a trivial observation, but it might save you a little frustration when you are just getting started.  Next we need to define our entity.  Spot is based on the Data Mapper design pattern so the Entity is sort of a dumb object, but we need to define it anyway.  Here is a basic entity example.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
	Author Mapper
*/</span>
<span style="color: #000000; font-weight: bold;">class</span> Authors <span style="color: #000000; font-weight: bold;">extends</span> Spot\Entity
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Specify the data source (table for SQL adapters)</span>
    <span style="color: #000000; font-weight: bold;">protected</span> static <span style="color: #000088;">$_datasource</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;authors&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Define your fields as public class properties</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> fields <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span>
		<span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'int'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'primary'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'serial'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'firstname'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'string'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'lastname'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'string'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'sex'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'string'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> relations <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Authors Relationship</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span>
		<span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'books'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> 
			<span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'HasMany'</span><span style="color: #339933;">,</span> 
				<span style="color: #0000ff;">'entity'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Books'</span><span style="color: #339933;">,</span> 
				<span style="color: #0000ff;">'where'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'author_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">':entity.id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ASC'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>As you can see the Entity defines both the fields it cares about as well as foreign key related fields.  The naming conventions are pretty standard.  Note the $_datasource property which defines the actual data table where the entity is stored.  I don&#8217;t think this is necessary in the above example, but I wanted to include it as a reference for how you might refer to an authors mapper where the table name was something other than authors.  Also note the use of the singular author_id in the HasMany definition array.  This is by convention.  Now let&#8217;s use this Entity to do something useful.  Let&#8217;s get a single author.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$author</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Authors'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lastname'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$lastname</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$author</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">print</span> <span style="color: #000088;">$author</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastname</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;, &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$author</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">firstname</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;(&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$author</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sex</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;)&lt;/br&gt;&quot;</span> <span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>As you can see it is trivial to access the individual record retrieved from the DB.  In this example there could be more than one authors with the same last name, but only the first one would be returned and acted upon.  Now let&#8217;s create a new author entry.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$author</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Authors <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$author</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">firstname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;John&quot;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$author</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">lastname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Smith&quot;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$author</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sex</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Male&quot;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$author</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Again, pretty simple stuff.  The Data Mapper pattern takes care of all the dirty translation into the underlying data store.  You just work at the object level which is far more intuitive for a programmer.  Updating the entity is just as easy.  You simply retrieve the entity you want to update as shown above, assign new values to the properties you want to change and call the same save method on the mapper class.  That&#8217;s it. It looks like this.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$author</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span> <span style="color: #004000;">first</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Authors&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;firstname&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;John&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;lastname&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Smith&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$author</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">sex</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Female&quot;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$author</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>What is John up to anyway?  Well, at least you get the idea.  Deleting the record is just as easy.  Here is an example.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$author</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span> <span style="color: #004000;">first</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Authors&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;firstname&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;John&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;lastname&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Smith&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">delete</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$author</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>That&#8217;s all there is to deleting.  Now let&#8217;s look at some other useful commands.  Here we select all entities matching a specific criteria and order the result.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$authors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">all</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Authors&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lastname&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$author_sirname</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;sex&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Male&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">order</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lastname&quot;</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;desc&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$authors</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$authors</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$author</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Do something</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Here is a more complicated example using where.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$authors</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">all</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Authors&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lastname :like&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$sirname</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;firstname :like&quot;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;OR&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;AND&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #339933;">-&gt;</span><span style="color: #004000;">order</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;lastname&quot;</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;desc&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Shifting examples a bit here, below is an actual working example of a HasManyThrough relationship.  In this example the Tags table is related to the Items table through the Items_Tags table.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
	Tags Mapper
*/</span>
<span style="color: #000000; font-weight: bold;">class</span> Tags <span style="color: #000000; font-weight: bold;">extends</span> Spot\Entity
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// Specify the data source (table for SQL adapters)</span>
	<span style="color: #000000; font-weight: bold;">protected</span> static <span style="color: #000088;">$_datasource</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;tags&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Define your fields as public class properties</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> fields <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span>
		<span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'int'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'primary'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'serial'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'string'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'user_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'int'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'required'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Items Relationship</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> relations <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span>
		<span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'items'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span>
			<span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'HasManyThrough'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'entity'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Items'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'where'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">':throughEntity.items_id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'throughEntity'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Items_Tags'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'throughWhere'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tags_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">':entity.id'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'created_on'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'desc'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Based on this example we can select all Items associated with a group of tags.  Two things to note about the example below.  First, the user_id is another relation of a tag to a user which is defined in the tag&#8217;s entity.  Second, the nested foreach behavior is (I think, but I can&#8217;t recall for certain) an implementation of lazy loading of the associated item records for the tags.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$mapper</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">all</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Tags'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$tag</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'user_id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> config<span style="color: #339933;">::</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$tags</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$buffer</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tag</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$buffer</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">something_useful</span> <span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$buffer</span> <span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>So that&#8217;s it.  A quick and easy introduction to the basic use of Spot.  If you are interested then let <a href="http://www.vancelucas.com/" title="Vance Lucas">Vance Lucas</a> (the author) know and hopefully he&#8217;ll put more time into developing the code and the documentation into an even more accessible ORM than it already is.  Thanks for your interest and good luck with Spot.</p>
<div class="shr-publisher-1513"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2011%2F10%2Fgetting-started-with-spot-orm%2F' data-shr_title='Getting+Started+with+Spot+ORM'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2011%2F10%2Fgetting-started-with-spot-orm%2F' data-shr_title='Getting+Started+with+Spot+ORM'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.legendrefamily.org/blog/2011/10/getting-started-with-spot-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Tale of 2 PHP ORM&#8217;s</title>
		<link>http://www.legendrefamily.org/blog/2011/08/a-tale-of-2-php-orms/</link>
		<comments>http://www.legendrefamily.org/blog/2011/08/a-tale-of-2-php-orms/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 02:03:47 +0000</pubDate>
		<dc:creator>JJ</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.legendrefamily.org/blog/?p=1483</guid>
		<description><![CDATA[No, this is not about Doctrine and Propel, although I&#8217;m sure those are both really fine PHP ORM tools if you are willing to endure the learning curve. This is about 2 lesser known but notable ORM tools that deserve a nod of recognition. I&#8217;ve tried a number of PHP ORM tools over the last [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>No, this is not about Doctrine and Propel, although I&#8217;m sure those are both really fine PHP ORM tools if you are willing to endure the learning curve.  This is about 2 lesser known but notable ORM tools that deserve a nod of recognition.  I&#8217;ve tried a number of PHP ORM tools over the last year and many of them had merit.  In fairness, as you look at one attempt you begin to realize how much each of them owes to those that came before them.  There are so many variations on a theme that you can easily get confused and give up in frustration.  But my recent efforts have revealed two that I find very useful and note worthy depending on your project.  Here is a quick run down on each.</p>
<p><span id="more-1483"></span></p>
<h4>Spot</h4>
<p><a href="https://github.com/actridge/Spot" title="Spot - The PHP DataMapper Implementation">Spot</a> is the second attempt at a Data Mapper ORM implementation for PHP by <a href="http://www.vancelucas.com/" title="Vance Lucas">Vance Lucas</a>.  Vance&#8217;s first attempt was titled <a href="http://phpdatamapper.com/">PHPDataMapper</a> a was and nifty attempt in it&#8217;s own right.  Vance took what he learned and created Spot, the 2.0 implementation of his original ORM.  Spot has straight forward configuration through object inheritance and is very easy to use once you get the hang of it.  Spot supports HasOne, HasMany and HasManyThrough relationships.  It solves the Lazy Loading problem and is hands down the best implementation of association management through an ORM model that I&#8217;ve encountered.  The available documentation is spartan right now (I&#8217;m being kind), but Vance was kind enough to give me the few pointers I needed to get working quickly.  If anyone is interested let me know and I can provide some demo code in a separate post.</p>
<p>Given how much I have enjoyed using Spot, I have only one minor quibble.  As I looked at the implementation, I could not find a way to build Models dynamically at run time rather than pre-define them.  Granted this is not a problem for many projects, but it was an issue for the last thing I was doing.  Having said that if I do any PHP projects in the future with static data models then I&#8217;ll be using Spot to do them.  If you have a similar need and value power and simplicity then I encourage you to give Spot a go!</p>
<h4>RedBeanORM</h4>
<p><a href="http://www.redbeanphp.com/" title="RedBeanORM">RedBeanORM</a> is the marvelous dynamic ORM by <a href="http://www.gabordemooij.com/" title="Gabor de Mooij">Gabor de Mooij</a>. For anyone who has read my blog you probably know that I have an on-going love / hate relationship with RedBean.  This ORM is crazy easy to use as it builds the data tables and relationships on the fly as you run your program.  The ORM picks the most appropriate type for your data items and adds any fields that are missing to the table.  It even builds associations through intersection tables.  It is such a cool concept that I am constantly drawn to it.  That is except for the fact that it builds associations through INTERSECTION TABLES!  I was never a fan of this and I posted in the forum that using only intersection tables was overkill for many common relational models.</p>
<p>After much waiting I&#8217;m happy to report that as of version 2.0 Gabor has added N:1 relationship support that implements a foreign key!  It&#8217;s like mana from digital heaven!  The implementation is not as user friendly as Spot (I have to do some of the work myself, gasp!), but it does go a long way towards making the resulting data model more practical for larger relational problems.  This coupled with the dynamic nature of RedBeanORM make it a very compelling tool.  For my dynamic model science project I&#8217;m going to use RedBean.  I&#8217;m not sure where it will end up, but I&#8217;m excited to jump in and give it another try!</p>
<p>So there you have it.  A tale of two PHP ORM&#8217;s that deserve a little recognition for their authors&#8217; hard work and vision to make something better than what was there before.  It is the true spirit of open source and I salute both of them for doing such a great job.  I&#8217;m excited about ORM tools again, and that&#8217;s saying something!</p>
<div class="shr-publisher-1483"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2011%2F08%2Fa-tale-of-2-php-orms%2F' data-shr_title='A+Tale+of+2+PHP+ORM%27s'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2011%2F08%2Fa-tale-of-2-php-orms%2F' data-shr_title='A+Tale+of+2+PHP+ORM%27s'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.legendrefamily.org/blog/2011/08/a-tale-of-2-php-orms/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Interesting Python ORM</title>
		<link>http://www.legendrefamily.org/blog/2010/06/interesting-python-orm/</link>
		<comments>http://www.legendrefamily.org/blog/2010/06/interesting-python-orm/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 00:55:40 +0000</pubDate>
		<dc:creator>JJ</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[orm]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.legendrefamily.org/blog/?p=1100</guid>
		<description><![CDATA[I&#8217;m not an active Python developer at the moment, but I have been searching far and wide on the web for ORM solutions that might interest me. One Python based ORM which struck me as really interesting is SQLAlchemy. If you are interested in trying an ORM tool and you read the description on SQLAlchemy&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I&#8217;m not an active Python developer at the moment, but I have been searching far and wide on the web for ORM solutions that might interest me.  One Python based ORM which struck me as really interesting is <a href="http://www.sqlalchemy.org/" title="SQLAlchemy">SQLAlchemy</a>.  If you are interested in trying an ORM tool and you read the description on SQLAlchemy&#8217;s home page you would swear you had died and gone to ORM heaven!  If this solution actually accomplishes what it claims then it could be a very interesting choice.  I did not find a PHP port so I&#8217;ll have to keep looking for another PHP ORM that I&#8217;m interested in trying.  Sigh.</p>
<div class="shr-publisher-1100"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2010%2F06%2Finteresting-python-orm%2F' data-shr_title='Interesting+Python+ORM'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2010%2F06%2Finteresting-python-orm%2F' data-shr_title='Interesting+Python+ORM'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.legendrefamily.org/blog/2010/06/interesting-python-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORM Relationship Types</title>
		<link>http://www.legendrefamily.org/blog/2010/03/orm-relationship-types/</link>
		<comments>http://www.legendrefamily.org/blog/2010/03/orm-relationship-types/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 02:28:49 +0000</pubDate>
		<dc:creator>JJ</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://www.legendrefamily.org/blog/?p=977</guid>
		<description><![CDATA[Object Relational Mapping (ORM) tools allow developers to interact with databases through objects. The basic object in the typical solution is the model. The model is essentially an object representation of a single table in the database. In fact, implementations that subscribe to the activerecord design pattern will often view the model as an object [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Object Relational Mapping (ORM) tools allow developers to interact with databases through objects.  The basic object in the typical solution is the model.  The model is essentially an object representation of a single table in the database.  In fact, implementations that subscribe to the activerecord design pattern will often view the model as an object representation of a single row of a specific table.  Since the target data store in most cases is an RDBMS (excluding the recent surge in distributed Document based DB&#8217;s) the typical ORM needs some way to represent foreign key relationships in an object oriented way.  To facilitate this the field has evolved a set of conventions or names for foreign key (FK) relationships in the DB based on the object&#8217;s (table&#8217;s) role in the given index.  Here is a brief but hopefully useful explanation of four relationship types.</p>
<p><span id="more-977"></span></p>
<ul>
<li>Belongs-To &#8211; This is the most basic form of a FK representation in an ORM.  A field in a model is designated as type Belongs To when that field has is a FK that references the primary key (PK) in another model (table).  I say model since the Belongs To is used to describe the behavior of one model that contains a FK index in relation to another model that is the target of that FK index.  The typical default behavior would be for the field to be named by using the target model&#8217;s name joined to the target model&#8217;s PK field name by an underscore such as author_id.  The assumption in this example being that the author table would have a PK field named id.</li>
<li>Has-One &#8211; This is the other side of the Belongs-To convention.  This tells the model that another model is using this models PK as the target for its FK.  The model can use this relationship to manage cascading deletes, joined selections, etc.  The implication is that the model expects there to be one and only one FK in the remote model (table) attached to each record in this model (table).</li>
<li>Has-Many &#8211; This is the same as Has-One except now the model expects there to be one or more FK&#8217;s in the remote model (table) attached to each record in this model (table).</li>
<li>Many-To-Many &#8211; Although you might assume this is similar to Has-Many, it is actually more akin to Belongs-To.  This convention represents a FK relationship from this model (as with Belongs To) to an intersection table that in turn joins it to another model.  The typical implementation contains a Through property that defines the name of the intersection table.  By default this table will typically be named by joining the name of each model (table) connected to it with an underscore character.</li>
</ul>
<p>That is all there is to it.  Although this is a simple explanation of these four relationship types, I think you can begin to see how the ORM will rely on each to execute desirable behaviors as you interact with your database through model objects.  If you have any comments or corrections to the above please let me know.</p>
<div class="shr-publisher-977"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2010%2F03%2Form-relationship-types%2F' data-shr_title='ORM+Relationship+Types'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2010%2F03%2Form-relationship-types%2F' data-shr_title='ORM+Relationship+Types'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.legendrefamily.org/blog/2010/03/orm-relationship-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jelly ORM</title>
		<link>http://www.legendrefamily.org/blog/2010/02/jelly-orm/</link>
		<comments>http://www.legendrefamily.org/blog/2010/02/jelly-orm/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 03:28:37 +0000</pubDate>
		<dc:creator>JJ</dc:creator>
				<category><![CDATA[PHP Development]]></category>
		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://www.legendrefamily.org/blog/?p=946</guid>
		<description><![CDATA[jonathangeiger of the Kohana PHP Framework community has been working hard lately on a new ORM that shows promise. The github repository can be found here if you would like to check the code out. I decided to point my PHP Code Explorer at it to figure out the Jelly object model. Below is a [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>jonathangeiger of the Kohana PHP Framework community has been working hard lately on a new ORM that shows promise.  The github repository can be found <a href="http://github.com/jonathangeiger/kohana-jelly" title="Jelly ORM">here</a> if you would like to check the code out.  I decided to point my PHP Code Explorer at it to figure out the Jelly object model.  Below is a screen capture of what I found.  You can click the image to see a larger view.</p>
<p><a href="http://www.legendrefamily.org/blog/wp-content/uploads/2010/02/Jelly_Objects-1024x730.png" title="Jelly ORM Object Model"><img src="http://www.legendrefamily.org/blog/wp-content/uploads/2010/02/Jelly_Objects-300x214.png"/></a></p>
<p>I hope this view is helpful to you.  I know it helped me to get a better perspective of Jelly and how it was designed.</p>
<p><b>Update: </b>The official Jelly web site can be found at <a href="http://jelly.jonathan-geiger.com/" title="Jelly ORM">http://jelly.jonathan-geiger.com/</a>.</p>
<div class="shr-publisher-946"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2010%2F02%2Fjelly-orm%2F' data-shr_title='Jelly+ORM'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.legendrefamily.org%2Fblog%2F2010%2F02%2Fjelly-orm%2F' data-shr_title='Jelly+ORM'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.legendrefamily.org/blog/2010/02/jelly-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

