If doctrineIgnore is set in modelconfig, skip it in doctrinemappingdriver
authorMichael Spahn <m.spahn@metaways.de>
Fri, 14 Jul 2017 10:33:28 +0000 (12:33 +0200)
committerMichael Spahn <m.spahn@metaways.de>
Fri, 14 Jul 2017 11:59:08 +0000 (13:59 +0200)
 - for example when using virtual field

Change-Id: I868ec16557b98e2b19ec70802daf819a671fc733
Reviewed-on: http://gerrit.tine20.com/customers/5168
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Michael Spahn <m.spahn@metaways.de>
Tested-by: Michael Spahn <m.spahn@metaways.de>
tine20/Tinebase/ModelConfiguration.php
tine20/Tinebase/Record/DoctrineMappingDriver.php

index d0b42a2..f13d635 100644 (file)
@@ -498,7 +498,7 @@ class Tinebase_ModelConfiguration {
      * 
      * @var array
      */
-    protected $_virtualFields = NULL;
+    protected $_virtualFields = [];
     
     /**
      * maps fieldgroup keys to their names
@@ -1554,4 +1554,13 @@ class Tinebase_ModelConfiguration {
             }
         }
     }
+
+    /**
+     * Returns all virtual fields
+     *
+     * @return array
+     */
+    public function getVirtualFields() {
+        return $this->_virtualFields;
+    }
 }
index 59c210e..ff0d2a1 100644 (file)
@@ -84,6 +84,10 @@ class Tinebase_Record_DoctrineMappingDriver implements Doctrine\Common\Persisten
 
         $metadata->setPrimaryTable($table);
         foreach ($modelConfig->getFields() as $fieldName => $config) {
+            if (in_array($config, $modelConfig->getVirtualFields(), true)) {
+                continue;
+            }
+
             self::mapTypes($config);
 
             if (! $config['doctrineIgnore']) {