My models are already associated :
class User extends AppModel {
public $name = 'User';
public $hasMany = array(
'Post' => array(
'className' => 'Post',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => 'id',
'order' => 'Post.created DESC',
'limit' => '',
'dependent' => true
)
);
and
<?php
class Post extends AppModel {
public $name = 'Post';
public $hasMany = 'Comment';
public $belongsTo = 'User';
}
Le mardi 19 juin 2012 00:21:25 UTC+2, JonStark a écrit :
>
> Let's say USer hasMany Post.
>
> If i debug my user it will produce an array like :
>
> User
>
>
Le mardi 19 juin 2012 00:21:25 UTC+2, JonStark a écrit :
>
> Let's say USer hasMany Post.
>
> If i debug my user it will produce an array like :
>
> User
>
>
--
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
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php