Hello. I am looking for a simple solution for binding model to another
model.
I'm using CakePHP 2.2. I am building a JSON rest api.
I currently have a simple User model with a hasOne Profile association.
I want to nest the "Profile" model in the Users array, without using any
views.
What is the most server efficient way to nest models that are associated
through hasOne? I am confused as there seem to be many ways to manipulate
arrays with hash:: methods, containable, join(), bind(), etc. Any help
would be awesome!
This is the output I have so far:
// a simple pr() output:
[2] => Array
(
[User] => Array
(
[id] => 3
[firstname] => test
[lastname] =>
[email] =>
[password] =>
[created] => 2012-09-04 16:44:04
[modified] => 2012-09-04 16:44:04
)
[Profile] => Array
(
[id] =>
[skill] =>
[user_id] =>
)
)
[3] => Array
(
[User] => Array
(
[id] => 4
[firstname] => test
[lastname] =>
[email] =>
[password] =>
[created] => 2012-09-04 16:44:07
[modified] => 2012-09-04 16:44:07
)
[Profile] => Array
(
[id] =>
[skill] =>
[user_id] =>
)
)
--
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.