[DataMapper] DataMapper 0.10.1 association problem

2009-12-01 Thread Somebody
Hello there :)
I am currently working on migrate from DM 0.9.x to 0.10.1
and now i have problem... I'll be grateful for the help

http://gist.github.com/246333

Problem that DM generate next SQL:
SELECT users.id, users.name FROM users INNER JOIN
friendships ON users.id = friendships.friend_id INNER JOIN
users ON friendships.user_id = users.id WHERE
friendships.user_id = 1 AND friendships.accepted = 't' GROUP
BY users.id, users.name ORDER BY users.id

Is there any way to join 'users' table with alias, like:
 INNER JOIN users AS users2

Or may be other way to solve this problem.

--

You received this message because you are subscribed to the Google Groups 
DataMapper group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.




Re: [DataMapper] DataMapper 0.10.1 association problem

2009-12-01 Thread Martin Gamsjaeger
The 0.10.x series doesn't yet support self referential many to many
relationships. You can have a look at
http://github.com/snusnu/dm-is-self_referential which provides a
temporary workaround. You don't get all the stuff fully supported
SRMTM relationships would give you, but it's better than nothing, and
also provides a nice declarative way of specifying them imho. Don't be
afraid to have a look at the code of the plugin to see if it fits your
needs. It's very small and simple.

HTH
snusnu

On Tue, Dec 1, 2009 at 16:19, Somebody bolkabo...@gmail.com wrote:
 Hello there :)
 I am currently working on migrate from DM 0.9.x to 0.10.1
 and now i have problem... I'll be grateful for the help

 http://gist.github.com/246333

 Problem that DM generate next SQL:
 SELECT users.id, users.name FROM users INNER JOIN
 friendships ON users.id = friendships.friend_id INNER JOIN
 users ON friendships.user_id = users.id WHERE
 friendships.user_id = 1 AND friendships.accepted = 't' GROUP
 BY users.id, users.name ORDER BY users.id

 Is there any way to join 'users' table with alias, like:
  INNER JOIN users AS users2

 Or may be other way to solve this problem.

 --

 You received this message because you are subscribed to the Google Groups 
 DataMapper group.
 To post to this group, send email to datamap...@googlegroups.com.
 To unsubscribe from this group, send email to 
 datamapper+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/datamapper?hl=en.




--

You received this message because you are subscribed to the Google Groups 
DataMapper group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.