It will only return a value after you do an insert (a save of the new
Event).

Post the action you are having trouble with, and perhaps we can spot
the issue.

On Jan 19, 3:41 pm, mike <[email protected]> wrote:
> eeerrr, this is not working.
>
> I have this in the User model:
> var $hasMany = array ('Event');
>
> this in the event model:
>     var $belongsTo = array (
>                 'User' => array(
>             'className'    => 'User',
>             'foreignKey'    => 'creator_id',
>                 )
>         );
>
> $this->User->Event->getLastInsertId() in the users controller returns
> nothing!
>
> what am I missing??
>
> On Jan 19, 3:01 am, "Jon Bennett" <[email protected]> wrote:
>
> > > where do I grab the lastInsertId()?  in the event_controller?  and
> > >  then how do I pass it to the user view?
>
> > provided you've correctly set up your model associations, which I think are:
>
> > User hasMany Event
> > Event belongsTo User
>
> > From your Users controller you can do:
>
> > $event_id = $this->User->Event->getLastInsertId();
>
> > hth
>
> > jon
>
> > --
>
> > jon bennett
> > w:http://www.jben.net/
> > iChat (AIM): jbendotnet Skype: jon-bennett
>
>
--~--~---------~--~----~------------~-------~--~----~
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