Re: Can more than 1 database connections be used?

2012-05-11 Thread Michael Stelly
Yes. Just add the config in database.php then assign your model to that 
connection. 

Sent from my iPhone

On May 11, 2012, at 5:42 AM, rahaji...@bankofbaku.com 
rahaji...@bankofbaku.com wrote:

 Hi, all. Can I use more than one database connection in Cake 1 or 2?
 There's an existing remote Oracle database that will be read-mostly by
 the Cake app, and a new Postgres db for user auth and their activity
 log. So, can I use them both simultaneously?
 
 Thanks.
 
 -- 
 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: Little help with routes and links

2012-05-08 Thread Michael Stelly
I'm not an expert on routes, either. But I would start here to find
out.Routing Cookbook
v2http://book.cakephp.org/2.0/en/development/routing.html

Sincerely,
Michael Stelly
mobile: +1.918.978.2000
skype: mjstelly
LinkedIn http://www.linkedin.com/in/mstelly



On Tue, May 8, 2012 at 7:26 AM, Confused Dev confused.de...@gmail.comwrote:

 Hello.

 I need help with defining some unusual routes.

 Here are my 2 tables Colors and Products:

 mysql select * from colors;
 ++--+
 | id | name |
 ++--+
 |  1 | blue |
 ++--+

 mysql select * from products;
 ++--+--+
 | id | name | color_id |
 ++--+--+
 |  1 | bowl |1 |
 ++--+--+


 Normally Cake will produce links like this:
 http://example.com/products/view/1

 I'd like to have links like this:
 http://example.com/items/blue/bowl/1

 I don't even know where to begin to make it produce automatic links
 like that. Any help would be greatly appreciated.

 --
 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: Pass data between models during same request

2012-05-07 Thread Michael Stelly
Thanks for the tip. I'll check it when I get back to the office.

Sincerely,
Michael Stelly
mobile: +1.918.978.2000
skype: mjstelly
LinkedIn http://www.linkedin.com/in/mstelly



On Mon, May 7, 2012 at 6:11 PM, lowpass zijn.digi...@gmail.com wrote:

 Are these models associated with each other? If so, you can do
 everything from within the Invoice model. That is, if Invoice is
 associated with ExternalHeader, just do
 $this-ExternalHeader-save(...) That way, there's no need for the
 controller to load the other models.


 On Wed, May 2, 2012 at 6:13 PM, esdev mjste...@gmail.com wrote:
  I'm new to CakePHP and still unfamiliar with the API. So, please bear
  with me here.
 
  I have 5 models - 2 for an external data store, 2 for a local data
  store, and 1 for the controller. I have one controller that's
  directing all the activity. In the controller, I fetch the remote data
  and pass control to the model. I have functions in my controller model
  that perform all the data manipulation. Once complete, it sends the
  data back to the controller. Now comes the tricky part for me. I'll
  tell you how I want the app to behave functionally, maybe I can get
  help in creating the solution to implement it.
 
  I want the data that was passed out of the Invoice model to be saved
  to the local data store. The data came from the remote source
  identified in the models, InvoiceHeader and InvoiceDetail. The model,
  Invoice, contains the data transformation methods. Once modified, the
  data is passed back to the InvoicesController. All that work is
  complete. My data array is ready to be saved locally.
 
  But how do I accomplish this? ExternalHeader and ExternalDetail model
  the local data store. How do I move the data from the Invoice models
  to the External models so that it can be saved? Here's my broken
  function:
 
 protected function _saveLocal($_mergedData) {
 
 if (!isset($this-ExternalHeader)) {
 $this-loadModel('ExternalHeader');
 if (!isset($this-ExternalDetail)) {
 $this-loadModel('ExternalDetail');
 }
 }
 
 //This part is broken.
 $data = array($this-ExternalHeader = $_mergedData);
 pr($data); die;
 $this-ExternalHeader-create();
 $this-ExternalHeader-saveAll($data);
  //debug($this-ExternalHeader-validationErrors);
 }
 
  Please feel free to ask questions if something is unclear. I'm also
  open to rethinking my workflow if what I'm doing is un-Cake-like or
  overly complex.
 
  Any help is appreciated.
 
  --
  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


-- 
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: CakePHP Containable on Associated Model

2012-05-05 Thread Michael Stelly
Yes, I'd work it using
Containablehttp://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
.

Sincerely,
Michael Stelly




On Thu, May 3, 2012 at 9:59 PM, Rob bizarro...@gmail.com wrote:

 I have a setup where there are Books Users and Logs. Each Log has a
 Book and a User and I am trying to retrieve a list of all the books
 regardless of the user, but then also retrieve the Logs associated
 with that book (recursive is set to 1), but then only retrieving the
 logs of the current logged in user.

 Hopefully that's clear. I tried using Containable and like so:

 $this-Book-contain('Log.user_id = 2');

 But unfortunately this leaves out Books for which User 2 has no logs
 for. Am I going about this correctly and I'm just not using
 containable properly, or am I doing this all wrong.

 Let me know if anything needs to be clarified or expanded...Any help
 is appreciated!

 --
 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: Instantiating and Saving a Model from another Model

2012-05-05 Thread Michael Stelly
if(!isset($this-ModelName){
  $this-ModelName-loadModel();
}

This only works in the controller, but it should get you what you want if I
understood the question correctly.

Sincerely,
Michael Stelly
mobile: +1.918.978.2000
skype: mjstelly
LinkedIn http://www.linkedin.com/in/mstelly



On Sat, May 5, 2012 at 8:34 PM, CakeNino ninota...@gmail.com wrote:

 I am new to CakePHP and am building an application to help learn the
 framework.  I am having a problem trying to instiate one model from
 another model.  Here is the basic premise...

 Assume a simple application - I have Feeds (as in RSS Feeds) and
 Content.  I want to create a page that grabs an RSS feed, loops
 through each of the items, and saves each item in separately in the
 Content table.  Here is what I would LIKE to do - but have problems.
 My problems may be both conceptual and/or syntax related.



 In the FEED model, I created a function called processFeedContent.
 Here is how I would like it to work (written in psuedo-code):



public function processFeedContent($feedUrl = null) {

$xml = Xml::build($feedUrl);
$x_array = Xml::toArray($xml);
$contents = $x_array['rss']['channel']['item'];

for each($contents as $content) {
$title = $content['title'];
$link = $content['link'];


//THIS IS THE PART I NEED HELP WITH.
   //THE CODE BELOW IS WHAT I WOULD LIKE TO DO IN
 PSUEDO CODE

 //STEP 1 - Instantiate an empty Content
 Object
$myContent = $this-Create('Content');

//STEP 2 - Set appropriate values in the newly
 created object
$myContent-set('title', $title);
$myContent-set('link', $link);


   //STEP3 - Save the New Object
  $myContent-save();
}
}



 ANy help or guidance will be greatly apprecaited

 --
 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