Welcome Guest, Not a member yet? Register   Sign In
In-Table Foreign Keys in DataMapper ORM
#4

[eluser]WanWizard[/eluser]
As you can see on that same page, 'join_self_as' indicates the column name to be used as key. This column name MUST be ending with '_id', which you should not specify (specify 'user' if the column is called 'user_id'). Same for 'join_other_as'. They are not table names!

You build relationship between models, the table name used for the model is defined in the model, not in the relationship. The only table name there is 'join_table', which is used in a many-to-many relationship with a non-standard table name.

Also, do not forget to define both ends of the relationship, in exactly the same way. Depending on the type of query Datamapper uses the parent or the child definition to construct the query.


Messages In This Thread
In-Table Foreign Keys in DataMapper ORM - by El Forum - 05-28-2011, 01:19 PM
In-Table Foreign Keys in DataMapper ORM - by El Forum - 05-29-2011, 02:35 PM
In-Table Foreign Keys in DataMapper ORM - by El Forum - 05-29-2011, 03:12 PM
In-Table Foreign Keys in DataMapper ORM - by El Forum - 05-30-2011, 01:10 AM
In-Table Foreign Keys in DataMapper ORM - by El Forum - 08-03-2011, 09:15 AM
In-Table Foreign Keys in DataMapper ORM - by El Forum - 08-03-2011, 09:29 AM
In-Table Foreign Keys in DataMapper ORM - by El Forum - 08-03-2011, 11:35 AM
In-Table Foreign Keys in DataMapper ORM - by El Forum - 08-03-2011, 12:46 PM
In-Table Foreign Keys in DataMapper ORM - by El Forum - 08-04-2011, 11:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB