I'm trying to create a dropdown list to select the category in the add
and edit views of the Post controller. I found an example in this
thread:

http://groups.google.com/group/cake-php/browse_thread/thread/a4af5b2ffeb1231e/0de3fed71d9697c2?lnk=gst&q=category+dropdown&rnum=1#0de3fed71d9697c2

So I did it like this, but I keep getting the error:

Fatal error: Call to a member function on a non-object in /var/www/
vhosts/zomp.nl/httpdocs/framework/app/controllers/posts_controller.php
on line 91

That's this line:
foreach ($this->model['post']->category->findAll() as $pass)

And (-might be helpful-) my post model looks like this:

class Post extends AppModel
    {

       //....

        var $belongsTo = array('Category' =>
                         array('className'     => 'Category',
                               'conditions'    => '',
                               'order'         => 'Category.id DESC',
                               'limit'         => '',
                               'foreignKey'    => 'category_id',
                               'dependent'     => true,
                               'exclusive'     => false,
                               'finderQuery'   => ''
                         )

                                );
          //...

   }

The relation between the two works, because I can easily fetch each
post's category through the Post model. Any clues about what I'm doing
wrong?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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