Thanks for this thread.
As for the Bob's guide
http://bobsguides.com/custom-db-tables.html I find it the only 1 way to become familiar with porting XPDO to MODX class ;-)
However I got stuck on the step of addPackage in my snippet after createxpdoclasses code ran and finished with this report:
[2012-01-09 02:02:53] (INFO @ /index.php)
Schema file written to /mnt/web/content/core/components/certsfunction/schema/certsfunction.mysql.schema.xml
[2012-01-09 02:02:53] (INFO @ /index.php)
Schema file parsed -- Files written to /mnt/web/content/core/components/certsfunction/model/
[2012-01-09 02:02:53] (INFO @ /index.php)
FINISHED
The createxpdoclasses code created the XML
<?xml version="1.0" encoding="UTF-8"?>
<model package="certsfunction" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
<object class="Certs" table="certs" extends="xPDOObject">
<field key="FILENUM" dbtype="varchar" precision="10" phptype="string" null="false" index="pk" />
<field key="COMPNO" dbtype="varchar" precision="3" phptype="string" null="true" index="index" />
<field key="LENDERNAME" dbtype="varchar" precision="35" phptype="string" null="true" />
..................
for my Table: import_certs
and php class
<?php
class Certs extends xPDOObject {}
but the page with the following snippet 's code
<?php
$path = MODX_CORE_PATH . 'components/certsfunction/'; //echo $path;
$result = $modx->addPackage('certsfunction',$path . 'model/','import_');
if (! $result) {
return 'failed to add package';
} else {
$output1 = '<p>added Package</p>';
}
$CERT = $modx->getCollection('Certs');
$output1 .= '<p>Total: '. count($CERT) . '</p>';
/*foreach($CERT as $quote) {
$output .= '<p>LENDERNAME: ' . $quote->get('LENDERNAME');
$output .= '<br />LOAN_ID: ' . $quote->get('LOAN_ID'). '</p>';
}*/
return $output;