I'm developing an API for C2DM to send push messages to Android devices. I have the API in PHP5 and I want to tranform it to CakePHP 2.0.
How can I create a model in CakePHP that doesn't refer to a table in the database? Is it possible to create such a model and a controller to manage it?
Or is there any existing code to do Cloud to Device Messaging (C2DM) in CakePHP?
Thanks in advance.
Usually, model classes represent data and are used in CakePHP applications for data access. They generally represent a database table but can be used to access anything that manipulates data such as files, external web services, or iCal events. A model can be associated with other models.
From a PHP view, models are classes extending the AppModel class. The AppModel class is originally defined in the cake/ directory, but should you want to create your own, place it in app/app_model. php. It should contain methods that are shared between two or more models.
You can set $useTable
to false
in that particular tableless model, see the cookbook for further details.
cakephp models have an attribute called $useTable which you can set to false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With