Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What are Hooks in CakePHP ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.11k
    Comment on it

    Hooks are the functions that we can call before and after doing any task in Models ( database related ). Like after finding data, before saving data etc.

    e.g beforeSave(), afterSave(), beforeFind(), afterFind() etc.

    <?php
    class Classname extends AppModel {
        var $name = "Classname";
       public function beforeSave(){
            // your code
        }
       public function afterSave(){
            // your code
        }
    
    }   
    ?>
    

 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: