Skip to content

Instantly share code, notes, and snippets.

@sebastian-marinescu
Created December 9, 2017 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastian-marinescu/1ca0a2b29d490c9d7e97047a0bf05e79 to your computer and use it in GitHub Desktop.
Save sebastian-marinescu/1ca0a2b29d490c9d7e97047a0bf05e79 to your computer and use it in GitHub Desktop.
Gitify config creation for MODX Commerce. Put file in /core/components/commerce/model/schema.
<?php
/*
* Commerce-Gitify-Parser
* Copyright 2017 by Sebastian G. Marinescu
*/
$path = getcwd() . '/';
$xml = file_get_contents($path . 'commerce.mysql.schema.xml');
$root = new SimpleXMLElement($xml);
foreach($root->children() as $obj){
$className = $obj['class'];
$tableName = $obj['table'];
if (empty($tableName)) {
continue;
}
echo $tableName . ':';
echo "\n\t";
echo 'class: ' . $className;
echo "\n\t";
echo 'primary: id';
echo "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment