<?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: Doctrine Many To Many With Extra Fields</title>
	<atom:link href="http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/feed/" rel="self" type="application/rss+xml" />
	<link>http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/</link>
	<description>Design &#38; Development Blog</description>
	<pubDate>Fri, 30 Jul 2010 14:23:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Joanna</title>
		<link>http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/comment-page-1/#comment-7426</link>
		<dc:creator>Joanna</dc:creator>
		<pubDate>Tue, 27 Apr 2010 17:18:45 +0000</pubDate>
		<guid isPermaLink="false">http://think-robot.com/?p=180#comment-7426</guid>
		<description>$q = Doctrine_Query::create()
  		-&gt;from('Model_Db_Websites w')
  		-&gt;leftJoin('w.WebsiteMedia wm')
    	-&gt;leftJoin('wm.Media m')
		-&gt;orderBy('wm.ordering ASC')
	;
That's the query above.

Inside WebsitesBase setUp():

$this-&gt;hasMany('Model_Db_WebsiteMedia as WebsiteMedia', array(
             'local' =&gt; 'id',
             'foreign' =&gt; 'websites_id'));

WebsiteMedia setUp() function:

	$this-&gt;hasOne('Model_Db_Media as Media', array(
         'local' =&gt; 'media_id',
         'foreign' =&gt; 'id'));

    $this-&gt;hasOne('Model_Db_Websites as Websites', array(
         'local' =&gt; 'websites_id',
         'foreign' =&gt; 'id'));</description>
		<content:encoded><![CDATA[<p>$q = Doctrine_Query::create()<br />
  		->from(&#8217;Model_Db_Websites w&#8217;)<br />
  		->leftJoin(&#8217;w.WebsiteMedia wm&#8217;)<br />
    	->leftJoin(&#8217;wm.Media m&#8217;)<br />
		->orderBy(&#8217;wm.ordering ASC&#8217;)<br />
	;<br />
That&#8217;s the query above.</p>
<p>Inside WebsitesBase setUp():</p>
<p>$this->hasMany(&#8217;Model_Db_WebsiteMedia as WebsiteMedia&#8217;, array(<br />
             &#8216;local&#8217; => &#8216;id&#8217;,<br />
             &#8216;foreign&#8217; => &#8216;websites_id&#8217;));</p>
<p>WebsiteMedia setUp() function:</p>
<p>	$this->hasOne(&#8217;Model_Db_Media as Media&#8217;, array(<br />
         &#8216;local&#8217; => &#8216;media_id&#8217;,<br />
         &#8216;foreign&#8217; => &#8216;id&#8217;));</p>
<p>    $this->hasOne(&#8217;Model_Db_Websites as Websites&#8217;, array(<br />
         &#8216;local&#8217; => &#8216;websites_id&#8217;,<br />
         &#8216;foreign&#8217; => &#8216;id&#8217;));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Tourlourat</title>
		<link>http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/comment-page-1/#comment-7424</link>
		<dc:creator>Thomas Tourlourat</dc:creator>
		<pubDate>Tue, 27 Apr 2010 13:32:26 +0000</pubDate>
		<guid isPermaLink="false">http://think-robot.com/?p=180#comment-7424</guid>
		<description>Okay, I have not see the DQL correctly.

Two point are confused to me.
The first, I want to select only some properties. But the select () isn't working when I'm using the link-table like this; 

The second point is that you use a relation "WebsiteMedia" that isn't define in the WebsiteBase::setUp () function.

An optional point is, that the 
orderBy ("wm.ordring ASC"); doesn't change the result order. Why..</description>
		<content:encoded><![CDATA[<p>Okay, I have not see the DQL correctly.</p>
<p>Two point are confused to me.<br />
The first, I want to select only some properties. But the select () isn&#8217;t working when I&#8217;m using the link-table like this; </p>
<p>The second point is that you use a relation &#8220;WebsiteMedia&#8221; that isn&#8217;t define in the WebsiteBase::setUp () function.</p>
<p>An optional point is, that the<br />
orderBy (&#8221;wm.ordring ASC&#8221;); doesn&#8217;t change the result order. Why..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jo</title>
		<link>http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/comment-page-1/#comment-7423</link>
		<dc:creator>Jo</dc:creator>
		<pubDate>Tue, 27 Apr 2010 09:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://think-robot.com/?p=180#comment-7423</guid>
		<description>Not sure if that's what you are asking, but as you are explicitly using WebsiteMedia (with the alias wm) you should be able to access the properties as say wm.ordering or wm.caption.

Don't have the code at hand to check but I migth do a proper post about it later :)</description>
		<content:encoded><![CDATA[<p>Not sure if that&#8217;s what you are asking, but as you are explicitly using WebsiteMedia (with the alias wm) you should be able to access the properties as say wm.ordering or wm.caption.</p>
<p>Don&#8217;t have the code at hand to check but I migth do a proper post about it later <img src='http://think-robot.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Tourlourat</title>
		<link>http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/comment-page-1/#comment-7422</link>
		<dc:creator>Thomas Tourlourat</dc:creator>
		<pubDate>Tue, 27 Apr 2010 08:59:39 +0000</pubDate>
		<guid isPermaLink="false">http://think-robot.com/?p=180#comment-7422</guid>
		<description>Hi there,
Thank for this article.

I want to ask you just one question,
You have a many-to-many relationships between Media and Website.
The link-table have some property like "ordering", "caption"...
The question is : "How do you proceed to order your result when you use the leftJoin on WebsiteMedia".
Otherwise, How do you proceed to access on the properties of the link-table with DQL.

Thank,
Armetiz.</description>
		<content:encoded><![CDATA[<p>Hi there,<br />
Thank for this article.</p>
<p>I want to ask you just one question,<br />
You have a many-to-many relationships between Media and Website.<br />
The link-table have some property like &#8220;ordering&#8221;, &#8220;caption&#8221;&#8230;<br />
The question is : &#8220;How do you proceed to order your result when you use the leftJoin on WebsiteMedia&#8221;.<br />
Otherwise, How do you proceed to access on the properties of the link-table with DQL.</p>
<p>Thank,<br />
Armetiz.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VanSanblch</title>
		<link>http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/comment-page-1/#comment-7415</link>
		<dc:creator>VanSanblch</dc:creator>
		<pubDate>Mon, 26 Apr 2010 12:06:01 +0000</pubDate>
		<guid isPermaLink="false">http://think-robot.com/?p=180#comment-7415</guid>
		<description>And what fixture file do you use for ts_website_has_media table?</description>
		<content:encoded><![CDATA[<p>And what fixture file do you use for ts_website_has_media table?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/comment-page-1/#comment-7274</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Sun, 18 Apr 2010 00:51:30 +0000</pubDate>
		<guid isPermaLink="false">http://think-robot.com/?p=180#comment-7274</guid>
		<description>Very nice example. Would it be possible to have all Media items loaded for a Website even if the linking WebsiteMedia record doesn't exist (should give null values on ordering etc.)? This might seem odd in the current situation, however try to visualize it using User -&gt; User_Setting -&gt; Setting tables. Where Setting has a default_value. :)</description>
		<content:encoded><![CDATA[<p>Very nice example. Would it be possible to have all Media items loaded for a Website even if the linking WebsiteMedia record doesn&#8217;t exist (should give null values on ordering etc.)? This might seem odd in the current situation, however try to visualize it using User -&gt; User_Setting -&gt; Setting tables. Where Setting has a default_value. <img src='http://think-robot.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andres</title>
		<link>http://think-robot.com/2009/05/doctrine-many-to-many-with-extra-fields/comment-page-1/#comment-6540</link>
		<dc:creator>Andres</dc:creator>
		<pubDate>Tue, 26 Jan 2010 12:04:56 +0000</pubDate>
		<guid isPermaLink="false">http://think-robot.com/?p=180#comment-6540</guid>
		<description>Thank you soooooooooo much man (or girld or ROBOT) !!! I added the missing relation to the auto-generated aux table, and my dql query works perfect. :D:D:D</description>
		<content:encoded><![CDATA[<p>Thank you soooooooooo much man (or girld or ROBOT) !!! I added the missing relation to the auto-generated aux table, and my dql query works perfect. :D:D:D</p>
]]></content:encoded>
	</item>
</channel>
</rss>
