Re: After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"
It's not a huge step, and while you're getting your hands dirty I - personally - would go all the way. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 22 Sep 2010, at 15:16, Joshua Muheim wrote: > I'm playing around with it, and it really baked me a model called > Media instead of Medium! But it seems I have already defined an > inflection in app/config/inflections.php: > > $irregularPlural = array('medium' => 'media'); > > So I really don't know what's going on here... > > Oh, and about the 1.2.8 vs. 1.3 issue: the application I have taken > over is quite buggy and absolutely not tested well yet, and I have > quite some difficulties to clean it up and make it a clean app. And I > fear that taking the step from 1.2.0 to 1.3 maybe would overburden me, > and so maybe it's easier to take the step to 1.2.8 first and then > maybe even to 1.3, although this seems like a detour... or do you > think otherwise? > > On Wed, Sep 22, 2010 at 3:01 PM, Jeremy Burns | Class Outfit > wrote: >> What is the table name? >> >> Take a look here: http://book.cakephp.org/view/953/Inflections - you might >> need to set up your own inflection. >> >> As an experiment, use Bake to bake the model for the table and see what it >> recommends. Obviously back up your current one first! >> >> Jeremy Burns >> Class Outfit >> >> jeremybu...@classoutfit.com >> http://www.classoutfit.com >> >> On 22 Sep 2010, at 13:57, Joshua Muheim wrote: >> >>> 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 >>> 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 > 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 ha
Re: After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"
I'm playing around with it, and it really baked me a model called Media instead of Medium! But it seems I have already defined an inflection in app/config/inflections.php: $irregularPlural = array('medium' => 'media'); So I really don't know what's going on here... Oh, and about the 1.2.8 vs. 1.3 issue: the application I have taken over is quite buggy and absolutely not tested well yet, and I have quite some difficulties to clean it up and make it a clean app. And I fear that taking the step from 1.2.0 to 1.3 maybe would overburden me, and so maybe it's easier to take the step to 1.2.8 first and then maybe even to 1.3, although this seems like a detour... or do you think otherwise? On Wed, Sep 22, 2010 at 3:01 PM, Jeremy Burns | Class Outfit wrote: > What is the table name? > > Take a look here: http://book.cakephp.org/view/953/Inflections - you might > need to set up your own inflection. > > As an experiment, use Bake to bake the model for the table and see what it > recommends. Obviously back up your current one first! > > Jeremy Burns > Class Outfit > > jeremybu...@classoutfit.com > http://www.classoutfit.com > > On 22 Sep 2010, at 13:57, Joshua Muheim wrote: > >> 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 >> 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 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 >>
Re: After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"
What is the table name? Take a look here: http://book.cakephp.org/view/953/Inflections - you might need to set up your own inflection. As an experiment, use Bake to bake the model for the table and see what it recommends. Obviously back up your current one first! Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 22 Sep 2010, at 13:57, Joshua Muheim wrote: > 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 > 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 >>> 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 t
Re: After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"
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 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 >> 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 > "Cake
Re: After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"
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 > 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
Re: After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"
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 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
Re: After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"
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
After upgrade from 1.2.0 to 1.2.8: $this->Medium->Author->find(...) results in "Fatal error: Call to a member function find() on a non-object"
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