php - Extending ORM classes in CakePHP 3 -
i extend query class in order create function customcontain() available in every table model. how should it?
i want use blemethod() in table models in cakephp. have add code of function? have implements blemethod?
unlike cake2 cake3 not feature application level class appmodel
other classes inherit from. have 2 options:
the behavior can loaded globally models using model.initialize
event. , loading behavior inside events callback. read these pages:
but that's not want
customcontain()
indicates me want setup contains often. well, use finders.
finders can combined:
$this->table->find('foo')->find('mycontains')->all();
each custom find add query object. can add custom contains way.
read custom finder methods.
Comments
Post a Comment