posts input now separate key, more room for other things

This commit is contained in:
John Bintz 2009-11-23 07:27:36 -05:00
parent df5c47e2d3
commit b41a580502

View File

@ -113,14 +113,22 @@ class PostFixtures {
}
function process_data($data) {
$posts = $data;
$posts = array();
$categories = array();
foreach ($data as $post) {
foreach ($data as $type => $info) {
switch ($type) {
case 'posts':
$posts = $info;
foreach ($posts as $post) {
$post = (array)$post;
if (isset($post['categories'])) {
$categories = array_merge($categories, $post['categories']);
}
}
break;
}
}
$categories = array_unique($categories);
return compact('posts', 'categories');
}