Monday, 19 August 2013

A function inside cakephp controller action

A function inside cakephp controller action

I'm trying to create a function inside a action. But I'm getting an error.
How do this?
The error:
Error: Using $this when not in object context File:
C:\wamp\www\societario\app\Controller\DocumentsController.php Line: 34
My action code:
function pesquisar(){
$this->loadModel('Company');
$this->set('documento', $this->Document->find('all'));
function empresa($id) {
$this->Company->find('first', array('conditions' => array('id' =>
$id), 'fields' => 'nome'));
}
}

No comments:

Post a Comment