<?php
class Pais extends AppModel {
var $name = 'Pais';
var $useTable = 'paises';
var $displayField = "nombre";
var $hasMany = array( 'Provincia' => array( 'className' => 'Provincia' ) );
var $validate = array(
'nombre' => array('rule' => 'notEmpty')
);
}
?>
<?php
class Provincia extends AppModel {
var $name = 'Provincia';
var $useTable = 'provincias';
var $displayField = "nombre";
var $belongsTo = array( 'Pais' => array( 'className' => 'Pais' ) );
var $validate = array(
'nombre' => array('rule' => 'notEmpty')
);
function getPais_id($id=null){
$provincia = $this->find('first', array('conditions' => array('id' => $id)));
$pais_id=$provincia['Provincia']['pais_id'];
return $pais_id;
}
}
?>
Now I need the code of view and controller to have the dependents combos.
Can you help with this?
Thanks
era
-- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment