I am making a skatepark directory and I'm having some troubles with my
associations. I have:
<?php
class Skatepark extends AppModel {
var $name = 'Skatepark';
var $validate = array('parkName' => VALID_NOT_EMPTY);
var $hasMany = array("Comment","Photo");
}
?>
<?php
class User extends AppModel {
var $name = 'User';
var $belongsTo = array("Comment","Skatepark");
var $hasMany = array("Comment");
}
?>
<?php
class Comment extends AppModel {
var $name = "Comment";
var $belongsTo = array("Skatepark","User");
var $hasOne = array("User");
}
?>
I think I am doing something wrong because I am not getting any
infomation about the user when looking at my comment information.
[Comment] => Array
(
[0] => Array
(
[id] => 168
[skatepark_id] => 1
[user_id] => 1
[comment] => I went to the dirty east bmx contest
this year and it was incredible!
[datePosted] => 2008-01-02 12:34:00
)
[1] => Array
(
[id] => 180
[skatepark_id] => 1
[user_id] =>
[comment] => I absolutely love this skatepark. The
foam pit is great!
[datePosted] => 0000-00-00 00:00:00
)
)
Why am I not getting the user information in my array? I am fairly new
to hasOne,hasMany, belongsto, etc so I'm sure that it's something
simple. Thanks in advance for the help as always.
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---