0
votes

I am using cakephp 2.5, and I get an error message :

Warning (2): ociexecute(): ORA-00904: "USER"."UF": invalid identifier [ROOT\app\Model\Datasource\Database\Oracle.php, line 432]

At the controller I do have this conditions asking for the user uf column

//Verify controller
$paginate['conditions']['User.uf'] = $this->passedArgs['Verify.uf'];
$paginate['contain'][] = 'User';

At the model I do have a belongsTo property with the user relationship:

//Verify Model
public $belongsTo = array(
        'User' => array(
            'className' => 'Usuario',
            'foreignKey' => 'user_id',
        ),

How can i relate the User Model with the Verify Model?

1
Is the Containable Behavior loaded? book.cakephp.org/2.0/en/core-libraries/behaviors/… Try to set debug level to 2 and have a look at the generated SQL. There should be a JOIN on the users table.Marijan
I just add public $actsAs = array('Containable'); in the model and it starts to work, Thank you!Ângelo Rigo
You're welcome. I just added this as the answer.Marijan

1 Answers

1
votes

Add the Containable behavior to the model class.

$actsAs = array('Containable');

You can also load the behavior on the fly:

$this->Verify->Behaviors->attach('Containable');