I think this is the right place for my question...
As I’ve mentioned in another post, I’m not much of a dev myself, and I have a friend who needs to get on here but hasn’t yet... so I’m attempting to interpret his questions. Please bear with me.
I believe my friend said that with the object $modx, that it’s just not really built for complex databasing. In short, he was trying to figure out where the DBAPI is initialized so he could customize it with his own libraries. Just in all my searching for this answer, I feel like we’re looking in the wrong place, and that our answer probably lies within all the new framework stuff, or whatever, that’s coming in 0.9.7. Our project is mostly all new content from the ground up, so I want to be sure we build it the best way we can, even if it means we have to learn something new, like xPDO.
If I have made no sense just disregard all of that and my main question would be where is the DBAPI initialized?
Thanks for your help.
-
☆ A M B ☆
- 24,524 Posts
It’s in manager/includes/extenders/dbapi.mysql.class.inc.php, but it does require the $modx object to be already instantiated.
From my minimal experience at this point with the 0.9.7 core and xPDO I would say that if you are going to be doing a lot of serious custom database work, that’s the way to go. It takes a bit to get used to (at least for me, but I’m self-taught and this ORB and CRUD and ORM and MVC stuff makes my head hurt), but it’ll be the next Big Thing, I’m sure. It’s extremely powerful. And well organized. Not being well-used to the MODx code as it is now, you’ll probably find getting into the new core and the xPDO underpinnings much easier.
-
☆ A M B ☆
- 24,524 Posts
you can instantiate a $modx object anywhere you need it, I do it often in AJAX applications:
include "../../../manager/includes/config.inc.php"; // adjust paths as necessary
include "../../../manager/includes/document.parser.class.inc.php";
$modx = new DocumentParser;
The parser sets up the dbapi immediately:
// constructor
function DocumentParser() {
$this->loadExtension('DBAPI') or die('Could not load DBAPI class.'); // load DBAPI class
I have a limited knowledge of PHP, but what would be the best way to go about wrapping my head around xPDO? is it close enough to PDO that I should just learn all of PDO’s documentation or is there something more specific for xPDO?
Or should I just be learning PHP and then xPDO will just come to me as I begin to use it?
I just want to make sure if I put the time into that I learn the right stuff. Thanks.
-
☆ A M B ☆
- 24,524 Posts
Well, it’s hard for me to say at this point. I taught myself PHP about five years ago, so I was easily able to avoid learning much in the way of object-orientation. While PHP in no way attempts to call itself an object-oriented language, it does (especially in version 5) have strong support for objects.
I’ve been doing most of my remedial studying here
http://www.phpro.org/tutorials/
scroll down a bit and you’ll find their OOP and PDO tutorials. Once I forced myself to stick my foot in the water, I found PDO to be not so bad after all. And xPDO is extensions to PDO so you really should have an understanding of what it’s all about.
Awesome... That’s a great resource. I feel like I have a long road ahead of me.
Thanks for your help Susan.