0

I am working on setting up scaffolding for my application to display CRUD type interface for the users table.

I've added the basic model user.php and controller UsersController.php and added scaffolding. Now when i go to localhost/cake/users

I get a notice 8 for all the links in my actions column.

Screenshot here: https://i.stack.imgur.com/qhhok.png

Any Ideas?

sachleen
  • 30,730
  • 8
  • 78
  • 73
Helius 06
  • 87
  • 1
  • 12
  • `Undefined index: id` should be the part you look at, and the line numbers. – sachleen Oct 11 '12 at 21:26
  • I'm thinking it is referring to the appname> Views > Scaffold> index.ctp file. However I don't have one. Scaffolding is supposed to work without an index file. Unless I am mistaken in which case it is referring to some other file? – Helius 06 Oct 11 '12 at 21:28
  • Sorry, I've never used CakePHP so I can't help you much. but do make sure whatever variables you have in the code that generates the view/edit buttons have the values you expect them to. – sachleen Oct 12 '12 at 01:36

1 Answers1

3

Have you by any chance named the primary key of the users table 'userid' instead of 'id' as per Cake conventions?

If so, you could either (a) rename the column to 'id', or (b) tell your model (User.php) to use 'userid' as the primary key e.g.

class User extends AppModel {
...
  public $primaryKey = 'userid';
...
}

Option (a) would be the preferred Cake way of doing things.

xSphere
  • 86
  • 3