php - Cakephp model with several datasources -
i have model called forwards model uses table database. required of views connected model use costum datasource (this datasource have created links api).
now question how can add datasource model has datasource.
and how can tell paginator has use datasource when paginating (so doesnt confilct)
update
i have been reading abit seems way use 2 datasource in model hack abit, wondering possible use 2 models 1 controller while still paginating?
i want keep these settings
public $paginate = array( 'fields' => array( 'offer.id', 'offer.name', 'offerurl.preview_url', 'stat.ltr', 'stat.cpc', 'category.name', 'country.name') , 'conditions' => array('stat.date' => array( 'conditional' => 'between' , 'values' => array() ), ), 'group' => array('stat.offer_id'), 'method' => 'getstats', 'totals' => true, 'limit' => 20 ); i set these within controller
you can change data source calling model::setdatassource().
you can change model paginator uses by:
$this->paginator->paginate($modelinstance); or
$this->paginator->paginate('modelname'); you might want read page.
don't use controller::paginate more instead $this->paginator->settings. settings per model use
$this->paginator->settings['modelname'] = array(/*...*/);
Comments
Post a Comment