Message from discussion
Question regarding associations
Received: by 10.224.186.20 with SMTP id cq20mr3304839qab.8.1352002384109;
Sat, 03 Nov 2012 21:13:04 -0700 (PDT)
X-BeenThere: cake-php@googlegroups.com
Received: by 10.224.17.83 with SMTP id r19ls8329376qaa.9.gmail; Sat, 03 Nov
2012 21:12:42 -0700 (PDT)
Received: by 10.224.105.205 with SMTP id u13mr3305630qao.6.1352002362857;
Sat, 03 Nov 2012 21:12:42 -0700 (PDT)
Received: by 10.224.2.134 with SMTP id 6msqaj;
Sat, 3 Nov 2012 11:16:34 -0700 (PDT)
Received: by 10.52.76.136 with SMTP id k8mr852254vdw.13.1351966593847;
Sat, 03 Nov 2012 11:16:33 -0700 (PDT)
Date: Sat, 3 Nov 2012 11:16:33 -0700 (PDT)
From: arekanderu <arekand...@gmail.com>
To: cake-php@googlegroups.com
Message-Id: <4c9789b9-accc-4859-91b2-f6a80fd03c00@googlegroups.com>
Subject: Question regarding associations
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_401_13119758.1351966593515"
------=_Part_401_13119758.1351966593515
Content-Type: multipart/alternative;
boundary="----=_Part_402_17603025.1351966593515"
------=_Part_402_17603025.1351966593515
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Hello,
I am reading about associations<http://book.cakephp.org/1.3/view/1039/Associations-Linking-Models-Together>in CakePHP and I see the following sample:
//Sample results from a $this->Profile->find() call.
Array
(
[Profile] => Array
(
[id] => 12
[user_id] => 121
[skill] => Baking Cakes
[created] => 2007-05-01 10:31:01
)
[User] => Array
(
[id] => 121
[name] => Gwoo the Kungwoo
[created] => 2007-05-01 10:31:01
)
)
My question is regarding the internal behavior of the Model. How is the
association being handled internally? Does the model creates one select
query with the joins, or does it make two separate select queries in order
to get the Profile and the User results and then it merges them?
Thank you for your time.
------=_Part_402_17603025.1351966593515
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
Hello,<div><br></div><div>I am reading about <a href="http://book.cakephp.org/1.3/view/1039/Associations-Linking-Models-Together">associations</a> in CakePHP and I see the following sample:</div><div><br></div><pre class="plain" style="padding-top: 1em; padding-right: 30px; padding-bottom: 1em; padding-left: 30px; outline-width: 0px; outline-style: initial; outline-color: initial; background-image: none; background-attachment: scroll; background-origin: initial; background-clip: initial; background-color: rgb(240, 240, 240); overflow-x: visible; overflow-y: visible; background-position: 0px 0px; background-repeat: repeat repeat; "><font color="#000000"><span style="line-height: 14px;">//Sample results from a $this->Profile->find() call.
Array
(
[Profile] => Array
(
[id] => 12
[user_id] => 121
[skill] => Baking Cakes
[created] => 2007-05-01 10:31:01
)
[User] => Array
(
[id] => 121
[name] => Gwoo the Kungwoo
[created] => 2007-05-01 10:31:01
)
)</span><span style="line-height: 1.1em;"><br></span></font></pre><div><font color="#000000" face="HelveticaNeue-Light, HelveticaNeue, Helvetica, Arial, sans-serif"><span style="line-height: 19px;"><br></span></font></div><div><font color="#000000" face="HelveticaNeue-Light, HelveticaNeue, Helvetica, Arial, sans-serif"><span style="line-height: 19px;">My question is regarding the internal behavior of the Model. How is the association being handled internally? Does the model creates one select query with the joins, or does it make two separate select queries in order to get the Profile and the User results and then it merges them?</span></font></div><div><font color="#000000" face="HelveticaNeue-Light, HelveticaNeue, Helvetica, Arial, sans-serif"><span style="line-height: 19px;"><br></span></font></div><div><font color="#000000" face="HelveticaNeue-Light, HelveticaNeue, Helvetica, Arial, sans-serif"><span style="line-height: 19px;">Thank you for your time.</span></font></div>
------=_Part_402_17603025.1351966593515--
------=_Part_401_13119758.1351966593515--