]> _ Git - cubist_cms-back.git/commitdiff
#2810
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 6 Jun 2019 16:14:46 +0000 (18:14 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 6 Jun 2019 16:14:46 +0000 (18:14 +0200)
src/app/Magic/Fields/Field.php
src/app/Magic/Fields/Model.php
src/app/Magic/Fields/SelectFromModel.php

index cd3af0e96c4e15351079a8755301a75aa3c2bb83..b91a007998d5e4c7e001e8f7d226fc6295229e37 100644 (file)
@@ -103,6 +103,8 @@ class Field
 
     public function getColumnData()
     {
+        $this->_postSetAttributes();
+
         $res = [
             'name' => $this->getAttribute('name'),
             'type' => $this->getAttribute('column_type'),
index 054354886addf9224bfd2fa9c3234a3bac87a577..a7c872257691cf0a653a19a1d2580eabbd46f79a 100644 (file)
@@ -5,9 +5,13 @@ namespace Cubist\Backpack\app\Magic\Fields;
 
 class Model extends Field
 {
-    public function __construct($attributes)
+    public function getColumnData()
     {
-        parent::__construct($attributes);
+        $res = parent::getColumnData();
+        $res['model'] = $this->getAttribute('model');
+        $res['entity'] = $this->getAttribute('entity');
+        $res['attribute'] = $this->getAttribute('attribute');
+        return $res;
     }
 
     public function getDefaultAttributes()
@@ -17,8 +21,6 @@ class Model extends Field
 
     protected function _postSetAttributes()
     {
-        if (!$this->hasAttribute('entity')) {
-            $this->setAttribute('entity', $this->getAttribute('name'));
-        }
+        $this->setAttributeIfNotSet('entity', 'entity_' . $this->getAttribute('name'));
     }
 }
index a053db0bdf27045c0d424323e523c235a6cc4cdb..ea3c9ea11b0661097559626f2c8318b4901344ad 100644 (file)
@@ -8,6 +8,7 @@ class SelectFromModel extends Model
 {
     protected $_adminType = 'select2';
     protected $_databaseType = 'text';
+    protected $_columnType = 'select';
     protected $_multiple = false;
 
     public function getRelationship()