Code Examples | => When interacting with the database, sometimes the model will
need to perform more complex processes than simply CRUD
functionality. In some applications, deleting a record will require
performing other manipulations to other tables and records,
and so on, with other database operations. Cake resolves this issue
with behaviors, which are classes that may be called by models when
performing model functions.
=> Behaviors are stored in the app/models/behaviors directory and
can be named anything following the same rules for naming helper
files and components. They must have the .php extension.
=> In the file, behavior class names are set with the following
syntax:
class SpecialBehavior extends ModelBehavior {}
=> By using behaviors to store complex or customized model
operations, you give the application's models more consistency. |