Routine with CakePHP is legend to display data in view

0

I'm using CakePHP 2.4.2.

I can not understand the slowness of displaying the data. As the number of records in the table increases, the slower it gets.

The structure of the table is id (int (11)), name (varchar (255)), status (char (1)). Check-in is small.

The table has about 2500 records and passes a minute and a half the response time so that all are returned, and there is a paging of 10 records per page. In order to get work I have to limit the return of a maximum of 250 records.

I'm new to CakePHP and I'm trying to maintain a routine that I got ready for.

class ProcessosController extends AppController {
    public $name = 'Processos';
    public function beforeFilter() {
    parent::beforeFilter();
    $this->Security->unlockedActions = array('excluir','delete','salvar');
    }
    function index(){
    $processos = $this->Processo->find('all',
         array(
                'conditions' => array('Processo.status' => 1),
                'order' => array('Processo.nome ASC')
            )
        );
        $this->set('processos', $processos);
        $this->set('_serialize', array('processos'));
    }
?>
    
asked by anonymous 26.09.2016 / 03:40

1 answer

0

Is this model related to other models? If so, put recursive = -1, like this:

function index(){
    $processos = $this->Processo->find('all', array(
        'conditions' => array('Processo.status' => 1),
        'order' => array('Processo.nome ASC'),
        'recursive' => -1,
    ));
    $this->set('processos', $processos);
    $this->set('_serialize', array('processos'));
}
    
24.10.2016 / 20:29