I've found the answer. It is a bug in the stable version of Cake, and
the answer lies here -
http://www.nabble.com/Can't-scaffold-a-table-named-line_items-in-cake_1.1.19.6305-td15083360.html
Thanks for your help.
Chris
On Apr 11, 9:02 am, Chris <[EMAIL PROTECTED]> wrote:
> Hi Sliv,
>
> Sorry about the filenames - that's a typo in my post.
>
> Unfortunately I don't currently have access to the shell on the web
> server. I will attempt to run bake on a clone of the database on
> another server when I can get my hands on one to see what it yields,
> but that might be a few days.
>
> Do you believe that what I have done is correct, and should work?
>
> Thanks again,
>
> Chris
>
> On Apr 10, 4:51 pm, Sliv <[EMAIL PROTECTED]> wrote:
>
> > Well the first thing I noticed is your model filenames are not
> > following cake conventions, they should be singularized (request.php
> > not requests.php).
>
> > Have you tried baking your MVC as a start rather than coding it by
> > hand?
>
> > On Apr 10, 6:50 am, Chris <[EMAIL PROTECTED]> wrote:
>
> > > Hi All, I'm new to Cake and while I feel I have a good grasp of many
> > > of the concepts and conventions I have stumbled across the following
> > > problem. It's probably a simple lack of convention following, but
> > > I've read the manual over and over and I feel this should work.
> > > Hopefully my description will be succinct!
>
> > > I have 3 tables: groups, requests and request_statuses.
> > > A single request belongs to a single group and it has a single
> > > status. Hence a single group has many requests, as does a single
> > > request_status.
>
> > > I created the tables are follows (note: the request_statuses and the
> > > groups tables will be modified by an admin, and so I'd rather the ids
> > > were words than integers):
>
> > > CREATETABLE`requests` (
> > > `id` int(11) NOT NULL auto_increment,
> > > `name` varchar(32) NOT NULL,
> > > `request_status_id` varchar(16) NOT NULL default 'submitted',
> > > `group_id` varchar(8) NOT NULL default 'unknown',
> > > PRIMARY KEY (`id`)
> > > )
>
> > > CREATETABLE`request_statuses` (
> > > `id` varchar(16) NOT NULL,
> > > `name` varchar(16) NOT NULL,
> > > PRIMARY KEY (`id`)
> > > )
>
> > > CREATETABLE`groups` (
> > > `id` varchar(8) NOT NULL,
> > > `name` varchar(16) NOT NULL,
> > > PRIMARY KEY (`id`)
> > > )
>
> > > The models look like:
>
> > > app/models/requests.php:
> > > class Request extends AppModel
> > > {
> > > var $belongsTo = array(
> > > 'RequestStatus',
> > > 'Group'
> > > );
>
> > > }
>
> > > app/models/request_statuses.php:
> > > class RequestStatus extends AppModel
> > > {
> > > var $hasMany = array(
> > > 'Request'
> > > );
>
> > > }
>
> > > app/models/groups.php:
> > > class Group extends AppModel
> > > {
> > > var $hasMany = array(
> > > 'Request',
> > > );
>
> > > }
>
> > > If I create a app/controllers/requests_controller.php thus:
>
> > > class RequestsController extends AppController
> > > {
> > > var $scaffold;
>
> > > }
>
> > > then when I access this page to list the requests - the 'Group' column
> > > in the resultingtableis laid out correctly with links to the groups
> > > pages, but the 'Request Status' contains the error:
>
> > > "Notice: Undefined index: request_status_id in cake/libs/view/
> > > templates/scaffolds/index.thtml on line 79"
>
> > > I also note that the scaffolding index page for request_statuses shows
> > > the errors:
>
> > > Warning: Invalid argument supplied to foreach() in cake/libs/
> > > controller/controller.php on line 666
> > > Warning: Invalid argument supplied to foreach() in cake/libs/
> > > controller/controller.php on line 801
>
> > > As far as I can tell I've done everything right. Can anyone a) tell
> > > me why I get the error, and/or b) while you're at it generally point
> > > out and misunderstandings I may have demonstrated in my understanding
> > > of cake.
>
> > > I've tried refactoring everything down so that the2words "request
> > > status" become the single word "requeststatus", and that works.
> > > Obviously I could stick with this, but I feel it could and should be
> > > better.
>
> > > Many thanks for reading this far and for giving it some thought.
>
> > > Chris
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---