We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24935
    • 160 Posts
    I am seriously considering using xpdo on a non-MODx project, but I want make sure I can modify its functionality a bit. What I need is the ability to define and modify objects on the fly (inherited from xPDOSimpleObject) through the web interface. So I would like to store the meta maps in the database, and load the data from there rather than keeping these in a file. I also don’t want to create a php file for each new object, so I would load a default class whenever the actual class file is missing.

    It looks like I can just extend xPDO and override _loadClass to accomplish this. Does that sound like it will work? Or will that lead to other problems down the road? If so, and recommendations on how I could accomplish the modification I desire?
    • Quote from: rfoster at Dec 17, 2009, 04:00 AM

      I am seriously considering using xpdo on a non-MODx project, but I want make sure I can modify its functionality a bit. What I need is the ability to define and modify objects on the fly (inherited from xPDOSimpleObject) through the web interface. So I would like to store the meta maps in the database, and load the data from there rather than keeping these in a file. I also don’t want to create a php file for each new object, so I would load a default class whenever the actual class file is missing.
      Why would you want the additional overhead of having to query the database to get the maps? It would be more efficient to modify the schema and use the API to generate the map changes (this takes milliseconds). The only thing that would not be built-in is the ability to alter the tables via the API, though this is planned in future releases of xPDO. And why do you want to avoid creating the class file? Just trying to understand.

      Quote from: rfoster at Dec 17, 2009, 04:00 AM

      It looks like I can just extend xPDO and override _loadClass to accomplish this. Does that sound like it will work? Or will that lead to other problems down the road? If so, and recommendations on how I could accomplish the modification I desire?
      Maybe if I better understand the intentions here I could recommend an approach, but overriding _loadClass() may indeed break down the road. I just don’t understand how you are going to instantiate a PHP object without a PHP class definition for it...