From 29b29dde7b594043bd375b06a1f5a14f916ac175 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 19 May 2022 20:19:38 +0200 Subject: [PATCH] Revert "wip #4285 @1" This reverts commit 160c476138d0c3823219c632558a54065b93f31b. --- src/app/Application.php | 24 ----------- src/app/Magic/BunchOfFields.php | 23 ---------- .../Magic/Fields/BunchOfFieldsMultiple.php | 6 +-- src/app/Magic/Fields/Field.php | 43 ------------------- src/app/Magic/Form.php | 1 + src/app/Magic/InterfaceBunchOfFields.php | 40 ----------------- .../Magic/Models/CubistMagicAbstractModel.php | 3 +- src/app/Magic/SubForm.php | 2 +- 8 files changed, 4 insertions(+), 138 deletions(-) delete mode 100644 src/app/Magic/InterfaceBunchOfFields.php diff --git a/src/app/Application.php b/src/app/Application.php index 27a0caa..3b5f7d5 100644 --- a/src/app/Application.php +++ b/src/app/Application.php @@ -2,15 +2,8 @@ namespace Cubist\Backpack; -use Backpack\CRUD\app\Library\CrudPanel\CrudPanel; - class Application extends \Illuminate\Foundation\Application { - /** - * @var CrudPanel - */ - protected $crud=null; - /** * @var string */ @@ -47,21 +40,4 @@ class Application extends \Illuminate\Foundation\Application { return $this->variant; } - - - /** - * @param CrudPanel $crud - */ - public function setCrud(?CrudPanel $crud): void - { - $this->crud = $crud; - } - - /** - * @return CrudPanel - */ - public function getCrud(): ?CrudPanel - { - return $this->crud; - } } diff --git a/src/app/Magic/BunchOfFields.php b/src/app/Magic/BunchOfFields.php index 038c37c..617a015 100644 --- a/src/app/Magic/BunchOfFields.php +++ b/src/app/Magic/BunchOfFields.php @@ -9,11 +9,6 @@ use Cubist\Backpack\Magic\Models\CubistMagicAbstractModel; trait BunchOfFields { - /** - * @var InterfaceBunchOfFields - */ - protected $_rootEntry = null; - /** * @var Field[] */ @@ -35,8 +30,6 @@ trait BunchOfFields $attributes = CubistMagicAbstractModel::normalizeAttributes($name, $type, $label, $attributes); $attributes = array_merge($this->defaultFieldAttributes, $attributes); $field = Field::getInstance($attributes); - $field->setParentEntry($this); - $field->setRootEntry($this->getRootEntry()); $key = $field->getAttribute('name'); @@ -87,20 +80,4 @@ trait BunchOfFields { return isset($this->_fields[$name]); } - - /** - * @return InterfaceBunchOfFields - */ - public function getRootEntry(): ?InterfaceBunchOfFields - { - return (null !== $this->_rootEntry) ? $this->_rootEntry : $this; - } - - /** - * @param InterfaceBunchOfFields $rootEntry - */ - public function setRootEntry(InterfaceBunchOfFields $rootEntry): void - { - $this->_rootEntry = $rootEntry; - } } diff --git a/src/app/Magic/Fields/BunchOfFieldsMultiple.php b/src/app/Magic/Fields/BunchOfFieldsMultiple.php index 309e4e8..776538c 100644 --- a/src/app/Magic/Fields/BunchOfFieldsMultiple.php +++ b/src/app/Magic/Fields/BunchOfFieldsMultiple.php @@ -4,9 +4,8 @@ namespace Cubist\Backpack\Magic\Fields; use Cubist\Backpack\CubistBackpackServiceProvider; -use Cubist\Backpack\Magic\InterfaceBunchOfFields; -class BunchOfFieldsMultiple extends BunchOfFields implements InterfaceBunchOfFields +class BunchOfFieldsMultiple extends BunchOfFields { use \Cubist\Backpack\Magic\BunchOfFields; @@ -35,7 +34,6 @@ class BunchOfFieldsMultiple extends BunchOfFields implements InterfaceBunchOfFie protected function _setBunchOfFields() { - $bunch = $this->getAttribute('bunch'); if (is_array($bunch)) { foreach ($bunch as $item) { @@ -61,8 +59,6 @@ class BunchOfFieldsMultiple extends BunchOfFields implements InterfaceBunchOfFie $crudfields = []; foreach ($this->_fields as $field) { - $field->setParentEntry($this); - //$field->setRootEntry($this->getRootEntry()); $name = $field->getAttribute('name'); $e = explode('[', $name); $main = array_shift($e); diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index 1eeebce..689767d 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -6,7 +6,6 @@ namespace Cubist\Backpack\Magic\Fields; use Cubist\Backpack\CubistCrudPanel; use Cubist\Backpack\Magic\CubistMagicAttribute; use Cubist\Backpack\CubistBackpackServiceProvider; -use Cubist\Backpack\Magic\InterfaceBunchOfFields; use Doctrine\DBAL\Schema\Table; use Exception; use Illuminate\Support\Arr; @@ -20,16 +19,6 @@ class Field implements \ArrayAccess protected $_attributes; protected $_rules = []; - /** - * @var InterfaceBunchOfFields - */ - protected $_parentEntry = null; - - /** - * @var InterfaceBunchOfFields - */ - protected $_rootEntry = null; - protected $_isRelationship = false; protected $_columnType = 'text'; @@ -443,38 +432,6 @@ class Field implements \ArrayAccess return $value; } - /** - * @return InterfaceBunchOfFields - */ - public function getRootEntry(): ?InterfaceBunchOfFields - { - return $this->_rootEntry; - } - - /** - * @return InterfaceBunchOfFields - */ - public function getParentEntry(): ?InterfaceBunchOfFields - { - return $this->_parentEntry; - } - - /** - * @param InterfaceBunchOfFields $rootEntry - */ - public function setRootEntry(InterfaceBunchOfFields $rootEntry): void - { - $this->_rootEntry = $rootEntry; - } - - /** - * @param InterfaceBunchOfFields $parentEntry - */ - public function setParentEntry(InterfaceBunchOfFields $parentEntry): void - { - $this->_parentEntry = $parentEntry; - } - public function isRelationship() { return $this->_isRelationship; diff --git a/src/app/Magic/Form.php b/src/app/Magic/Form.php index 51cee8a..8ddf68b 100644 --- a/src/app/Magic/Form.php +++ b/src/app/Magic/Form.php @@ -6,6 +6,7 @@ namespace Cubist\Backpack\Magic; use Cubist\Backpack\CubistBackpackServiceProvider; use Cubist\Backpack\CubistCrudPanel; +use Cubist\Backpack\Magic\Fields\Field; use Cubist\Backpack\Magic\Models\CubistMagicAbstractModel; class Form extends SubForm diff --git a/src/app/Magic/InterfaceBunchOfFields.php b/src/app/Magic/InterfaceBunchOfFields.php deleted file mode 100644 index 851f5b0..0000000 --- a/src/app/Magic/InterfaceBunchOfFields.php +++ /dev/null @@ -1,40 +0,0 @@ -