I'm developing a Cake application that pulls data from the database as well as from a third-party REST API. I'd like to implement the REST API properly using models for the various REST collections I'm trying to access (inheriting from a single behaviour), but I can't get my model working without a corresponding database table. My original plan was to create class Software extends Cake\ORM\Entity and class SoftwaresTable extends Cake\ORM\Table, then use the before* hooks to override the various calls and reroute them to the API rather than the database.
However, I've added die() to beforeMarshal, beforeRules, beforeFind, beforeSave, and beforeDelete, and calling $this->Softwares->all() from the controller still fails with the message
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'inventory.softwares' doesn't exist
Is my approach wrong? Something simple that I'm missing?
Aucun commentaire:
Enregistrer un commentaire