I'm working on a legacy CakePHP project (CakePHP 1.3) and I'm having a hard time figuring out where to put shared model logic. I come from a Laravel background and would normally make a service class or Laravel facade and use it where needed, but that doesn't seem to be the Cake way of doing things. (Maybe I'm wrong about this??)
The project uses a hash to generate unique database keys. The hash function itself is in /vendors
. There are several helper functions used to generate the hash, decode the hash etc. and these are currently repeated in several different models. Ideally, I would like to extract these functions to a single class and call them statically from the models that need them: Hash::make($params)
, Hash::decode($hash)
etc. How could I set this up in a CakePHP application?