... to add to core?

I've just reworked some core cake code (very slightly!), so I could
have a cascadable, softDelete function, and have realised that if cake
followed 1 more convention, it could be very easy to add this into the
core.

// APP_MODEL
http://bin.cakephp.org/view/1596276186

At present if a table has created and modifed fields, these are
updated automatically, we could expand on this to include a deleted
field, then add an extra param to Model->del($id,$cascade,$soft)  and
if $soft is true, it would first check the field exists with hasField,
and then set the datetime.

// possible usage
$this->Model->del ($id, true, true);

All you would need to do to not get deleted records would be:

// produces: WHERE (`Model `.`deleted` IS NULL)
$conditions = array ("Model.deleted" => null);
$data = $this->Model->findAll ($conditions);

does anyone else need this kind of functionality, is it worth
submitting a request?

cheers,

Jon

-- 

jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to