Undefined property: ProcesosController::$NivelTipo and Fatal error: Call to a member function find() on a non-object in /app/app_controller.php on line 195
hola, tengo un error en una aplicacion con cake esta funcion recibe unos parametros y con ellos tengo que buscar un precio private function cambio_precio($producto_id=null,$producto_especial=null){ $listado = $this-ListadoPrecio-find('first',array( 'contain'=false, 'joins'=array( array( 'table'='precios', 'alias'='Precio', 'type'='inner', 'conditions'=array( 'Precio.id=ListadoPrecio.precios_id' // *llama a la funcion buscar_nivel_publico en app/app_controller ,'Precio.nivel_tipo_id='.$this-buscar_nivel_publico() --- // tengo otra funcionque busca el precio en app/app_controller ,'Precio.productos_id='.$producto_id ,'Precio.estado=1' ,'ListadoPrecio.estado=1' ) ) ) )); esta funcion solo hace una busqueda codgio: function buscar_nivel_publico(){ $nivel = $this-NivelTipo-find('first',array( 'contain'=false ,'conditions'=array( 'Niveltipo.numero=1' ,'NivelTipo.tienda_id='.$this-tienda_id ,'NivelTipo.estado=1' ) )); return $nivel['NivelTipo']['id']; } } es alli donde me da el error, espero alguien me de su opinion gracias -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: The classic Fatal error: Call to a member function find() on a non-object for newbie
It's because the item Country does not exist on Information. Models are always singular, so where you have Countries defined in your Information belongsTo you should have Country instead. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: The classic Fatal error: Call to a member function find() on a non-object for newbie
Ohhh thanks I miss this part now it works. Ing. Reynier Pérez Mira http://reynierpm.site90.com/ On Thu, Feb 23, 2012 at 5:48 PM, jeremyharris funeralm...@gmail.com wrote: It's because the item Country does not exist on Information. Models are always singular, so where you have Countries defined in your Information belongsTo you should have Country instead. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: The classic Fatal error: Call to a member function find() on a non-object for newbie
No problem. Sometimes it helps to have another person look at it :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
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
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
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 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
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 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
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 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
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 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
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 jeremybu...@classoutfit.com 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 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
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 jeremybu...@classoutfit.com 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 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
Re: Fatal error: Call to a member function find()
Tnx i solved On May 1, 7:40 am, kani infok...@gmail.com wrote: ok tnx i trying to make simple edictionary i created 3 table /mnens,enmns,wordtypes/ Relations is mnens - n wordtypes n - enmns i used scaffolding mnens belongsTo wordtypes enmns belongsTo wordtypes On Apr 30, 8:13 am, Stu greenmushroo...@gmail.com wrote: Well the key lines here are: Notice (8): Undefined property: Enmn::$Wordtype [APP\controllers \enmns_controller.php, line 27] and Fatal error: Call to a member function find() on a non-object in F: \wamp\www\dict\app\controllers\enmns_controller.php on line 27 My diagnostic shows that you are in fact calling find on an undefined property (see what I did there?). Now either you're simply misspelling Wordtype (could be WordType, just a guess), or Wordtype isn't related to Enmn. If you post your relations we could go further into details. Good luck! --~--~-~--~~~---~--~~ 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: Fatal error: Call to a member function find()
ok tnx i trying to make simple edictionary i created 3 table /mnens,enmns,wordtypes/ Relations is mnens - n wordtypes n - enmns i used scaffolding mnens belongsTo wordtypes enmns belongsTo wordtypes On Apr 30, 8:13 am, Stu greenmushroo...@gmail.com wrote: Well the key lines here are: Notice (8): Undefined property: Enmn::$Wordtype [APP\controllers \enmns_controller.php, line 27] and Fatal error: Call to a member function find() on a non-object in F: \wamp\www\dict\app\controllers\enmns_controller.php on line 27 My diagnostic shows that you are in fact calling find on an undefined property (see what I did there?). Now either you're simply misspelling Wordtype (could be WordType, just a guess), or Wordtype isn't related to Enmn. If you post your relations we could go further into details. Good luck! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Fatal error: Call to a member function find()
Notice (8): Undefined property: Enmn::$Wordtype [APP\controllers \enmns_controller.php, line 27] Code } } $wordtypes = $this-Enmn-Wordtype-find('list'); EnmnsController::add() - APP\controllers\enmns_controller.php, line 27 Object::dispatchMethod() - CORE\cake\libs\object.php, line 115 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 227 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 194 [main] - APP\webroot\index.php, line 88 Fatal error: Call to a member function find() on a non-object in F: \wamp\www\dict\app\controllers\enmns_controller.php on line 27 i created code by cake shell command please help me --~--~-~--~~~---~--~~ 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: Fatal error: Call to a member function find()
Well the key lines here are: Notice (8): Undefined property: Enmn::$Wordtype [APP\controllers \enmns_controller.php, line 27] and Fatal error: Call to a member function find() on a non-object in F: \wamp\www\dict\app\controllers\enmns_controller.php on line 27 My diagnostic shows that you are in fact calling find on an undefined property (see what I did there?). Now either you're simply misspelling Wordtype (could be WordType, just a guess), or Wordtype isn't related to Enmn. If you post your relations we could go further into details. Good luck! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---