0
votes

I have a model, called "Cliente" and this model have a association with another table called ClienteRelFot. I declared that ClienteRelFot has a useTable = 'rel_fot_ec', but the cake are looking for "rel_fots".

The rel_fot_ec table exists on my database because I use to find another data.

Someone have a idea to solve this problem?

I tried clear cache and delete all files from tmp folders.

Below, we have the error:

Error: Table rel_fots for model RelFot was not found in datasource default.

2
Could you post you model association for 'Cliente'? Also, I'm guessing this error happens when you try to find 'ClienteRelFot' in a find from 'Cliente', not when you do a $this->ClienteRelFot->find)? Could you confirm that? - Nunser
Thanks for your help! - Stark

2 Answers

1
votes

Your associations are trying to pull data from the model 'RelFot' (per the error), not 'ClientRelFot', so declaring that 'ClienteRelFot' uses the table 'rel_fot_ec' will have no effect.

Try adding:

public $useTable = 'rel_fots';

in your 'RelFot' model.

0
votes

I had this problem too, even though using public $useTable = ...

My data model: Event hasMany > Submissions hasMany > Authors

Cake was telling me [MissingTableException] Table authors for model Author ..., the problem was not in the Author model, but in the Submission model:

class Submissions extends AppModel {
    public $hasMany = array(
        'Author' => array(
            'className' => 'authors', // author should be singular
            'foreignKey' => 'submission_id'
        )
    );