I once spent over an hour reverse engineering the xPDO constructor to figure out how to load base packages upon instantiation.
Unfortunately, I have lost that little snippet of code! And I'm left with this.
$this->database = new xPDO(
"mysql:host=" . $this->config->item('hostname', XPDO) .
";dbname=" . $this->config->item('database', XPDO),
$this->config->item('username', XPDO),
$this->config->item('password', XPDO),
$this->config->item('dbprefix', XPDO)
);
// This is line I would like to pass to the constructor.
$this->database->addPackage('packageName', $this->config->item('core_path') . "components/package/model/", '_packagePrefix');
I cannot find this anywhere in the documentation.
EDIT With xPDO, you have to specifically add packages that are not loaded by default. And by default, xPDO doesn not load any packages on instantiation.
However, I did once spend a considerable amount of time, deconstructing the constructor of xPDO and found that there is an optional parameter that allows you to define an array of packages that will be loaded on instantiation.
My problem is that I cannot remember how to do this.