I wonder if it might be that Model/ Models are reserved words
Sam D
On Fri, Apr 25, 2008 at 9:37 AM, JoC <[EMAIL PROTECTED]> wrote:
>
> 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;
> }
> ?>
>
> >
>
--
--
(the old fart) the advice is free, the lack of crankiness will cost you
- its a fine line between a real question and an idiot
http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---