Welcome Guest, Not a member yet? Register   Sign In
self-referencing relationship is not working using datamapper
#6

[eluser]johnmerlino[/eluser]
[quote author="gowrav vishwakarma" date="1302431336"]By default when you use datamappers class it looks for its table in plural
like if your calss is monther then $x=new Monther() will look for mothers table in database..
First to bypass this default behavior just use var $table="original table to use for this class" as class variable

eg
Code:
class offspring extends datamapper{
var $table='table to use for this class other wise it will search for offsprings' //look at s at last

var $has_one = .....
[/quote]

But how do I ensure that the offspring_id and mother_id fields of the mothers_offsprings table get updated with the primary keys of the two catergories records ($mother = new Mother; $offspring = new Offspring) that were created?


Messages In This Thread
self-referencing relationship is not working using datamapper - by El Forum - 04-10-2011, 09:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB