Wednesday, April 24, 2013

RE: Deletion Simulation

No that would not be the case.

I can do a find on a user to get 20 different find results.

I.e.…

$this->User->getProfile($user_id);

$this->User->getPosts($user_id);

$this->User->Post->getComments($user_id, $post_id);

$this->User->getActivity($user_id);

 

 

and on and on since there are hundreds of calls to throughout the site grabbing various bits of info when needed specific to the request.

 

Say deleting a Post for example, would need to delete any files / images associated, any comments for that Post. Any FavoritePost other User may have tagged as favorite / likes.

 

There should be a way to see the data that would be deleted thru debug(); die() / return false or something  and kill the request so you can see if too much data would be deleted or not enough and adjust the code according.

Should not have to delete a post for this example, log out as the user, log in as another to see if the post added as a fav was deleted, logout back in as original user create new post, log in as another user to like the post or comment on it.

This would take a crazy amount of time to verify just for this 1 action alone.

 

I know delete cascade => true || false but with so many models in this application with so many dependent records It would be much easier to see cascade => true is grabbing this data, that related model cascade = > true and follow exactly what is getting pulled thru the chain of relations.

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of mrenigma
Sent: Wednesday, April 24, 2013 5:34 AM
To: cake-php@googlegroups.com
Subject: Re: Deletion Simulation

 

You would need to do a find on the record you plan on deleting this will then show you all the related records that would be deleted with it I believe.

On Tuesday, 23 April 2013 18:58:11 UTC+1, advantage+ wrote:

I have a fairly large database with a lot of records related to each other and need to follow the cascades on deletion of records from various points in the site and see what would be related along the trail.

But I do not want to delete these records as then I have to go back and create them and that takes quite a bit of time even with an automated script since it cross's between Users, their Role, and their records with hasMany, belongsTo, HABTM, to other parts of the site and so on.

 

Is there a way to follow a delete thru its relations / cascade to return what would be deleted but not actually delete anything?

 

Thanks

Dave

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: