Short answer: you do not!
This is a violation of MVC, which means cake. You need to move your βgenericβ code to the model and use this model only in both cases. not the controller (which is the link / logic of the model and the "webbrowser", not your shell). not the shell from inside the controller (since the shell is the link / logic from the model and the "CLI").
So:
- The model contains all the code.
- Shell uses the model and its methods
- The controller uses the model and its method
=> DRY and clean
then you will also not need a single App :: import application (or better, App :: uses).
PS: if you have a lot of non-model code, you can also make Lib in APP / Lib and use it as your regular class.
PPS: public $uses = array('Suivi'); for models in any case, and not for controllers (as, for example, docs speficy).
source share