Hi, I've been researching already too much but I don't know what's
wrong.
Here's the question: when scaffolding, if there's a foreign key
correctly named in the table, what should appear in the scaffolding
form? I understand that some kind of drop down menu...?
Here's what I have:
CREATE TABLE `authors` (
`id` int(16) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`description` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ;
CREATE TABLE `quotes` (
`id` int(16) NOT NULL auto_increment,
`author_id` int(16) NOT NULL default '0',
`text` text NOT NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE `users` (
`id` int(16) NOT NULL auto_increment,
`login` varchar(255) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ;
Controllers:
<?php
class AuthorController extends AppController {
var $name = 'Author';
var $scaffold;
}
?>
<?php
class QuoteController extends AppController {
var $name = 'Quote';
var $scaffold;
}
?>
Models:
<?php
class Author extends AppModel {
var $name = 'Author';
// var $tablePrefix = 'cake_';
// var $displayField = 'name';
}
?>
<?php
class Quote extends AppModel {
var $name = 'Quote';
// var $tablePrefix = 'cake_';
// var $belongTo = array('Author' => array('foreignKey' =>
'author_id'));
// var $validate = array('title'=>VALID_NOT_EMPTY);
// var $displayField = 'title';
}
?>
So by naming conventions it should all work by default... shouldn't
it?
Then access http://goldensantos.com/lab/cake/quote/add and you see
that Quote.author_id appears as a normal input text, rather than
listing the available authors....
The commented lines I tried but nothing changed. I had the "cake_"
prefix on the tables before, but I decided to delete it in case that
was giving problems....
The php info is here: http://goldensantos.com/lab/phpinfo.php
I would be very happy anyone could give me a hand on this, I'm
desperate and it seems to be all ok. Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---