I have to agree Bob. Using two persistent xPDO connections is over the top.
Just put them in the modx database BUT use a prefix to differentiate them (and try not using modx-something either like MiniShop2 does).
I typically use initials ut_ for UserTracker, cb_ for CodedBonus, etc.
This way all of your tables will be together but stand apart from the primary modx tables.
Here is a cheat snippet to quickly import your project into modx:
initializeModel
<?php
/**
* File initializeModel.php (requires MODx Revolution 2.1)
* Created on: 8/3/11 at 8:24 AM
* Project shawn_wilkerson
* @package all
* @version 1.0
* @category
* @author W. Shawn Wilkerson
* @link http://www.shawnWilkerson.com
* @copyright Copyright (c) 2011, W. Shawn Wilkerson. All rights reserved.
* @license
*
*/
$packageName = strtolower($package);
$modelPath = $modx->getOption($packageName . '.core_path', null, $modx->getOption('core_path') . 'components/' . $packageName . '/') . 'model/';
$schema = $modelPath . 'schema/' . $packageName . '.mysql.schema.xml';
$modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
$modx->setLogTarget(XPDO_CLI_MODE ? 'ECHO' : 'HTML');
$manager = $modx->getManager();
$generator = $manager->getGenerator();
$success = $generator->parseSchema($schema, $modelPath);
$modx->addPackage($packageName, $modelPath, $prefix);
$manager = $modx->getManager();
$tlist = explode(',', $tables);
foreach ($tlist as $t) {
$success += $manager->createObjectContainer(trim($t));
}
return ($success > count($tlist)) ? '<h2>Success</h2><p>Model Created at ' . $modelPath . $packageName . ' and all tables successfully created.</p>' : '<h2>Operation Failed</h2>';
Snippet Call:
[[!initializeModel?package=`usertracker`&prefix=`ut_`&tables=`utIpAdress,utLoginLog,utCount`]]
The &tables must match the object description class names in your schemata
Make sure you are adhereing to /core/components/packagename/model/schema
All lower case.
You may have to manually create /core/components/packagename/model/packagename yourself, but I don't think so
[ed. note: wshawn last edited this post 13 years, 2 months ago.]