Merge pull request #18305 from civicrm/5.29
[civicrm-core.git] / CRM / Core / CodeGen / Specification.php
index 67d057f09609dbe7dd4c7e9c13ab7e85553256db..4d2be52ad41a80a166a0a7e479ab6de497f6e767 100644 (file)
@@ -192,6 +192,7 @@ class CRM_Core_CodeGen_Specification {
     $sourceFile = "xml/schema/{$base}/{$klass}.xml";
     $daoPath = "{$base}/DAO/";
     $baoPath = __DIR__ . '/../../../' . str_replace(' ', '', "{$base}/BAO/");
+    $useBao = $this->value('useBao', $tableXML, file_exists($baoPath . $klass . '.php'));
     $pre = str_replace('/', '_', $daoPath);
     $this->classNames[$name] = $pre . $klass;
 
@@ -211,9 +212,10 @@ class CRM_Core_CodeGen_Specification {
       'objectName' => $klass,
       'title' => $tableXML->title ?? self::nameToTitle($klass),
       'icon' => $tableXML->icon ?? NULL,
+      'add' => $tableXML->add ?? NULL,
       'labelName' => substr($name, 8),
       'className' => $this->classNames[$name],
-      'bao' => (file_exists($baoPath . $klass . '.php') ? str_replace('DAO', 'BAO', $this->classNames[$name]) : $this->classNames[$name]),
+      'bao' => ($useBao ? str_replace('DAO', 'BAO', $this->classNames[$name]) : $this->classNames[$name]),
       'entity' => $klass,
       'attributes_simple' => trim($database['tableAttributes_simple']),
       'attributes_modern' => trim($database['tableAttributes_modern']),