]> _ Git - cubist_cms-back.git/commitdiff
Revert "wip #4285 @1"
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 19 May 2022 18:19:38 +0000 (20:19 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 19 May 2022 18:19:38 +0000 (20:19 +0200)
This reverts commit 160c476138d0c3823219c632558a54065b93f31b.

src/app/Application.php
src/app/Magic/BunchOfFields.php
src/app/Magic/Fields/BunchOfFieldsMultiple.php
src/app/Magic/Fields/Field.php
src/app/Magic/Form.php
src/app/Magic/InterfaceBunchOfFields.php [deleted file]
src/app/Magic/Models/CubistMagicAbstractModel.php
src/app/Magic/SubForm.php

index 27a0caa12b3e79aeb56e90cb06ddd844eee18fb2..3b5f7d5849af09597564c117d7d8b24e20bfbb4c 100644 (file)
@@ -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;
-    }
 }
index 038c37c02a81dcc896638d4ae27180a2e973df6b..617a015255e4c56d06b147d7d93073aca6fc6e14 100644 (file)
@@ -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;
-    }
 }
index 309e4e81ee1affc6b5266cfbcaf31cf379e88df6..776538cf59ae5e6da7b90c5e373c8adfc1f8921e 100644 (file)
@@ -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);
index 1eeebcef30c109f62dc4025d733462de56759bfe..689767dfe536feb59645950f162f97d0ce64877e 100644 (file)
@@ -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;
index 51cee8a7392955901c26e17e1341286b47879e98..8ddf68bc519e34158a803c5351e3f4a836b6bfce 100644 (file)
@@ -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 (file)
index 851f5b0..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-namespace Cubist\Backpack\Magic;
-
-use Cubist\Backpack\Magic\Fields\Field;
-
-interface InterfaceBunchOfFields
-{
-
-    /**
-     * @param $attributes
-     * @return Field
-     * @throws \Exception
-     */
-    public function addField($name, $type = 'Text', $label = '', $attributes = []);
-
-    /**
-     * @param array $attributes
-     * @return Field
-     * @throws \Exception
-     */
-    public function addFakeField(array $attributes);
-
-    /**
-     * @return Field[]
-     */
-    public function getFields();
-
-    /**
-     * @param $name
-     * @return Field|null
-     */
-    public function getField($name);
-
-    /**
-     * @param $name string
-     * @return bool
-     */
-    public function hasField($name): bool;
-}
index 0d5db796d6c4d7bce7d8a199db3b71bfa470f2fe..be2b1be2672234c21128f6511b5ef01fc8b265f1 100644 (file)
@@ -9,7 +9,6 @@ use Cubist\Backpack\Magic\Fields\Composed;
 use Cubist\Backpack\Magic\Fields\Datetime;
 use Cubist\Backpack\Magic\Fields\Files;
 use Cubist\Backpack\Magic\Fields\FilesOrURL;
-use Cubist\Backpack\Magic\InterfaceBunchOfFields;
 use Cubist\Backpack\Magic\Operations\CreateOperation;
 use Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
 use Cubist\Backpack\Magic\Operations\UpdateOperation;
@@ -42,7 +41,7 @@ use Spatie\MediaLibrary\MediaCollections\Models\Collections\MediaCollection;
 use Spatie\MediaLibrary\MediaCollections\Models\Media;
 use Venturecraft\Revisionable\RevisionableTrait;
 
-class CubistMagicAbstractModel extends Model implements HasMedia, InterfaceBunchOfFields
+class CubistMagicAbstractModel extends Model implements HasMedia
 {
     use CrudTrait;
     use InteractsWithMedia;
index 1ebb0703cb8f89ebe8664b528febb8db845d518e..4a6560ff38e6bfc7ceeb13f82009a53727f3d961 100644 (file)
@@ -4,7 +4,7 @@
 namespace Cubist\Backpack\Magic;
 
 
-class SubForm implements InterfaceBunchOfFields
+class SubForm
 {
     use BunchOfFields;