[Solved] migxLoopCollection no prefix table name error

Hello, On ModX 2.8.7 I’m trying to use migxLoopCollection with PHP Version 8.2.23

[[!migxLoopCollection?
    &packageName=`NAME`
    &classname=`CLASS`
    &limit=`10`
    &debug=`1`
    &tpl=`@CODE:[[+FirstName]]`
]]

but I’m getting this error:

Deprecated : Creation of dynamic property modX::$migx is deprecated in /var/www/vhosts/NAME/public_html/core/xpdo/xpdo.class.php on line 1238
SELECT `Enquiry`.`id`, `Enquiry`.`digestSent`............. `Enquiry`.`StopOver` FROM `enquiries` AS `Enquiry` LIMIT 10

Any ideas please?

Thanks!

This is not an error. It’s a deprecation warning and the MIGX code should still work correctly.


When $modx->getService() is called, MODX creates a dynamic property.
This will (most likely) be fixed in the next version:

Excellent, thanks mate.

OK I changed the error_reporting to 14327
error_reporting', 14327

so the deprecated message is gone, I thought it was creating some problem with the query in any way, sorry my mistake.

but I’m still having a problem, the call is not displaying anything:

The table was created long time ago for somebody else without the prefix: modx_ but the package is there with all the info it needs: model, schema, etc.

So using this call:


[[!migxLoopCollection?
    &packageName=`NAME`
    &classname=`CLASS`
    &prefix=``
    &limit=`10`
    &debug=`1`
    &tpl=`@CODE:[[+placeholder]]`
]]

I can see in the query with all the table fields but the table name is:
FROM `modx_tablename`

even when I tried to remove the prefix:
&prefix=``

That is causing the problem.
How can I remove the prefix in that case?

Thanks for your help @halftrainedharry as always mate!

Try using the property &useCustomPrefix as well:

[[migxLoopCollection?
    &prefix=``
    &useCustomPrefix=`1`
    ...
]]
1 Like

Fantastic, thanks for your help mate.
Amazing!