Wednesday, September 30, 2009

Re: Problem with saving id's

I am not sure, but as far as I know, you have to get the new ID from
the sequence yourself.
Whether you can persuade CakePHP to do it (don't know how, maybe "id =
your_seq.NEXTVAL") or maybe add a before insert trigger to get the new
ID from the sequence (if it can be done!).
Enjoy,
John

On Sep 30, 12:35 pm, Xanax <mammer...@gmail.com> wrote:
> Hi everyone,
>
> I've got a little problem with my cake app'.
>
> My database is Oracle. Every data saving handled by cake engine works
> fine.
> The problem is with a 'manual' saving :
>
> $this->User->Planification->create($data_planification);
>
>                                 $data_planification["Planification"]["user_id"] = $_POST
> ['user_id'];
>                                 $data_planification["Planification"]["projet_id"] = $_POST
> ['projet_id'];
>
>                                 $this->User->Planification->save($data_planification);
>
> This code doesn't work with my Oracle database while it used to work
> with MySQL database.
> When i add this line at the begining :
>                                 $data_planification["Planification"]["id"] = 5678;
> It works, so i guess i've got a problem with my id. I thought that
> cake generate automatically id's and then save them in the database.
> I've created sequences, maybe i must retrieve the current sequence ?
> Or is there a thing that i've missed ?
>
> Thanks for any help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
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?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: