Hello All,
before I get yelled at I tried all the solutions I found on here
before posting none of them worked.
I have the following structure and I can't get scaffolding to generate
a drop down of Manufacturers instead a get a text box.
tables
CREATE TABLE manufacturers (
id smallint(6) NOT NULL auto_increment,
title varchar(50) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY `name` (title)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE models (
id smallint(6) NOT NULL auto_increment,
manufacturer_id smallint(11) NOT NULL,
model varchar(50) NOT NULL,
voltage set('A/C','D/C') NOT NULL,
kw varchar(20) NOT NULL,
PRIMARY KEY (id),
KEY manufacturer_id (manufacturer_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
models
<?php
class Model extends AppModel {
var $name = 'Model';
var $useTable = 'models';
var $displayField = 'title';
var $belongsTo = array(
'Manufacturer' => array('className' => 'Manufacturer',
'foreignKey' =>
'manufacturer_id',
'conditions' =>
'',
'fields' => '',
'order' => ''
)
);
}
?>
<?php
class Manufacturer extends AppModel {
var $name = 'Manufacturer';
var $useTable = 'manufacturers';
var $displayField = 'title';
var $hasMany = array(
'Model' => array('className' => 'Model',
'foreignKey' =>
'manufacturer_id',
'order' => ''
)
);
}
?>
controler:
<? class ModelsController extends AppController
{
var $scaffold;
}
?>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---