src/Model/Table/AppWidgetsTable.php
protected function _saveAppWidgets(): void
    {
        $widgets = $this->_getAppWidgets();

        $found = [];
        foreach ($widgets as $widget) {
            $found[] = $widget['name'];

            // skip adding existing app widgets
            if ($this->exists(['AppWidgets.name' => $widget['name']])) {
                continue;
            }

            $entity = $this->newEntity();
            $entity = $this->patchEntity($entity, $widget);
            $this->save($entity);
        }

        // soft delete non-existing app widgets
        $this->trashAll(! empty($found) ? ['AppWidgets.name NOT IN' => $found] : []);
    }
protected function _saveAppWidgets(): void
    {
        $widgets = $this->_getAppWidgets();

        $found = [];
        foreach ($widgets as $widget) {
            $found[] = $widget['name'];

            // skip adding existing app widgets
            if ($this->exists(['AppWidgets.name' => $widget['name']])) {
                continue;
            }

            $entity = $this->newEntity();
            $entity = $this->patchEntity($entity, $widget);
            $this->save($entity);
        }

        // soft delete non-existing app widgets
        $this->trashAll(! empty($found) ? ['AppWidgets.name NOT IN' => $found] : []);
    }
protected function _saveAppWidgets ( ) : void { $ widgets = $ this -> _getAppWidgets ( ) ; $ found = [ ] ; foreach ( $ widgets as $ widget ) { $ found [ ] = $ widget [ 'name' ] ; // skip adding existing app widgets if ( $ this -> exists ( [ 'AppWidgets.name' => $ widget [ 'name' ] ] ) ) { continue ; } $ entity = $ this -> newEntity ( ) ; $ entity = $ this -> patchEntity ( $ entity , $ widget ) ; $ this -> save ( $ entity ) ; } // soft delete non-existing app widgets $ this -> trashAll ( ! empty ( $ found ) ? [ 'AppWidgets.name NOT IN' => $ found ] : [ ] ) ; }
Store application scope widgets into the database.

@return void
Store application scope widgets into the database .