Hi Guys, I have this method I've written...
function tidyup() { //Re-sort orders to remove the 'hole' // Create an array of the image table contents of IDs and Orders. $conditions = array( 'fields' => array('id','order'), 'order' => 'Image.order ASC' ); $images = $this->Image->find('all', $conditions); //Loop through looking for order/count disparity and tidying up when disparity is found. $counter = 1; foreach ($images as $image): if ($image['Image']['order'] != $counter) { $image['Image']['order'] = $counter; $this->Image->save($image, false, array('id','order')); } $counter++; endforeach; $this->redirect(array('action' => 'index')); } ...to reorder a list of Images in a database table once one is deleted. This works perfectly. However, what I really want to do is have it triggered automatically once an Image is deleted. So I would expect just changing function tidyup to function afterDelete should work perfectly. When I do that, the function never runs. Can I get a sanity check please? Can anyone spot my error? Thanks in advance for any offers of assistance. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php