cakePHP, multiple hasOne in a single model

Posted by jason on Stack Overflow See other posts from Stack Overflow or by jason
Published on 2011-01-12T19:45:11Z Indexed on 2011/01/12 19:54 UTC
Read the original article Hit count: 169

Filed under:

say you have 3 models : user, hair_color, and eye_color

user hasOne hair_color user also hasOne eye_color

however

var $hasOne = 'hair_color';
var $hasOne = 'eye_color';

obviously wont work. So how do you implement many hasOne relationships in a single model?

I assume the answer is in the cookbook, Im going over that area now, I suspect it has something to do with passing an array to $hasOne, but no example of doing this.

© Stack Overflow or respective owner

Related posts about cakephp