Merge pull request #12132 from eileenmcnaughton/membership_type_data
[civicrm-core.git] / CRM / Core / CodeGen / Specification.php
index 7184d738d2bd1c6bad8213aba24de569eaa79483..554f3fa27b1db475ccf704af3bd7201f9d36b153 100644 (file)
@@ -16,19 +16,25 @@ class CRM_Core_CodeGen_Specification {
    * @param string $buildVersion
    *   Which version of the schema to build.
    */
-  public function parse($schemaPath, $buildVersion) {
+  public function parse($schemaPath, $buildVersion, $verbose = TRUE) {
     $this->buildVersion = $buildVersion;
 
-    echo "Parsing schema description " . $schemaPath . "\n";
+    if ($verbose) {
+      echo "Parsing schema description " . $schemaPath . "\n";
+    }
     $dbXML = CRM_Core_CodeGen_Util_Xml::parse($schemaPath);
 
-    echo "Extracting database information\n";
+    if ($verbose) {
+      echo "Extracting database information\n";
+    }
     $this->database = &$this->getDatabase($dbXML);
 
     $this->classNames = array();
 
     # TODO: peel DAO-specific stuff out of getTables, and spec reading into its own class
-    echo "Extracting table information\n";
+    if ($verbose) {
+      echo "Extracting table information\n";
+    }
     $this->tables = $this->getTables($dbXML, $this->database);
 
     $this->resolveForeignKeys($this->tables, $this->classNames);
@@ -231,8 +237,6 @@ class CRM_Core_CodeGen_Specification {
       $this->getPrimaryKey($tableXML->primaryKey, $fields, $table);
     }
 
-    // some kind of refresh?
-    CRM_Core_Config::singleton(FALSE);
     if ($this->value('index', $tableXML)) {
       $index = array();
       foreach ($tableXML->index as $indexXML) {
@@ -361,11 +365,13 @@ class CRM_Core_CodeGen_Specification {
     $field['headerPattern'] = $this->value('headerPattern', $fieldXML);
     $field['dataPattern'] = $this->value('dataPattern', $fieldXML);
     $field['uniqueName'] = $this->value('uniqueName', $fieldXML);
+    $field['serialize'] = $this->value('serialize', $fieldXML);
     $field['html'] = $this->value('html', $fieldXML);
     if (!empty($field['html'])) {
       $validOptions = array(
         'type',
         'formatType',
+        'label',
         /* 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