I’ve been wrestling with trying to make ClassExtender work in MODX 3 for days.
I don’t know if this is a bug, or if I’m doing something wrong.
Calling parseSchema()
and createObjectContainer()
both work (finally). They create the class files and the DB table. Creating the modExtensionPackage
object for my package in the DB works as well.
However, I can’t get the classes to work unless I include my autoloader, and addPackage().
Here’s the record in the modx_extension_packages table:
ID: 8
namespace: "extendeduser"
name: "extendeduser"
package: "extendeduser"
path: "[[++core_path]]components/classextender/model/"
table_prefix: "ext_"
(I would have used the users’ table prefix (e.g., modx_
), but it would break existing installs.)
This code in a snippet prints a handful of MODX packages, but does not list the extendeduser
package.
return '<pre>' . print_r($modx->packages, true) . '</pre>';
If I call $modx->addExtensionPackage()
instead of using the modExtensionPackage
object, things work as expected, and I don’t have to call addPackage()
any more, but it’s deprecated.
Either the modExtensionPackage
object doesn’t actually work in this situation, or I’m doing something wrong.
I should also mention that when using Xdebug and stepping through the code of $this->_loadExtensionPackages($options);
called in $modx->initialize()
, things go sideways at line 63 of modExtensionPackage.php
when $modx->getCacheManager()
fails.
Any help appreciated.