-
MODX Staff
- 10,725 Posts
It works as expected for me, but you should not select() those columns if you are retrieving the object. Don’t you want the contentid, not the id column anyway?
-
☆ A M B ☆
- 3,141 Posts
Do you get the expected results when executing the sql in something like phpmyadmin on your server?
I’m going to guess that because it’s trying to compare a string "greater than" that’s the culprit..
-
MODX Staff
- 10,725 Posts
In order to get an instantiate an object, you must at least select the primary key column.
Reinstalled and had a fiddle and I’ve got it working. What I don’t understand is why a print_r on the collection seems to output the entire db, but iterating through it in a loop works fine. On to the next question...
-
☆ A M B ☆
- 3,141 Posts
...why a print_r on the collection seems to output the entire db
That’s because you have an array of objects, and objects hold variables, relationships and so on to other objects and that indeed shows you a hefty chunk of data when you output that all. That’s why in your for each loop you use object->toArray() - to get just the fields in an array.
Gotcha! Thanks for that Mark!