HABTM and belongsTo at the same join, cakePhp -
i have model fix relationship habtm device model. device model has belongsto device_type model, this, getting device type name:
var $belongsto = array('device_type'=>array('fields'=>'name'));
so, need every fix, devices , device_types. when make fix->find('all', array('recursive' => 2))
expect every device related fix (this works ok) , every device, device_type.name (which not working). instead every device in result (an empty array):
["device_type"]=> array(0) { }
besides this, when make query testing: fix->device->find('all')
, returns current device_type.names every device related fixes, means models related propertly.
any help? thanks.
first thing notice, naming conventions should lower case under_score multi-word table names.
and apparent relationships not set correctly if not getting data on recursive 2.
it's kind of hard make more judgement limited code.
Comments
Post a Comment