Re: Mongodb and mysql
hi lowpass, can u pls explain me how to configure two databases. On Fri, Sep 6, 2013 at 4:57 AM, lowpass wrote: > Yes. Create a config for each in database.php and use Model::useDbConfig() > to switch datasources. > > > On Wed, Sep 4, 2013 at 7:20 AM, raj kumar Pustela wrote: > >> Hi to all, >>can we connect mongodb and mysql database simultaniously in >> cakephp >> if anyone known pls help me. >> Thanks, >> Rajakumar >> >> -- >> 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. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- > 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. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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. For more options, visit https://groups.google.com/groups/opt_out.
RE: Help with Model associations and find
Hi Again, With your suggestion and Anja's suggestion of containable behaviour I have gotten this working. Thanks so much! HUGELY appreciated J Below is the code. All that was missing was to tell the Model to use containable behaviour: $this->DataImport->Behaviors->load('Containable'); return $this->DataImport->find( 'first', array( 'order' => array( 'created' => 'DESC' ), 'contain' => array( 'TelemetryData' => array( 'Hospital' => array( 'Province' ) ) ), 'recursive' => 3 ) ) ); From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of lowpass Sent: 06 September 2013 01:51 AM To: cake-php@googlegroups.com Subject: Re: Help with Model associations and find If I understand correctly, you want the latest DataImport record, and all of its associated ClientData records, each of which should include Hospital and Province. If that's correct, you should be calling find() on the DataImport model, which you can do because they're chained due to the association. Using Containable: $this->set('data', $this->ClientData->DataImport->getLatest()); DatImport model: public function getLatest() { return $this->find( 'first', array( 'order' => array( $this->alias.'.created' => 'DESC' ), 'contain' => array( 'ClientData' => array( 'Hospital' => array( 'Province' ) ) ) ) ); } We use 'order' but 'limit' is unnecessary, as it turns out, because of 'first'. At least, I'm pretty sure I discovered that one time. If you get strange results, try adding 'limit' => 1 atthe same level as the limit & contain arrays. On Wed, Sep 4, 2013 at 6:22 PM, Nikki McMahon wrote: Hi Anja, Thanks for replying. I actually want all ClientData with its related data. But, on the final level I only want the Province data and not the DataImport data, since DataImport is associated to ClientData and so then each DataImport holds all the ClientData associated to it as well. Something along these lines is what I get back now if I want to get Province data (I get it by setting recursive to a higher value) ClientData: ClientData[1]['id'] = 4; ClientData[1]['name'] = 'Client Name'; ClientData[1]['DataImport']['id'] = 10; ClientData[1]['DataImport']['ClientData'][1] = object;// excessive and unnecessary data ClientData[1]['DataImport']['ClientData'][2] = object;// excessive and unnecessary data ClientData[1]['DataImport']['ClientData'][3] = object;// excessive and unnecessary data ClientData[1]['DataImport']['ClientData'][4] = object;// excessive and unnecessary data ClientData[1]['Hospital']['id'] = 5; ClientData[1]['Hospital']['Province']['id'] = 9; ClientData[1]['Hospital']['Province']['name'] = 'Gauteng'; ClientData[2]['id'] = 6; ClientData[2]['name'] = 'Client Name 2'; ClientData[2]['DataImport']['id'] = 10; ClientData[2]['DataImport']['ClientData'][1] = object;// excessive and unnecessary data ClientData[2]['DataImport']['ClientData'][2] = object;// excessive and unnecessary data ClientData[2]['DataImport']['ClientData'][3] = object;// excessive and unnecessary data ClientData[2]['DataImport']['ClientData'][4] = object;// excessive and unnecessary data ClientData[2]['Hospital']['id'] = 8; ClientData[2]['Hospital']['Province']['id'] = 4; ClientData[2]['Hospital']['Province']['name'] = 'Eastern Cape'; This is what I would like it to look like - excessive ClientData removed. Because of the level of recursion, the DataImport object loops back in on itself, where the Hospital object expands to its logical end. ClientData[1]['id'] = 4; ClientData[1]['name'] = 'Client Name'; ClientData[1]['DataImport']['id'] = 10; ClientData[1]['Hospital']['id'] = 5; ClientData[1]['Hospital']['Province']['id'] = 9; ClientData[1]['Hospital']['Province']['name'] = 'Gauteng'; ClientData[2]['id'] = 6; ClientData[2]['name'] = 'Client Name 2'; ClientData[2]['DataImport']['id'] = 10; ClientData[2]['Hospital']['id'] = 8; ClientData[2]['Hospital']['Province']['id'] = 4; ClientD
RE: Help with Model associations and find
Hi there, Thanks for this. I tried it out and what I got was a list of ClientData with the DataImport, but none of the other data. So I set recursive to 3 and I still get back DataImport (under ClientData) with all of the ClientData under that. I see the 'contain' field. Is there a way to stop it containing something on the nth level of recursion? My data suggests that the contain is not working properly. $this->DataImport->find( 'first', array( 'order' => array( $this->alias.'created' => 'DESC' ), 'contain' => array( 'TelemetryData' => array( 'Hospital' => array( 'Province' ) ) ), 'recursive' => 3 ) ) Thanks for the help! From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of lowpass Sent: 06 September 2013 01:51 AM To: cake-php@googlegroups.com Subject: Re: Help with Model associations and find If I understand correctly, you want the latest DataImport record, and all of its associated ClientData records, each of which should include Hospital and Province. If that's correct, you should be calling find() on the DataImport model, which you can do because they're chained due to the association. Using Containable: $this->set('data', $this->ClientData->DataImport->getLatest()); DatImport model: public function getLatest() { return $this->find( 'first', array( 'order' => array( $this->alias.'.created' => 'DESC' ), 'contain' => array( 'ClientData' => array( 'Hospital' => array( 'Province' ) ) ) ) ); } We use 'order' but 'limit' is unnecessary, as it turns out, because of 'first'. At least, I'm pretty sure I discovered that one time. If you get strange results, try adding 'limit' => 1 atthe same level as the limit & contain arrays. On Wed, Sep 4, 2013 at 6:22 PM, Nikki McMahon wrote: Hi Anja, Thanks for replying. I actually want all ClientData with its related data. But, on the final level I only want the Province data and not the DataImport data, since DataImport is associated to ClientData and so then each DataImport holds all the ClientData associated to it as well. Something along these lines is what I get back now if I want to get Province data (I get it by setting recursive to a higher value) ClientData: ClientData[1]['id'] = 4; ClientData[1]['name'] = 'Client Name'; ClientData[1]['DataImport']['id'] = 10; ClientData[1]['DataImport']['ClientData'][1] = object;// excessive and unnecessary data ClientData[1]['DataImport']['ClientData'][2] = object;// excessive and unnecessary data ClientData[1]['DataImport']['ClientData'][3] = object;// excessive and unnecessary data ClientData[1]['DataImport']['ClientData'][4] = object;// excessive and unnecessary data ClientData[1]['Hospital']['id'] = 5; ClientData[1]['Hospital']['Province']['id'] = 9; ClientData[1]['Hospital']['Province']['name'] = 'Gauteng'; ClientData[2]['id'] = 6; ClientData[2]['name'] = 'Client Name 2'; ClientData[2]['DataImport']['id'] = 10; ClientData[2]['DataImport']['ClientData'][1] = object;// excessive and unnecessary data ClientData[2]['DataImport']['ClientData'][2] = object;// excessive and unnecessary data ClientData[2]['DataImport']['ClientData'][3] = object;// excessive and unnecessary data ClientData[2]['DataImport']['ClientData'][4] = object;// excessive and unnecessary data ClientData[2]['Hospital']['id'] = 8; ClientData[2]['Hospital']['Province']['id'] = 4; ClientData[2]['Hospital']['Province']['name'] = 'Eastern Cape'; This is what I would like it to look like - excessive ClientData removed. Because of the level of recursion, the DataImport object loops back in on itself, where the Hospital object expands to its logical end. ClientData[1]['id'] = 4; ClientData[1]['name'] = 'Client Name'; ClientData[1]['DataImport']['id'] = 10; ClientData[1]['Hospital']['id'] = 5; ClientData[1]['Hospital']['Province']['id'] = 9; ClientData[1]['Hospital']['Province']['name'] = 'Gauteng'; ClientData[2]['id'] = 6; ClientData[2]['name'] = 'Client Name 2'; ClientData[2]['DataImport']['id'] = 10; ClientData[2]['Hospital']['id'] = 8; ClientData[2]['Hospital']['Province']['id'] = 4; ClientData[2]['Hospital']['Province']['name'] = 'Eastern Cape'; I'm not sure if this helps at all? I basically loop through ClientData after pulling this, adjust some values according to algorithms and then print it out into a table. In that table I need to print the Province name, which is why I need to pull the province. I am beginning to think I mi
Re: Can one use jquery instead of JsHelper?
Yes you can. JsHelper is just a shortcut to a few jQuery methods. In particular I believe it's a convenient tool if you use jQuery UI. On Fri, Sep 6, 2013 at 2:32 PM, Sam wrote: > Dear CakePHP experts, > > I would like to use CakePHP and jQuery. There are sample source code > available with jQuery that I would like to use. But when I read CakePHP > documentation, the code with JsHelper is different from jQuery. Can I simply > use jQuery and not JsHelper in CakePHP? > > May I ask those who have used JsHelper, what are the advantages of JsHelper > over jQuery? > > Thank you. > > -- > 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. > For more options, visit https://groups.google.com/groups/opt_out. -- Simon Males -- 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. For more options, visit https://groups.google.com/groups/opt_out.