$person->save(); $zend_db->insert('people_crosswalk', array('person_id' => $person->getId(), 'mongo_id' => (string) $row['_id'])); echo "Person: {$person->getFullname()}\n"; } // Load the Categories $result = $mongo->categories->find(); foreach ($result as $r) { $c = new Category(); $c->setName($r['name']); $c->setDescription($r['description']); $c->setDisplayPermissionLevel($r['displayPermissionLevel']); $c->setPostingPermissionLevel($r['postingPermissionLevel']); $g = new CategoryGroup($r['group']['name']); $c->setCategoryGroup($g); $d = new Department($r['department']['name']); $c->setDepartment($d); if (!empty($r['customFields'])) { $c->setCustomFields(json_encode($r['customFields'])); } $c->save(); echo "Category: {$c->getName()}\n"; } // Now that we've got People and Categories in the database, // Link the Departments with their Categories and Default Person $result = $mongo->departments->find(); foreach ($result as $r) { $d = new Department($r['name']); if (!empty($r['defaultPerson']['_id'])) { $id = getPersonIdFromCrosswalk($r['defaultPerson']['_id']); $d->setDefaultPerson_id($id); }