<?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>Dylan&#039;s Journal &#187; fey</title>
	<atom:link href="http://dylan.hardison.net/journal/tag/fey/feed/" rel="self" type="application/rss+xml" />
	<link>http://dylan.hardison.net/journal</link>
	<description>A collection of unrelated sentences.</description>
	<lastBuildDate>Wed, 02 Nov 2011 13:53:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>A note about fey</title>
		<link>http://dylan.hardison.net/journal/2009/06/17/a-note-about-fey/</link>
		<comments>http://dylan.hardison.net/journal/2009/06/17/a-note-about-fey/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 16:10:35 +0000</pubDate>
		<dc:creator>dylan</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[fey]]></category>

		<guid isPermaLink="false">http://dylan.hardison.net/journal/?p=140</guid>
		<description><![CDATA[I am in the process of transitioning a DBIx::Class application to Fey abd Fey::ORM. I must say Fey::ORM is more comfortable than DBIC. Fey is a framework for representing database schemas and generating queries from that representation. Fey::ORM is a SQL-lovers object-relational mapping built on top of Fey&#8217;s impressive SQL generation capabilities. I do mean [...]]]></description>
			<content:encoded><![CDATA[<p>I am in the process of transitioning a
<a href="http://search.cpan.org/~ribasushi/DBIx-Class-0.08107/">DBIx::Class</a>
application to <a href="http://search.cpan.org/dist/Fey">Fey</a> abd Fey::ORM.
I must say Fey::ORM is more comfortable than DBIC.</p>

<p>Fey is a framework for representing database schemas and generating queries from that representation.
Fey::ORM is a SQL-lovers object-relational mapping built on top of Fey&#8217;s impressive SQL generation capabilities.</p>

<p>I do mean impressive, as Fey is able to infer join conditions entirely on its own:</p>

<pre><code># A User has many units, and units have many users, via the lnk_unit_users table.

my $unit_users = $schema-&gt;table('lnk_unit_users');
my $unit       = $schema-&gt;table('lkup_unit');

my $select_units = $factory-&gt;new_select
    -&gt;select($unit)
    -&gt;from($unit, $unit_users)
    -&gt;where($unit_users-&gt;column('user_id'), '=', Fey::Placeholder-&gt;new)
;

has_many 'units' =&gt; (
    table       =&gt; $unit,
    select      =&gt; $select_units,
    bind_params =&gt; sub { $_[0]-&gt;user_id },
);
</code></pre>

<p>So, when I go $user->units, I get an iterator object full of Units,
which executes the following sql:</p>

<pre><code>SELECT *
    FROM lkup_unit 
    JOIN lnk_unit_users ON (lnk_unit_users.unit_id = lkup_unit.unit_id) 
    WHERE lnk_unit_users.user_id = ?
</code></pre>

<p>Note, in my $select_units query I did not specify the join condition, I merely passed two Fey::Table objects,
and using the foreign key constraints Fey figured out what to do.</p>

<p>I think this is pretty cool. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://dylan.hardison.net/journal/2009/06/17/a-note-about-fey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

