<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Page comments</title>
		<link>http://www.ssbits.com/home/</link>
		<atom:link href="http://www.ssbits.com/home/" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title></title>
			<link>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_1220</link>
			<description>Great bit of code!

I'm actually trying to use this in some conditional logic to check if a relationship exists, but it doesn't seem to be working in the way I'd hoped. Here's what I'm trying:

$groups = DataObject::get(&quot;Group&quot;);
if($follower = $groups-&gt;Followers(&quot;FollowerID = '2'&quot;)){ // work with Follower ID 2 }

Groups have a many_many relationship with Followers, so I was expecting a DataObject or a false return, but I'm not getting a false if the relationship doesn't exist.

I can go about things in a different (albeit more long winded way), but to put my mind at rest, is what I'm trying to do possible?</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_1220</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_253</link>
			<description>I got the merge function to work. But still is there a better way... Something that is built in to sapphire maybe?</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_253</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_252</link>
			<description>I have come across what I assume is a rare case where I have a self many to many relationship on a dataobject. So the dataobject has got two relationships a many_many and a belongs_many_many with its self.

If I name both of the relationships the same then only the many_many seems to work (when calling it)... If I name them differently then I can only access one at a time.

I have tried to create a function that merges them but that isn't working so far, but I thought I would post here to see if you guys know what the best way would be to retrieve both sides of the relationship with this type of relationship?

Thanks
Liam</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_252</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_54</link>
			<description>lol sorry Dan, credit added! :)</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_54</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_53</link>
			<description>What a great little bit of code! How did you stumble across this?</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/snippets/2010/getting-items-from-a-has-many-or-many-many-relation/#PageComment_53</guid>
		</item>
		

	</channel>
</rss>