By default CakePHP has a AppModel
class and every model of an application inherits from it. A common design pattern to share logic between models is to create a behavior and configure a model to $actAs
that behavior.
But what if I wanted to introduce a hierarchy of model classes like this?:
AppModel
|__ Vehicle
|__ Car
|__ Bike
|__ Helicopter
I have tried to create a Vehicle
class that inherits from AppModel
, and then every children class inherits from Vehicle
. But CakePHP tells me it cannot find the class Vehicle
.
How could I make this and where in the CakePHP directory tree should I create Vehicle
?
Thanks!