src/Controller/DefaultController.php
private function fetchModelsFromClipboard(FilterInterface $filter = null, ModelIdInterface $parentModelId = null)
    {
        $environment    = $this->getEnvironment();
        $dataDefinition = $environment->getDataDefinition();

        if (!$filter) {
            $filter = new Filter();
        }

        $basicDefinition   = $dataDefinition->getBasicDefinition();
        $modelProviderName = $basicDefinition->getDataProvider();
        $filter->andModelIsFromProvider($modelProviderName);
        if ($parentModelId) {
            $filter->andParentIsFromProvider($parentModelId->getDataProviderName());
        } else {
            $filter->andHasNoParent();
        }

        $environment = $this->getEnvironment();
        $clipboard   = $environment->getClipboard();
        $items       = $clipboard->fetch($filter);
        $actions     = [];

        foreach ($items as $item) {
            $model = null;

            if (!$item->isCreate() && $item->getModelId()) {
                $model = $this->modelCollector->getModel($item->getModelId()->getId(), $item->getDataProviderName());
            }

            $actions[] = [
                'model' => $model,
                'item'  => $item,
            ];
        }

        return $actions;
    }
private function fetchModelsFromClipboard(FilterInterface $filter = null, ModelIdInterface $parentModelId = null)
    {
        $environment    = $this->getEnvironment();
        $dataDefinition = $environment->getDataDefinition();

        if (!$filter) {
            $filter = new Filter();
        }

        $basicDefinition   = $dataDefinition->getBasicDefinition();
        $modelProviderName = $basicDefinition->getDataProvider();
        $filter->andModelIsFromProvider($modelProviderName);
        if ($parentModelId) {
            $filter->andParentIsFromProvider($parentModelId->getDataProviderName());
        } else {
            $filter->andHasNoParent();
        }

        $environment = $this->getEnvironment();
        $clipboard   = $environment->getClipboard();
        $items       = $clipboard->fetch($filter);
        $actions     = [];

        foreach ($items as $item) {
            $model = null;

            if (!$item->isCreate() && $item->getModelId()) {
                $model = $this->modelCollector->getModel($item->getModelId()->getId(), $item->getDataProviderName());
            }

            $actions[] = [
                'model' => $model,
                'item'  => $item,
            ];
        }

        return $actions;
    }
private function fetchModelsFromClipboard ( FilterInterface $ filter = null , ModelIdInterface $ parentModelId = null ) { $ environment = $ this -> getEnvironment ( ) ; $ dataDefinition = $ environment -> getDataDefinition ( ) ; if ( ! $ filter ) { $ filter = new Filter ( ) ; } $ basicDefinition = $ dataDefinition -> getBasicDefinition ( ) ; $ modelProviderName = $ basicDefinition -> getDataProvider ( ) ; $ filter -> andModelIsFromProvider ( $ modelProviderName ) ; if ( $ parentModelId ) { $ filter -> andParentIsFromProvider ( $ parentModelId -> getDataProviderName ( ) ) ; } else { $ filter -> andHasNoParent ( ) ; } $ environment = $ this -> getEnvironment ( ) ; $ clipboard = $ environment -> getClipboard ( ) ; $ items = $ clipboard -> fetch ( $ filter ) ; $ actions = [ ] ; foreach ( $ items as $ item ) { $ model = null ; if ( ! $ item -> isCreate ( ) && $ item -> getModelId ( ) ) { $ model = $ this -> modelCollector -> getModel ( $ item -> getModelId ( ) -> getId ( ) , $ item -> getDataProviderName ( ) ) ; } $ actions [ ] = [ 'model' => $ model , 'item' => $ item , ] ; } return $ actions ; }
Fetch actions from the clipboard.

@param FilterInterface|null $filter        The clipboard filter.
@param ModelIdInterface     $parentModelId The parent id.

@return array
Fetch actions from the clipboard .