]> _ Git - cubist_cms-back.git/commitdiff
#2783
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 31 May 2019 14:51:00 +0000 (16:51 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 31 May 2019 14:51:00 +0000 (16:51 +0200)
src/app/Magic/Models/CubistMagicAbstractModel.php

index 860d31f3592397b0de210d40ebdf07eceea869a1..9fed86e876fe916a7b87f1378c8b128e85d69338 100644 (file)
@@ -242,9 +242,14 @@ class CubistMagicAbstractModel extends Model
 
     public function __call($method, $parameters)
     {
-        if (stristr())
+        foreach ($this->_relationships as $relationship) {
+            /** @var $relationship['field'] Field */
+            if ($method == $relationship['field']->getAttrbute('name')) {
+                return $relationship['field']->relationship();
+            }
+        }
 
-            return parent::__call($method, $parameters);
+        return parent::__call($method, $parameters);
     }
 
     public static function toDoctrineType($type)