It seems we're on the right track! When opening media/add I'm getting
the following error:

Notice (8): Undefined property: MediaController::$Medium
[APP/controllers/media_controller.php, line 57]
Notice (8): Trying to get property of non-object
[APP/controllers/media_controller.php, line 57]

...while line 57 is:

$authors = $this->Medium->Author->find('list', array('order' => 'Author.name'));

But the relationships of Author and Medium are set up correctly as far
as I can see (see my first post), so what could be the problem? Do you
think it could have something to do with the singular/plural forms of
Medium? Why should this have worked before and not now anymore? How
can I further examine the situation?

Thanks a lot for your help, Jeremy :-)

On Wed, Sep 22, 2010 at 2:29 PM, Jeremy Burns | Class Outfit
<jeremybu...@classoutfit.com> wrote:
> Actually I was being stupid. I saw User at the beginning of the error and 
> stopped thinking. Apologies.
>
> Is there a relationship defined in the Medium model to the Author model?
>
> Does Cake understand that Medium is the plural of Media? To test that, can 
> you use any Medium model functions in the media controller?
>
> As an side, why stop at 1.2.8 - why not go for 1.3.4? If you're going through 
> the migration process, why not come right up to date?
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.com
> http://www.classoutfit.com
>
> On 22 Sep 2010, at 13:08, Joshua Muheim wrote:
>
>> User model? Why do I need a User model?
>>
>> And yes, I do have a User model. ;-)
>>
>> But I didn't change anything in the source code except replacing the
>> cake folder with the newest version.
>>
>> On Wed, Sep 22, 2010 at 1:56 PM, Jeremy Burns | Class Outfit
>> <jeremybu...@classoutfit.com> wrote:
>>> Do you have a User model?
>>>
>>> Jeremy Burns
>>> Class Outfit
>>>
>>> jeremybu...@classoutfit.com
>>> http://www.classoutfit.com
>>>
>>> On 22 Sep 2010, at 12:53, psybear83 wrote:
>>>
>>>> Hi everybody
>>>>
>>>> I have overtaken a CakePHP application which used an out-dated version
>>>> of CakePHP (1.2.0.x), so I upgraded it to 1.2.8. Everything worked
>>>> fine before, but now I have problems with HABTM relations:
>>>>
>>>> $authors = $this->Medium->Author->find('list', array('order' =>
>>>> 'Author.name'));
>>>>
>>>> results in
>>>>
>>>> Fatal error: Call to a member function find() on a non-object in /
>>>> Users/josh/Sites/ziviapps/app/controllers/media_controller.php on line
>>>> 57
>>>>
>>>> My models:
>>>>
>>>> class Author extends AppModel {
>>>>       var $name = 'Author';
>>>>       var $hasAndBelongsToMany = array(
>>>>               'Medium' => array(
>>>>                       'className' => 'Medium'
>>>>                       ,'unique' => true
>>>>                       ,'order' => 'Medium.name ASC'
>>>>               )
>>>>       );
>>>> }
>>>>
>>>> class Medium extends AppModel {
>>>>       var $name = 'Medium';
>>>>       var $hasAndBelongsToMany = array(
>>>>               'Author' => array(
>>>>                       'className' => 'Author'
>>>>                       ,'unique' => true
>>>>                       ,'order' => 'Author.name ASC'
>>>>               )
>>>>       );
>>>> )
>>>>
>>>> Anyone has an idea on how to fix this? I'm trying to do it myself, but
>>>> I'm quite new to CakePHP and haven't done anything with PHP for 4 or 5
>>>> years now...
>>>>
>>>> Thanks a lot
>>>> Josh
>>>>
>>>> Check out the new CakePHP Questions site http://cakeqs.org and help others 
>>>> with their CakePHP related questions.
>>>>
>>>> You received this message because you are subscribed to the Google Groups 
>>>> "CakePHP" group.
>>>> To post to this group, send email to cake-php@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>>>> at http://groups.google.com/group/cake-php?hl=en
>>>
>>> Check out the new CakePHP Questions site http://cakeqs.org and help others 
>>> with their CakePHP related questions.
>>>
>>> You received this message because you are subscribed to the Google Groups 
>>> "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
>>> http://groups.google.com/group/cake-php?hl=en
>>>
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help others 
>> with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
>> http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to