Cake requires a single primary key "id".
On Apr 17, 6:07 pm, . <[EMAIL PROTECTED]> wrote:
> Ok. My table food_categories has 2 columns only: food_id and category_id
>
> The primary key is food_id and category_id together
>
> How do I delete a row? I cannot seem to do $this->FoodCategory->del($id)
>
> On Wed, Apr 16, 2008 at 2:33 PM, Baz <[EMAIL PROTECTED]> wrote:
> > I don't follow.
>
> > This table (if we're talking about Cake standards and conventions) is a
> > HABTM table. You don't update this manually. Also, these tables don't have
> > primary keys.
>
> > You would rather change the associated Models. So do a read on your Food
> > table for food_id = 1 and so a Food->category_id = 3 (I think. Read up in
> > the manual/bakery on associations) then you do a save.
>
> > On Wed, Apr 16, 2008 at 3:51 AM, . <[EMAIL PROTECTED]> wrote:
>
> > > I have a table foods_categories with columns: food_id and category_id
> > > (the primary keys are food_id and category_id)
>
> > > Let's say I insert the values (1,2) into this table. Let's say I want to
> > > update the row to (1,3). How would I update this row?
>
> > > Normally, if I implement the table with the columns id, food_id, and
> > > category_id (the primary key is id), I can just do
> > > this->data['food]['id'] =
> > > 1. Then do the save (which will actually update).
>
> > > So would it be better to have a single primary key "id"?
>
> > > Thanks in advance...
>
> > > Note: I am using cakephp 1.2
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---