Thứ Sáu, 11 tháng 12, 2009

A quick tutorial on CakePHP Set class (Part 1)

$data = array(
1 => array('Post' => array(
'id' => 1, 'post_comment_count' => 2,
'name' => 'My first title', 'body' => 'My first body'
),
'PostComment' => array(
array(
'id' => 1, 'post_id' => 1, 'is_active' => 1,
'name' => 'My first comment', 'body' => 'My first comment'),
array(
'id' => 2, 'post_id' => 2, 'is_active' => 1,
'name' => 'My second comment', 'body' => 'My second comment'),
array(
'id' => 3, 'post_id' => 2, 'is_active' => 1,
'name' => 'My third comment', 'body' => 'My third comment')
)
),
2 => array('Post' => array(
'id' => 2, 'post_comment_count' => 1,
'name' => 'My second title', 'body' => 'My second title'
),
'PostComment' => array(
array(
'id' => 4, 'post_id' => 2, 'is_active' =>
1, 'name' => 'My fourth comment', 'body' => 'My fourth comment'
)
)
),
3 => array('Post' => array(
'id' => 3, 'post_comment_count' => 0,
'name' => 'My third title', 'body' => 'My third title'
),
'PostComment' => array(

)
)
);

$dataExtra = array(
4 => array('Post' => array(
'id' => 4, 'post_comment_count' => 1,
'name' => 'My fourth title', 'body' => 'My fourth title'
),
'PostComment' => array(
array(
'id' => 5, 'post_id' => 4, 'is_active' => 1,
'name' => 'My fifth comment', 'bdoy' => 'My fifth comment'
)
)
)
);

Không có nhận xét nào:

Đăng nhận xét