-
☆ A M B ☆
- 3,141 Posts
That’s creating the database tables.
How do you parse the schema you created to create the model (classes)? Or are you reverse engineering it from a database table?
-
☆ A M B ☆
- 756 Posts
duh, sorry been a long morning.
<?php
require_once dirname(__FILE__).'/build.config.php';
include_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx= new modX();
$modx->initialize('mgr');
$modx->loadClass('transport.modPackageBuilder','',false, true);
$modx->setLogLevel(modX::LOG_LEVEL_INFO);
$modx->setLogTarget('ECHO');
$root = dirname(dirname(__FILE__)).'/';
$sources = array(
'model' => $root.'core/components/awdbios/model/',
'schema_file' => $root.'core/components/awdbios/model/schema/awdbios.mysql.schema.xml',
);
$manager= $modx->getManager();
$generator= $manager->getGenerator();
if (!is_dir($sources['model'])) { $modx->log(modX::LOG_LEVEL_ERROR,'Model directory not found!'); die(); }
if (!file_exists($sources['schema_file'])) { $modx->log(modX::LOG_LEVEL_ERROR,'Schema file not found!'); die(); }
$generator->parseSchema($sources['schema_file'],$sources['model']);
echo 'Done.';
exit();
Evo Revo // Ubuntu, CentOS, Win // Apache 2x, Lighttp (Lighty)
Visit
CharlesMx.com for latest news and status updates.
Did you manage to get a solution for this? I am having the same issue... really frustrating as I am not sure what I have done wrong.
I can't get this working either. Get to the point of running the snippet from a resource and nothing is output and no table is being created. That's pretty much where i'm at and have been for ages... Can't figure it out... I'm certain case sensitivity is spot on for the names and classes.
Basically someone please save me.
Twitter @alexmercenary
you can try to create your package/classes/tables with help of MIGXdb:
http://rtfm.modx.com/display/ADDON/MIGXdb.Create+doodles+manager+with+help+of+MIGXdb
as soon, as you have your schema ready this takes typically less than 5 minutes. (to create the package,classes,map-files and tables)
Sorry for the late reply! Thanks Bruno i will use MIGXdb then and see how i get on!
Twitter @alexmercenary
Thanks Bruno that's pretty damn cool. Nice and easy.
Twitter @alexmercenary