id: 39
name: categoryresolver.php
category: MyComponent
properties: null
-----
log(modX::LOG_LEVEL_ERROR, '[Category Resolver] Missing field: ' . $field);
return false;
}
}
return true;
}
}
if ($object->xpdo) {
$modx =& $object->xpdo;
switch ($options[xPDOTransport::PACKAGE_ACTION]) {
case xPDOTransport::ACTION_INSTALL:
case xPDOTransport::ACTION_UPGRADE:
$intersects = '[[+intersects]]';
if (is_array($intersects)) {
foreach ($intersects as $k => $fields) {
/* make sure we have all fields */
if (!checkFields('category,parent', $fields)) {
continue;
}
$categoryObj = $modx->getObject('modCategory', array('category' => $fields['category']));
if (!$categoryObj) {
continue;
}
$parentObj = $modx->getObject('modCategory', array('category' => $fields['parent']));
if ($parentObj) {
$categoryObj->set('parent', $parentObj->get('id'));
}
$categoryObj->save();
}
}
break;
case xPDOTransport::ACTION_UNINSTALL:
break;
}
}
return true;