Thanks, Jason, that was just what I was looking for! Coding feels much easier with the xPDO interface.
And your snippet proposals work almost flawlessly!

Just one hiccup:
The following code is the beginning of a snippet that uses the connection-in-a-placeholder. The content of $rechnungen is expected to be a collection of objects that I can process further via foreach ( $rechnungen as rechnung ), right?
$modx->runSnippet('getInventarConnection');
$db = $modx->getPlaceholder('inventar.db');
if (!empty($db)) {
$rechnungen = $db->getCollection('Rechnungen');
print "<pre>"; print_r($rechnungen); print "</pre>";
But print_r reveals that something must have gone wrong, I guess. The following is just the beginning of an output of more than 600 lines, while at the time of query, there is one single line in the database table.
Array
(
[1] => Rechnungen_mysql Object
(
[xpdo] => xPDO Object
(
[pdo] => PDO Object
(
)
[config] => Array
(
[table_prefix] =>
[dbtype] => mysql
[host] => localhost
[port] => 3306
[dbname] => inventar
[dsn] => mysql:host=localhost;port=3306;dbname=inventar
And, of course, all my
foreach ($rechnungen as $rechnung ) {
$rechnung->ColumnNameHere
}
'queries' turn up nothing. What is missing here?
[ed. note: neo2.0 last edited this post 14 years, 3 months ago.]