Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Deleting Data in cakephp2.x

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 146
    Comment on it

    If we are required to delete a record, cakephp 's model class offers a way for the same.

    Deleting the record with the perticular id can be done by using delete() function :

      delete(integer $id = null, boolean $cascade = true);
    

    The above statement deletes the record with the particular id $id. If the cascade in the function delete(), is set to true it will allow to delete all the records related to this id.

    But if we are required to delete all the records we can use the function deleteAll() this function is similar to the delete() function.

    Note: deleteAll() function always returns true even if the related records are not deleted as the delete query were successful.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: