hello Raph,

Can you please  tell me is this Users controller function or Journal
controllers function?
Then i can provide you exact solution.

On Tue, Jun 30, 2009 at 12:13 AM, Raph <[email protected]> wrote:

>
> Hello,
>
> I can't paste exactly the same code, but I can tell you what I want to
> do. In controller where I have that "add()" method I want to save an
> entry to a journal which model is in "belongsTo" relation with "User"
> model, so I tried to use "add()" method in journal's controller with
> user id as a parameter. Somehing like that (very simple version):
>
> public function add($userId) {
> $this->data['Journal']['user_id'] = $userId;
>
> $this->Journal->saveEntry($this->data);
> }
>
> The problem is $userId is automaticlly set like that:
> $this->Jounral->id = $userId.
>
> On 29 Cze, 15:03, Vijay Kumbhar <[email protected]> wrote:
> > Hello Raph,
> >
> > I think you are making a mistake that you are providing a id while adding
> a
> > record.
> > If you provide the id to the save method it fires the update query.
> >
> > For further explanation Can you please paste the code here?
> >
> > On Mon, Jun 29, 2009 at 5:44 PM, Raph <[email protected]> wrote:
> >
> > > I have weird (I think) problem. When I've added "add()" action to the
> > > contoller, the id of coresponding model has been set automaticlly to
> > > "add()" method parameter, and when I try to save data using that
> > > action update instead of save is made.
> >
> > > This method singature looks like this:
> >
> > > public function add($someId).
> >
> > > Is it normal behavior? Do I have to manually call "create()" method in
> > > my model if I want to save, not update data?
> >
> > --
> > Thanks & Regards,
> > Vijayk.
> > Co-founder (www.weboniselab.com)
> >
> > "You Bring the Dreams, We'll Bring the Means"
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to