echo "Parsing schema description " . $schemaPath . "\n";
$dbXML = CRM_Core_CodeGen_Util_Xml::parse($schemaPath);
- // print_r( $dbXML );
echo "Extracting database information\n";
$this->database = &$this->getDatabase($dbXML);
- // print_r( $this->database );
$this->classNames = array();
$this->tables = $this->orderTables($this->tables);
// add archive tables here
- $archiveTables = array();
foreach ($this->tables as $name => $table) {
if ($table['archive'] == 'true') {
$name = 'archive_' . $table['name'];
$base = $this->value('base', $tableXML);
$sourceFile = "xml/schema/{$base}/{$klass}.xml";
$daoPath = "{$base}/DAO/";
+ $baoPath = __DIR__ . '/../../../' . str_replace(' ', '', "{$base}/BAO/");
$pre = str_replace('/', '_', $daoPath);
$this->classNames[$name] = $pre . $klass;
'objectName' => $klass,
'labelName' => substr($name, 8),
'className' => $this->classNames[$name],
+ 'baopath' => $baoPath . $klass . '.php',
+ 'bao' => (file_exists($baoPath . $klass . '.php') ? str_replace('DAO', 'BAO', $this->classNames[$name]) : $this->classNames[$name]),
+ 'entity' => $klass,
'attributes_simple' => trim($database['tableAttributes_simple']),
'attributes_modern' => trim($database['tableAttributes_modern']),
'comment' => $this->value('comment', $tableXML),
if (!empty($field['html'])) {
$validOptions = array(
'type',
+ 'format',
/* Fixme: prior to CRM-13497 these were in a flat structure
// CRM-13497 moved them to be nested within 'html' but there's no point
// making that change in the DAOs right now since we are in the process of
<add>1.3</add>
<html>
<type>Select Date</type>
+ <format>activityDateTime</format>
</html>
</field>
<field>
<add>1.3</add>
<html>
<type>Select Date</type>
+ <format>activityDateTime</format>
</html>
</field>
<field>
<comment>when (if) receipt was sent. populated automatically for online donations w/ automatic receipting</comment>
<html>
<type>Select Date</type>
+ <format>activityDateTime</format>
</html>
<add>1.3</add>
</field>
<add>1.3</add>
<html>
<type>Select Date</type>
+ <format>activityDateTime</format>
</html>
</field>
<field>
<comment>Stores the date when revenue should be recognized.</comment>
<html>
<type>Select Date</type>
+ <format>activityDateTime</format>
</html>
<add>4.7</add>
</field>
{foreach from=$table.fields item=field}
{if $field.uniqueName}
- '{$field.uniqueName}'
+ '{$field.uniqueName}'
{else}
'{$field.name}'
{/if}
=> array(
- 'name' => '{$field.name}',
+ 'name' => '{$field.name}',
'type' => {$field.crmType},
{if $field.title}
'title' => ts('{$field.title}'),
{if $field.default}
'default' => '{if ($field.default[0]=="'" or $field.default[0]=='"')}{$field.default|substring:1:-1}{else}{$field.default}{/if}',
{/if} {* field.default *}
+ 'table_name' => '{$table.name}',
+ 'entity' => '{$table.entity}',
+ 'bao' => '{$table.bao}',
{if $field.FKClassName}
'FKClassName' => '{$field.FKClassName}',
'pseudoconstant' => array(
{*{$pseudoOptions|@print_array}*}
{foreach from=$pseudoOptions key=optionKey item=optionValue}
- '{$optionKey}' => '{$optionValue}',
- {/foreach}
+ '{$optionKey}' => '{$optionValue}',
+{/foreach}
)
{/if} {* field.pseudoconstant *} ),
{/foreach} {* table.fields *}