php - CakePHP multiple controllers use same models -
in cakephp 2.5 have these controllers:
- commonscontroller extends appcontroller { ... } - mycontroller extends commonscontroller { ... } - goodcontroller extends commonscontroller { ... }
i have models:
- work1 extends appmodel { ... } - work2 extends appmodel { ... } - work3 extends appmodel { ... }
inside commonscontroller, have 45 methods uses work1, work2, work3 models.
- commonscontroller::method1() { // using work1 model } - commonscontroller::method2() { // using work1 model } .... - commonscontroller::method16() { // using work2 model } - commonscontroller::method17() { // using work2 model } .... - commonscontroller::method44() { // using work3 model } - commonscontroller::method45() { // using work3 model }
with structure inside controller can call models this:
// inside commonscontroller $this->method18(); $this->method26(); // inside mycontroller $this->method18(); $this->method42(); // inside goodcontroller $this->method18(); $this->method36();
in cakephp common controller functions use components. there structure use common models in controllers ?
Comments
Post a Comment