How create belonge assocation in models in cakephp
问题 I use Cakephp framework, and I have problem with my association. How create belong to association in models in cake php. When I use belongto and hasMany in my model. Can I find sample model to view this example? 回答1: Simple belongsTo association: <?php class Profile extends AppModel { var $name = 'Profile'; var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id' ) ); } ?> Simple hasMany association: <?php class User extends AppModel { var $name = 'User'; var