Datamapper - delete(). Not sure if this is a bug or my ignorance |
[eluser]Unknown[/eluser]
Hi I am using version 1.8 of the Datamapper ORM and it is fantastic. It has saved loads of time. I think I have found a bug in the delete() function. If in my model I specify the relationship between two objects in the simple way: Code: class Area extends DataMapper { When I try and delete the Area using Code: $myarea = new Area($id); I get an error from the Datamapper class on line 1929 Code: $object = new $class(); telling me that "r" is not an object. (r is the first letter in the has_many array string) I have swapped things around and added other realtionships and it always gives me the error on the first letter of the string. If I specify the relationship in a different order for example (color now first): Code: class Area extends DataMapper { I get an error from the same line saying: telling me that "c" is not an object. (always the first letter of the first member of the array) It appears that it is reading the first letter in the has_many array and trying to treat it as an object. If however I specify the realtionship in the model in the "complete" way eg: Code: class Area extends DataMapper { The delete works no problem. Not sure if this is a bug or simply that I am doing something wrong.
[eluser]WanWizard[/eluser]
Are you sure you're using the latest version? There has been some updates and fixes about 3 weeks ago to the code that converts a simple relationship definition (like you use) to an advanced definition (what you call the "complete" way), because that is the structure Datamapper uses internally. I've tried to recreate it here using your example code, but it works fine with the latest version. |
Welcome Guest, Not a member yet? Register Sign In |