src/Controller/DefaultController.php
private function ensureSameGrouping(array $actions, ModelIdInterface $after = null)
    {
        $environment  = $this->getEnvironment();
        $groupingMode = ViewHelpers::getGroupingMode($environment);
        if ($groupingMode && $after && $after->getId()) {
            // when pasting after another item, inherit the grouping field
            $groupingField = $groupingMode['property'];
            $previous      = $this->modelCollector->getModel($after);
            $groupingValue = $previous->getProperty($groupingField);

            foreach ($actions as $action) {
                /** @var ModelInterface $model */
                $model = $action['model'];
                $model->setProperty($groupingField, $groupingValue);
            }
        }
    }
private function ensureSameGrouping(array $actions, ModelIdInterface $after = null)
    {
        $environment  = $this->getEnvironment();
        $groupingMode = ViewHelpers::getGroupingMode($environment);
        if ($groupingMode && $after && $after->getId()) {
            // when pasting after another item, inherit the grouping field
            $groupingField = $groupingMode['property'];
            $previous      = $this->modelCollector->getModel($after);
            $groupingValue = $previous->getProperty($groupingField);

            foreach ($actions as $action) {
                /** @var ModelInterface $model */
                $model = $action['model'];
                $model->setProperty($groupingField, $groupingValue);
            }
        }
    }
private function ensureSameGrouping ( array $ actions , ModelIdInterface $ after = null ) { $ environment = $ this -> getEnvironment ( ) ; $ groupingMode = ViewHelpers :: getGroupingMode ( $ environment ) ; if ( $ groupingMode && $ after && $ after -> getId ( ) ) { // when pasting after another item, inherit the grouping field $ groupingField = $ groupingMode [ 'property' ] ; $ previous = $ this -> modelCollector -> getModel ( $ after ) ; $ groupingValue = $ previous -> getProperty ( $ groupingField ) ; foreach ( $ actions as $ action ) { /** @var ModelInterface $model */ $ model = $ action [ 'model' ] ; $ model -> setProperty ( $ groupingField , $ groupingValue ) ; } } }
Ensure all models have the same grouping.

@param array            $actions The actions collection.
@param ModelIdInterface $after   The previous model id.

@return void
Ensure all models have the same grouping .