php - Relate to another table without using prefixes -
so have task of creating mobile version of existing website built different framework didnt started.
the client wants use cakephp on it. im using cakephp 2.5.7. question is. there way relate table existing table without using prefixes?
to make more clear have on controller
public function index(){ $this->loadmodel('bulletin'); $bulletins = $this->bulletin->find('all'); }
in model
class bulletin extends appmodel{ var $usetable = 'bulletin'; var $hasmany = array( 'bulletincomment' => array( 'classname' => 'bulletincomment', 'foreignkey' => 'bulletinid', ), ); }
but bulletincomment
table on database has no prefix. , showing error on page
error: table bulletincomments model bulletincomment not found in datasource default.
i tried creating bulletincomment
model this
class bulletincomment extends appmodel{ var $usetable = 'bulletincomment'; }
but no avail. im still getting error. possible use relation without adding prefixes?
assuming prefixes setup in database connection (/app/config/database.php
) can override 1 table if add model:
public $tableprefix = '';
or remove prefix in connection , add models need it, depending on faster.
Comments
Post a Comment