lettis Reply #1, 4 months, 1 week ago
We were trying to get a collection of objects of a table of our database (sorted by the column "name"). Unfortunately the following code was leading to an error (Fatal error: Call to a member function newQuery() on a non-object):
Can anybody tell us what we have to do to make this work? We know that we cannot use newQuery on a tablename but we don´t know what we exactly have to change.
Can anybody help us?
Letti
$path = $modx->getOption('core_path') . 'components/folder/';
$result = $modx->addPackage('folder',$path . 'model/','prefix_');
$c = $xpdo->newQuery('tablename'); // this line leads to the error described above
$c->sortby('name','ASC');
$db_missing = $modx->getCollection('tablename',$c);
Can anybody tell us what we have to do to make this work? We know that we cannot use newQuery on a tablename but we don´t know what we exactly have to change.
Can anybody help us?
Letti