MODX Community

[SOLVED][Doodles + pdoTools] Is it possible to get Doodles list with pdoTools?


I have installed and set up the “Doodles” package.


<?xml version="1.0" encoding="UTF-8"?>

<model package="doodles" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM">

	<object class="Doodle" table="wordsENG" extends="xPDOSimpleObject">

I have run the script build.schema.php and now the table modx_wordsENG is properly created, I also entered some dummy data inside of it.

My question is: what would be the best solution to retrieve these data and to display them into my modx resource.

I tried to use pdoResources, but it does not display nothing:

&tpl=`@INLINE <p>{{+id}} - {{+myfield}}</p>`

I have attempted different settings for pdoResources and it displays just nothing, even the &showLog does not output nothing. I have also tried the other snippets of pdoTools but without success as of today.

Thank you for the help ! :slight_smile:

I believe the &loadModels-property has to be the name of your package.

&tpl=`@INLINE <p>{{+id}} - {{+myfield}}</p>`

Thank you @halftrainedharry, I already tried this and it didn’t help, I’m still trying to figure out what the problem is

If you put this code in a snippet an run it, do you see any output?

$base_path = $modx->getOption('core_path').'components/doodles/';
$modx->addPackage('doodles', $base_path.'model/');

$output = array();
$result= $modx->getCollection('Doodle');
foreach($result as $res){
    $output[] = $res->toArray();
return $modx->toJson($output);
1 Like

Oh this is great yes I can see the output !

I’m going to try to find out why the pdoResource snippet is not working but still your answer helps me a lot :slight_smile: Thanks again @halftrainedharry !

Have you check the error log? Maybe “pdoResource” puts something in there.

1 Like

Yes i was just at the moment having a look at it and you are right:

[pdoTools] Error 42S22: Unknown column ‘publishedon’ in ‘order clause’

I’ll sort this out and update this post when I found the solution :slight_smile:

I just added this to my snippet call and now it works fine :


Thank you for the help !

1 Like

migxLoopCollection would also work

&tpl=`@CODE:<p>{{+id}} - {{+myfield}}</p>`
1 Like

Good to know, thank you @bruno17

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.