The behavior in CakePHP lives on the side of the model framework. Because we all prefer to create reusable and dry logic, the behavior is provided by CakePHP to get away from the ugly and extra code. Behavior "changes" the way models behave, forcing it to "act like."
You can think of them, that they are intended for models, which components for controllers and assistants are intended for representations. Behavior will help you make your code more abstract, not to mention the fact that they can be used for different models.
When you force a model to behave like something or somehow, you simply use the functions of this behavior. Of course, later you can pick up, or perhaps temporarily make the model forget about one or another behavior.
There are many other things that you can ask a model about behavior, for example, to check whether a model behaves in one way or another, if you do not behave.
As a rule, you point out models to behavior using the operator public $actAs = array(); but you can do this with $this->ModelName->Behaviors->load('BehaviorName') .
You use them in models, of course. If you do not implement your own behavior, and do not use the tons of them available at the bakery, you download them and use them as if the models already supported such functions.
source share