php - REST client model in CakePHP 3 -


this question has answer here:

i'm developing cake application pulls data database third-party rest api. i'd implement rest api using models various rest collections i'm trying access (inheriting single behaviour), can't model working without corresponding database table. original plan create class software extends cake\orm\entity , class softwarestable extends cake\orm\table, use before* hooks override various calls , reroute them api rather database.

however, i've added die() beforemarshal, beforerules, beforefind, beforesave, , beforedelete, , calling $this->softwares->all() controller still fails message

sqlstate[42s02]: base table or view not found: 1146 table 'inventory.softwares' doesn't exist

is approach wrong? simple i'm missing?

if don't want models backed database table don't use cake\orm\table. instead make own base model class implements cake\datasource\repositoryinterface. make models extend base class.

it's not trivial task, better alternative trying of hacking around table class' callbacks prevent them connecting database.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -