Using Custom Object Loaders
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
$388 per month—let's make that $500!Learn more
Change the Way xPDO Loads Data¶
You can provide any of the following static methods in your custom
xPDOObject derivative classes to override their behavior, including in driver-specific classes:
This is done with the help of the
Overriding these methods allows you to implement additional behavior or completely change the behavior of loading your table objects via the object and collection methods provided by xPDO and xPDOObject. For instance, it can be used to perform security checks or to add i18n processing before allowing a row to be loaded.
Prior to 2.0.0-pl, you can specify custom loader classes that extend or override the behavior of the default object loaders by specifying these classes in the xPDO options array when instantiating an xPDO instance.
$xpdo = new xPDO($dsn, $username, $password, array( xPDO::OPT_LOADER_CLASSES => array('myCustomLoaderClass') ));