I've tried just doing that but I get the error: Undefined property:
LessonsController::$User
I expected that to result in an error because I'm writing this code in
the lessons_controller not the users_controller.
Here's the complete function that I'm trying to add to the
controller...
function add() {
$this->set('authorArray', $this->User->generateList(null, null, null,
'{n}.User.user_id', '{n}.User.username'));
if (!empty($this->data)) {
if ($this->Lesson->save($this->data)) {
$this->flash('Your post has been
saved.','/lessons/titlebrowse');
}
}
}
I don't understand what you meant by adding "$users = array('Lessons',
'Users');" and no... I don't have that in my controller anywhere.
?
On Oct 12, 12:33 pm, Chambrln <[EMAIL PROTECTED]> wrote:
> If you want a list of all authors, not just authors associated to that
> lesson use:
> $this->User->generateList(......); (fill in with what you had)
>
> I'm assuming your controller has $uses = arra('Lessons', 'Users'); or
> similar...
>
> On Oct 12, 8:04 am, EVan <[EMAIL PROTECTED]> wrote:
>
>
>
> > My application has two tables: Lessons, Users. Users hasMany Lessons
> > and Lessons belongsTo Users.
>
> > I'm trying to make a selectTag menu but I'm having problems getting
> > the generateList function to work... here's the code I'm using within
> > the lessons_controller.
>
> > $this->set('authorArray', $this->Lesson->User->generateList(null,
> > null, null, '{n}.User.user_id', '{n}.User.username'));
>
> > Rather than returning the entire array of usernames, which I want, the
> > selectTag menu only has one option.
>
> > I know the code I'm using in the view is functional because I've made
> > a number of selectTag menus using fields within the Lessons table, but
> > I'm baffled as to how to extract an entire column from the Users table
> > in order to generate a list.
>
> > I would like to have the controller do this without having to change
> > the model relationships to a hadAndBelongsToMany type. Any advice?- Hide
> > quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---