Another alternative.

In your comments controller, add

var $recursion = 2;

Then modify your app/views/comments/index.thtml

changing this:

<td><?php echo $comment['Comment']['user_id']; ?></td>
<td><?php echo $comment['Comment']['note_id']; ?></td>

to this:

<td><?php echo $comment['User']['username']; ?></td>
<td><?php echo $comment['Note']['title']; ?></td>

Jeff

On Sep 24, 9:41 am, jwerd <[EMAIL PROTECTED]> wrote:
> Notice (8): Undefined index:  username [CORE/notes/views/notes/
> view.ctp, line 80]
>
> I think the complex part is that I'm trying to do this through my
> notes view, because that's where it will list the connecting followups
> and then I need it to refrence the user_id to the username, etc.  :(
>
> Array ( [id] => 13 [comment] => Should we have limits on the amount of
> trades per month. People could begin to conduct business this way and
> it might pose a problem. [note_id] => 21 [user_id] => 1 [created] =>
> 2007-09-23 16:42:22 )
>
> On Sep 24, 9:18 am, Marco <[EMAIL PROTECTED]> wrote:
>
> > If I undestood wll your need, it should be enough to define 'username'
> > as displayField for the user model:
>
> > model user
> > var $displayField = 'username';
> > User hasMany Note
> > User hasMany Followup
>
> > On 24 Set, 16:44, jwerd <[EMAIL PROTECTED]> wrote:
>
> > > I'm using 1.2.x (latest SVN from trunk) fyi.
>
> > > Anyways I've set up a notes system to keep track of my notes
> > > internally, which is scaling to be quite efficient for what I need /
> > > what.  Now here is my dilema.  I have three tables:
>
> > > notes
> > > id
> > > title
> > > body
> > > created
> > > user_id
>
> > > users
> > > id
> > > username
> > > password
>
> > > followups
> > > id
> > > comment
> > > user_id
> > > note_id
> > > created
>
> > > I believe I'm following the Cake style table layout and structure
> > > because most of my relations work.  The followups table is supposed to
> > > like comments on the note.
>
> > > Anyways when I'm viewing a note that has follow ups it appears below
> > > the note's properties and says Related Followups and it's a list of
> > > all the connected followups to that note.  Now the thing is here is
> > > what it looks like (from scaffolding)
>
> > > |Comment| ----------------------------------- | User | Note | Action
> > > |
> > > |This is doable, don't worry              | 1      | 1      | View,
> > > Edit, Delete |
>
> > > The problem is, I can't seem to change that 1 to the actual username
> > > and I'm not sure how without writing a custom sql query to handle the
> > > entire fetching of the followups to notes relationship.
>
> > > Can someone please help me out?  Here's my cake relationship layout
>
> > > model user
> > > User hasMany Note
> > > User hasMany Followup
>
> > > model followup
> > > Followup belongsTo Note
> > > Followup belongsTo User
>
> > > model note
> > > Note belongsTo User
> > > Note hasMany Followup
>
> > > I'm not asking for someone to completely write my script just to lend
> > > a helping hand as to if it's doable with the cake relations or do I
> > > have to custom query this certain thign I want.
>
> > > thanks for your time appreciate any response i get.


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