Hi Sarah;
I'm not sure what you are asking.
User hasmany Userpages, so Userpage array will contain all the
Userpages belonging to User.
$example = $this->User->find('first');
foreach($example['Userpage'] as $key=>$value){
debug($value['id']);
}
On Aug 28, 9:18 am, Sarah <[email protected]> wrote:
> To clarify, I get the error message:
> Warning (512): SQL Error: 1054: Unknown column 'Userpage.id' in 'field
> list' [CORE/cake/libs/model/datasources/dbo_source.php, line 525]
> When I try to get select the Userpage.id field.
>
> On Aug 27, 3:19 pm, delocalizer <[email protected]> wrote:
>
>
>
> > Hi Sarah;
> > If your relationships are set up correctly and you have recursive >
> > -1, the usual 'find' method on User model should be returning the
> > parent 'Animal' anyway - what do you see if you put this in one of
> > your user controller functions:
> > $example = $this->User->find('first');
> > debug($example);
> > ?
>
> > On Aug 28, 6:01 am, Sarah <[email protected]> wrote:
>
> > > This is my setup:
>
> > > A 'user' hasMany 'userpage's.
> > > A 'user' belongsTo an 'animal'.
>
> > > I would like to be able to display user information as well as some
> > > information about the user's animal on a userpage view.
>
> > > I perform a find query to get the userpage id, user_id, animal_id.
>
> > > Is there a way to search for Animal information as well?
> > > This won't work because of the last field, but this is conceptually
> > > what I want:
>
> > > 'fields'=>array('user_id', 'id', 'User.animal_id',
> > > 'User.Animal.frontfilename')
>
> > > Thanks in advance!
> > > ~Sarah
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---