am planning to use cake php as webservice
i bulid the url like this (host/al_ecom_service/Category/getCategoryDetails/id/1/)
here i can get the output as a json.(did some chenges in while return.)
it working perfectly in localhost.
its not working after moved to the live, am getting following error
Missing Database Table
Error: Table categories for model Categories was not found in datasource default.
i assume that model $useTable is not working here.
Controller
----------------------
<?php
class CategoryController extends AppController {
var $name = 'Categories';
var $uses = array('Categories', 'Products');
function getCategoryDetails() {
$categories = $this->Categories->find('all', array(
'conditions' => array('Category.sub_category_status' => 1, 'Category.sub_category_id' => 1 ),
'fields' => array('Category.sub_category_name,Category.sub_category_status, Category.sub_category_id, Category.main_category_id, Category.sub_category_status')
));
echo json_encode($categories);
exit;
}
}
Model
------------------
<?php
class Categories extends AppModel {
var $useTable = 'al_data_categories_subs';
}
My Error log
-------------------
2015-04-27 05:35:20 Error: [MissingTableException] Table categories for model Categories was not found in datasource default.
Exception Attributes: array (
'table' => 'categories',
'class' => 'Categories',
'ds' => 'default',
)
Request URL: /al_ecom_service/Category/getCategoryDetails/id/1/
Stack Trace:
#0 /home/affordablear/public_html/al_ecom_service/lib/Cake/Model/Model.php(3496): Model->setSource('categories')
#1 /home/affordablear/public_html/al_ecom_service/lib/Cake/Model/Model.php(2900): Model->getDataSource()
#2 /home/affordablear/public_html/al_ecom_service/lib/Cake/Model/Model.php(2872): Model->_readDataSource('first', Array)
#3 /home/affordablear/public_html/al_ecom_service/app/Controller/CategoryController.php(63): Model->find('first', Array)
#4 [internal function]: CategoryController->getCategoryDetails('id', '1')
#5 /home/affordablear/public_html/al_ecom_service/lib/Cake/Controller/Controller.php(490): ReflectionMethod->invokeArgs(Object(CategoryController), Array)
#6 /home/affordablear/public_html/al_ecom_service/lib/Cake/Routing/Dispatcher.php(185): Controller->invokeAction(Object(CakeRequest))
#7 /home/affordablear/public_html/al_ecom_service/lib/Cake/Routing/Dispatcher.php(160): Dispatcher->_invoke(Object(CategoryController), Object(CakeRequest), Object(CakeResponse))
#8 /home/affordablear/public_html/al_ecom_service/app/webroot/index.php(108): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#9 {main}
Thanks In advance
--
Like Us on FaceBook
https://www.facebook.com/CakePHP Find us on Twitter
http://twitter.com/CakePHP ---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to
cake-php@googlegroups.com.
Visit this group at
http://groups.google.com/group/cake-php.
For more options, visit
https://groups.google.com/d/optout.