Is your Achievements class an extension of the Table class?
I did not see that in your original post.
Enjoy, John
On Monday, 26 October 2015 19:39:21 UTC+2, lorenzoshake wrote:
>
>
>
> Il giorno lunedì 26 ottobre 2015 18:19:01 UTC+1, John Andersen ha scritto:
>>
>> Check your model associations - is any of them relying on CakePHP
>> identifying the keys?
>> Check your queries - is any of them specifying the offending column?
>>
>> Enjoy, John
>>
>> On Monday, 26 October 2015 18:44:29 UTC+2, lorenzoshake wrote:
>>>
>>> i 've a strange assoc problem:
>>>
>>> class Achievements
>>> {
>>> $this->belongsToMany('SocialUsers', [
>>> 'foreignKey' => 'achievement_id',
>>> 'targetForeignKey' => 'user_id',
>>> 'joinTable' => 'achievements_users',
>>> 'through'=>'AchievementsUsers'
>>> ]);
>>> ...
>>>
>>>
>>> if i delete all cache i raise error:
>>> Column not found: 1054 Unknown column
>>> 'AchievementsUsers.social_user_id' in 'field list'
>>> but if i reload the page all works fine ( until the next cache delete)
>>> It's like targetForeignKey was not readed first time execution.
>>> I've a lot of this belongsToMany but only here there is this issue
>>> Some suggests?!
>>>
>>> if do a query:
> $user = SocialUsers->find()->where(...)contain( ...
> 'Achievements')->first();
> if I remove 'Achievements' from contain all works fine
> the assotiation in SocialUsers is:
>
> $this->belongsToMany('Achievements', [
> 'className'=>'Achievements',
> 'joinTable' => 'achievements_users',
> 'foreignKey' => 'user_id',
> 'targetForeignKey'=>'achievement_id',
>
> ]);
>
> don't know why doesn't works with Achievments in contain!
>
>
>
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.