I can see how that would work but it's not very efficient. I think you
should still try to get Cake to select the name from the users table
in the first place. With Bindable behavior this should be a snap.

On Mon, Mar 3, 2008 at 8:37 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>  Yeah, I've done that.
>
>  In any case, I made it work by adding to the users controller the
>  function:
>     function returnbyid($id = null) {
>         $user = ($this->User->findById($id));
>         return $user['User']['name'];
>     }
>
>  And then calling a requestAction on it in the appointment loop in the
>  location view:
>     <?php echo $this->requestAction("/users/returnbyid/".
>  $appointment['user_id']); ?>
>
>  Cheers!
>
>
>  On Mar 4, 3:25 am, "b logica" <[EMAIL PROTECTED]> wrote:
>  > Because your appointments table has a user_id column? If so, what you
>  > need to do is add the association to your Appointment model.
>  >
>  > var $belongsTo = array('User');
>  >
>  > Then, Cake will know to associate the Appointments.user_id column to
>  > the users table.
>  >
>  > Or you need to set the recursion higher in your locations controller.
>  > Read up on associations and also check out the Bindable behavior,
>  > which takes a lot of the pain out of dealing with binding/unbinding
>  > your models.
>  >
>
>
> > On Mon, Mar 3, 2008 at 6:24 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>  >
>  > >  Hi everybody,
>  >
>  > >  I've got a scheme in which I have Appointments - they have a Location
>  > >  and a User.
>  >
>  > >  If I go to the baked view of a Location, I can see the Appointments,
>  > >  but only the User_id is returned within the appointment in the
>  > >  Location view. How do I get the Username into the table?
>  >
>  > >  Cheers
>  >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to