Any reason not just use 2 models one for each?
Than in your controller you can reuse the functions and just tell it which 
model you want use on the fly.

function index($modelName) {
$reports = $this->$modelName->find('all');
$this->set('report', $reports);
}



On Wednesday, July 25, 2012 1:04:32 PM UTC-4, baur79 wrote:
>
> i have model "Report" with table "reports"
> it contain report of last month. (50 000 records every month)
>
> how can implement archive the data in another table with the same 
> structure and logic.
> and manipulate reading in Model.
>
> in my controller i want to ("DRY"):
>
> function index() {
> $reports = $this->Report->find('all');
> $this->set('report', $reports);
> }
>
> function archive()
> //do some manipulation
> //$this->Report->table = "reportarchives"
>
> $reports = $this->Report->find('all');
> //but query from "archived" table
> $this->set('report', $reports);
> $this->render('index')
> }
>
> please give some suggestions
>
>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to