Re: Noooooob
Cake follows the "convention over configuration" ideals, so if you
don't follow the Cake conventions, you will probably run in to issues
- Cake expects all table ids to simply be named "id". Model
conventions can be found here: http://book.cakephp.org/view/24/Model-and-Database-Conventions
That being said, you can override the automatic functionality (which,
if you can follow conventions, makes things much easier); in this
case, here is the override for you:
http://book.cakephp.org/view/437/primaryKey
Enjoy building with CakePHP! :)
On Jan 19, 10:39 pm, Sam <syi...@gmail.com> wrote:
> Hi all,
>
> I just started using Cake and so far love it. I have a database
> background (MSSQL) and only recently started programming php.
>
> Here is the situation I'm in. I'm just going through the tutorial and
> it looks like it's looking for 'User'.'id', however, my Id column is
> named 'UserId' instead. Is this something I can customize in Cake
> instead of changing in the database?
>
> The error I'm getting...
> SQL Error: 1054: Unknown column 'User.id' in 'where clause'
>
> 1 DESCRIBE `users` 14 14 3
> 2 SELECT `User`.`UserId`, `User`.`FirstName`, `User`.`MiddleInitial`,
> `User`.`LastName`, `User`.`CompanyName`, `User`.`Address1`,
> `User`.`Address2`, `User`.`City`, `User`.`State`, `User`.`Zip`,
> `User`.`Email`, `User`.`Password`, `User`.`LastLogin`, `User`.`RoleId`
> FROM `users` AS `User` WHERE `User`.`id` = '9' LIMIT 1
>
> I have a feeling this is a really simple issue... please help.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home