How do i must write my models to show supplier as combobox in product
add form?
Ex:
<<tables>>
product.id_product
product.id_supplier
product.descr
product.value
supplier.id_supplier
supplier.name
I'm doing as:
class Product extends AppModel {
var $name = 'Product';
var $useTable = 'product';
var $primaryKey = 'id_product';
var $belongsTo = array(
'Supplier' => array(
'className' =>
'Supplier',
'foreignKey' =>
'id_supplier',
'conditions' => '',
'fields' => '',
'order' => ''));
}
class Supplier extends AppModel {
var $name = 'Supplier';
var $useTable = 'supplier';
var $primaryKey = 'id_supplier';
var $hasMany = array('Product' => array(
'className' => 'Product',
'foreignKey' =>
'id_supplier',
'dependent' =>
true,)
);
}
Where is my mistake, because in view (product add) the field
id_supplier is showing as input, not as select option... :-(
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en