public function deleteVersions($id)
    {
        # Remove all versions of the picture
        $pictures = $this->find(
            'all',
            array(
                'conditions' => array(
                    'Picture.main_id' => $id
                )
            )
        );

        if (count($pictures)) {
            foreach ($pictures as $pic) {
                # Remove file
                if (unlink($pic['Picture']['path'])) {
                    # Remove from database
                    $this->delete($pic['Picture']['id'], array('callback' => false));
                }
            }
        }

        return true;
    }
public function deleteVersions($id)
    {
        # Remove all versions of the picture
        $pictures = $this->find(
            'all',
            array(
                'conditions' => array(
                    'Picture.main_id' => $id
                )
            )
        );

        if (count($pictures)) {
            foreach ($pictures as $pic) {
                # Remove file
                if (unlink($pic['Picture']['path'])) {
                    # Remove from database
                    $this->delete($pic['Picture']['id'], array('callback' => false));
                }
            }
        }

        return true;
    }
public function deleteVersions ( $ id ) { # Remove all versions of the picture $ pictures = $ this -> find ( 'all' , array ( 'conditions' => array ( 'Picture.main_id' => $ id ) ) ) ; if ( count ( $ pictures ) ) { foreach ( $ pictures as $ pic ) { # Remove file if ( unlink ( $ pic [ 'Picture' ] [ 'path' ] ) ) { # Remove from database $ this -> delete ( $ pic [ 'Picture' ] [ 'id' ] , array ( 'callback' => false ) ) ; } } } return true ; }
Remove all versions from a picture from the database and from the server

@param $id
Remove all versions from a picture from the database and from the server