[2010-10-18 14:00:29] (ERROR in xPDO::connect @ /home/site/public_html/core/xpdo/xpdo.class.php : 318) SQLSTATE[28000] [1045] Access denied for user 'nobody'@'localhost' (using password: NO) Fatal error: Call to a member function execute() on a non-object in /home/site/public_html/core/xpdo/om/mysql/xpdogenerator.class.php on line 103
$xpdo = new xPDO('mysql:host=localhost;dbname=mydatabase', $database_user,$database_password,$table_prefix);
Thanks.
Great tutorial.
Easy as it needs to be, clear as you want it.
Now the inverse, creating a table from a schema, please
(lol, Revolution is beating on me hardly)
$result = $modx->addPackage('quotes',$path . 'model/','bobs_');
I’m not 100% sure about this, but I think that if you create the schema and run parseSchema(), xPDO will create the table for you the first time you call an instance of the class’s save() method.Mmmm... having something like a "terminal" would be nice for this kind of things instead of creating a doc to run a snippet once and then delete the doc.
Only read it, just going to try it.
Question
Do I have to add this line
$result = $modx->addPackage('quotes',$path . 'model/','bobs_');
in every snippet I want to use my custom table mapping?
I guess yes, that’s the part that makes me available the table in $modx, am I right?
After that, I can use [tt]$modx->getCollection[/tt] or [tt]$modx->getObject[/tt] as I would with chunks or resources. Still right?
I generally create the tables in PhpMyAdmin and then run writeSchema() and parseSchema() on them -- although my tables tend to be pretty simple.
Mmmm... having something like a "terminal" would be nice for this kind of things instead of creating a doc to run a snippet once and then delete the doc.
[[CreateXpdoClasses? &myPackage=`quotes` &myPrefix=`bobs_`]]