OK, this is getting truly weird. I've looked in the DB -- the resources are there and every field is set properly.
I tried this code in the resolver:
<php
$r = $modx->getObject('modResource', array('alias'=> 'home-page'));
if ($r) {
$modx->log(xPDO::LOG_LEVEL_ERROR,'Retrieved Home Page');
} else {
$modx->log(xPDO::LOG_LEVEL_ERROR,'Could not get Home Page');
}
$r = $modx->getObject('modResource', array('alias'=> 'pb-process'));
if ($r) {
$processId = $r->get('id');
$settings['pb_process_id'] = $r->get('id');
} else {
$modx->log(xPDO::LOG_LEVEL_ERROR,'Could not get PB_Process resource');
}
for ($i = 1; $i <= 20; $i++ ) {
$r = $modx->getObject('modResource', array('alias'=> 'pb-status'));
if ($r) break;
}
if ($r) {
$modx->log(xPDO::LOG_LEVEL_ERROR,'Retrieved PB_Status resource');
$processId = $r->get('id');
$settings['pb_status_id'] = $r->get('id');
} else {
$modx->log(xPDO::LOG_LEVEL_ERROR,'Could not get PB_Status resource');
}
The home page is retrieved, but neither of the new resources is. The resources are successfully removed on uninstall.
Here is the code that packages the resources:
<?php
if ($hasResources) {
$resources = include $sources['data'].'transport.resources.php';
if (!is_array($resources)) {
$modx->log(modX::LOG_LEVEL_ERROR,'Could not package in resources.');
} else {
$attributes= array(
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'id',
xPDOTransport::RELATED_OBJECTS => true,
xPDOTransport::RELATED_OBJECT_ATTRIBUTES => array (
'ContentType' => array(
xPDOTransport::PRESERVE_KEYS => false,
xPDOTransport::UPDATE_OBJECT => true,
xPDOTransport::UNIQUE_KEY => 'name',
),
),
);
foreach ($resources as $resource) {
$vehicle = $builder->createVehicle($resource,$attributes);
$builder->putVehicle($vehicle);
}
$modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($resources).' resources.');
}
unset($resources,$resource,$attributes);
}
I'm not sure what to try next except creating the resources in the resolver.
---------------------------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
MODx info for everyone:
http://bobsguides.com/MODx.html
[ed. note: BobRay last edited this post 14 years, 8 months ago.]