Quote from: airoctive at Jan 06, 2009, 10:20 AM
Extending the modX object is an viable option but that means changing the core files which actually instantiate the object, now, and on every upgrade. Also, maintaining a second instance of modX I would only consider if I’m targeting a different database, otherwise its too much overhead, and because my lack of understanding of the framework as of now I don’t know what caveats or problems that might cause in the long run with the manager and the front end.
No, you would simply extend xPDO to create a custom model, not the modX class. The modX class is the custom model class for the modx content management system. All you want is an isolated connection to your model, but you happen to keep that model in the same database. To use the same connection, you would just use the modX class itself (no extension necessary). To use a separate connection, you just extend xPDO or create a new instance of it in your code.
Quote from: airoctive at Jan 06, 2009, 10:20 AM
So far I have gotten around it with prefixing my tables like this: modx_myprefix_tablename. This solves the readability issue, but doesn’t look as nice (you guys are picky about naming too). But I still think there should be an extra config option for specifying the table prefix in the domain object map. This would make any third party table very easy to locate without regard of the number of tables inside the db.
Again, table prefixes are run-time only, not design-time. This is on purpose to allow running multiple instances of a model in the same database, just like MODx has always allowed. I think you are simply over-thinking this; if you have no table prefix, that should be the actual names of your tables, then adding various prefixes would allow you to have multiple instances of each table in the same database container when working with a specific connection.
An option I might consider in future releases of xPDO is being able to apply specific table-prefixes by package, then you can use a single connection to work with multiple models that have distinct table prefixes configured.