Monday, July 25, 2011

Re: legacy database, not able to set my own primary key for a view

What I meant to say is does the model file use "site" and not "sites."

On Jul 25, 4:49 pm, McBuck DGAF <mcbuckd...@gmail.com> wrote:
> You said your table name is "Sites," not "Site."  Was that just a typo
> or is your controller wrong?
>
> On Jul 25, 4:28 pm, Jamie <jamie....@gmail.com> wrote:
>
>
>
>
>
>
>
> > Way to not read the first post, like, at all. It's always a good idea
> > to read a post before replying. :)
>
> > Anyway, that's strange. Model::read() uses $this->primaryKey to
> > generate the condition. Can you show us your Site model class?
>
> > On Jul 25, 12:41 pm, Jens Dittrich <jdittr...@gmail.com> wrote:
>
> > > CakePHP follows convention by default but you can always configure
> > > everything. It just expects a column "id" in your table which is not there
> > > so all you have to do is configure it in the model file. Just set the
> > > $primaryKey variable in your model file to the name of the primary key.
> > > It is always a good idea to read the book:http://book.cakephp.org/view/1061/primaryKey

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: