From: Vincent Vanwaelscappel Date: Thu, 6 Jun 2019 16:59:25 +0000 (+0200) Subject: #2810 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b4a77083e9f0149e6b27470c039ae33996a4514d;p=cubist_cms-back.git #2810 --- diff --git a/src/app/Magic/Fields/Model.php b/src/app/Magic/Fields/Model.php index a7c8722..a3e83fb 100644 --- a/src/app/Magic/Fields/Model.php +++ b/src/app/Magic/Fields/Model.php @@ -21,6 +21,7 @@ class Model extends Field protected function _postSetAttributes() { - $this->setAttributeIfNotSet('entity', 'entity_' . $this->getAttribute('name')); + $prefix = $this->getRelationship() === 'belongsTo' ? 'entity_' : ''; + $this->setAttributeIfNotSet('entity', $prefix . $this->getAttribute('name')); } }