]> _ Git - cubist_cms-back.git/commitdiff
#2810
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 12 Jun 2019 13:16:15 +0000 (15:16 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 12 Jun 2019 13:16:15 +0000 (15:16 +0200)
src/app/Magic/Fields/Model.php
src/app/Magic/Fields/SelectFromArray.php
src/app/Magic/Fields/SelectFromModelMultiple.php
src/app/Magic/Models/CubistMagicAbstractModel.php

index 11d8774842aad65c7f25678300402626e41507aa..f9c01da7f957894e422e1d924899268114bbbd09 100644 (file)
@@ -17,7 +17,7 @@ class Model extends Field
 
     public function getDefaultAttributes()
     {
-        return array_merge(parent::getDefaultAttributes(), ['attribute' => 'name', 'allow_null' => false, 'allow_multiples' => $this->_multiple]);
+        return array_merge(parent::getDefaultAttributes(), ['attribute' => 'name', 'allows_null' => false, 'allows_multiple' => $this->_multiple]);
     }
 
     protected function _getOptions()
@@ -29,7 +29,7 @@ class Model extends Field
 
         $name = $this->getAttribute('attribute');
         foreach ($items as $item) {
-            $options[$item->getPrimaryKey()] = $item->{$name};
+            $options[$item->{$item->getPrimaryKey()}] = $item->{$name};
         }
         return $options;
     }
index 65b08ad369ba5faa94ef84c184a9fbed00511ea8..af51d80551efc80cd6936c6dc0cf8eb4576b8c59 100644 (file)
@@ -13,7 +13,7 @@ class SelectFromArray extends Field
 
     public function getDefaultAttributes()
     {
-        return array_merge(parent::getDefaultAttributes(), ['options' => [], 'allow_null' => true, 'allow_multiples' => $this->_multiple]);
+        return array_merge(parent::getDefaultAttributes(), ['options' => [], 'allows_null' => true, 'allows_multiple' => $this->_multiple]);
     }
 
     public function getColumnData()
index 7187d09611de35129ab53c0dd4f75e69a5283a16..378f606b71289f73200c7bc7a45a6255b7e78d05 100644 (file)
@@ -7,4 +7,5 @@ namespace Cubist\Backpack\app\Magic\Fields;
 class SelectFromModelMultiple extends SelectFromModel
 {
     protected $_multiple = true;
+    protected $_cast = 'array';
 }
index 14bd0bbfa2b6edcfd53a8045a739afd511b39ae9..7d9d15173c61b475c5b5c3210b9dd0e1f66b9f03 100644 (file)
@@ -443,4 +443,9 @@ class CubistMagicAbstractModel extends Model implements HasMedia
             ->sharpen(10)
             ->optimize();
     }
+
+    public function getIdValue()
+    {
+        return $this->{$this->getPrimaryKey()};
+    }
 }