I have three Models with the associated properties:
Links Model:
var $belongsTo = array('LinkCategory');
LinkCategory Model:
var $hasMany = array('Link');
var $hasAndBelongsToMany = array('User');
User Model
var $hasAndBelongsToMany = array('LinkCategory');
With that, I would expect the following to get me all the link categories for the user.
$user_link_categories = $this->LinkCategory->find('all', array('conditions' => array('User.id' => 1)));
However, it dies with:
Unknown column 'User.id' in 'where clause'
Query: SELECT LinkCategory
.id
, LinkCategory
.title
, LinkCategory
.created
, LinkCategory
.modified
FROM link_categories
AS LinkCategory
WHERE User
.id
= 1
I am new to CakePHP, but not MVC. In my mind, this should work given my associations. Have I missed something or does this just not work in CakePHP for some reason.