Welcome Guest, Not a member yet? Register   Sign In
[Deprecated] DMZ 1.5.3 (DataMapper OverZealous Edition)
#21

[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 = '') {
    if( ! is_array($object) && empty($object)) {
        // delete related objects
    }
    $this->delete($object, $related
}

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.)
#22

[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.
#23

[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.
#24

[eluser]OverZealous[/eluser]
@NachoF
Don't forget "News" is singular when referring to "the news", like in newspapers.

;-)
#25

[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>?
#26

[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.
#27

[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 Smile. Maybe newsi? hehe
#28

[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`
Using the same code as above it's producing that query and it's saying, "Unknown column 'news.*' in 'field list'" because it's escaping the '*'. It should be:
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 Undecided.
#29

[eluser]OverZealous[/eluser]
@MeanStudios
http://stensi.com/datamapper/pages/troubleshooting.html
#30

[eluser]MeanStudios[/eluser]
Oops, sorry I missed that ><.
I could have swore I downloaded the latest CI 1.7.1.....weird.

Thanks Smile




Theme © iAndrew 2016 - Forum software by © MyBB