[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition) |
[eluser]OverZealous[/eluser]
@macigniter No, just like the current DataMapper, DMZ never deletes existing objects unless explicitly requested. However, there is an easy way to enable this. My preferred technique is to add a method called delete_deep to my base extension object, which simply calls $this->delete(). Then, for objects that have one-way relationships, I override this method to delete related objects as needed. Alternatively, just override delete like this: Code: function delete($object = '', $related_field = '') { Be aware that this leaves you with no way to delete an object without deleting those related objects. Also, you could set up database integrity rules (foreign keys), which would be set up to automatically delete those objects. @MeanStudios That is a bug! Congratulations, you get a stuffed bear! (just kidding) For now, don't chain off of [/b]join_related()[/b], because it doesn't return $this. I'll update DMZ. (Amazing that I never caught that.)
[eluser]OverZealous[/eluser]
New Version: I updated DataMapper to 1.2.1. This includes 2 fixes. First, I fixed the above-mentioned join_related() bug. Second, I also discovered that save_<related_field>() was not returning TRUE or FALSE. Please download the file attached to the first post, and replace your current datamapper.php.
[eluser]NachoF[/eluser]
@MeanStudios: I know OverZealous has already reported your problem as a bug... but why are you using plurals and singulars in your models?? you have Class User and Class News.... I prefer to use singular cause that way I dont have to specify the name of the table.
[eluser]OverZealous[/eluser]
@NachoF Don't forget "News" is singular when referring to "the news", like in newspapers. ;-)
[eluser]NachoF[/eluser]
[quote author="OverZealous.com" date="1241475806"]@NachoF Don't forget "News" is singular when referring to "the news", like in newspapers. ;-)[/quote] Oh, I see... so in theory there would be no need to specify the name of the table, right>?
[eluser]OverZealous[/eluser]
Well, I'm not saying it wouldn't cause problems (it might), just pointing out that news is singular and plural, like moose or deer. That being said, having the model and table both named "news" should work. I've just never tested it.
[eluser]MeanStudios[/eluser]
@OverZealous *whew* I thought I was doing something wrong haha. Thanks for fixing it so quickly!! Yup, don't think there is a singular word for news . Maybe newsi? hehe
[eluser]MeanStudios[/eluser]
Found another bug heh Code: SELECT `news`.`*`, `users`.`id` AS user_id, `users`.`username` AS user_username FROM (`news`) LEFT JOIN `users` as users ON `users`.`id` = `news`.`user_id` Code: SELECT `news`.* I'm trying to find out where it's doing that in the code but I don't have much time to dedicate toward that .
[eluser]MeanStudios[/eluser]
Oops, sorry I missed that ><. I could have swore I downloaded the latest CI 1.7.1.....weird. Thanks |
Welcome Guest, Not a member yet? Register Sign In |