src/Controller/DefaultController.php
private function getActionsFromSource(ModelIdInterface $source, ModelIdInterface $parentModelId = null)
    {
        $basicDefinition = $this->getEnvironment()->getDataDefinition()->getBasicDefinition();

        $filter = new Filter();
        $filter->andModelIsFromProvider($basicDefinition->getDataProvider());
        if ($basicDefinition->getParentDataProvider()) {
            $filter->andParentIsFromProvider($basicDefinition->getParentDataProvider());
        } else {
            $filter->andHasNoParent();
        }
        $filter->andModelIs($source);
        $item = $this->getEnvironment()->getClipboard()->fetch($filter)[0];

        $action  = $item ? $item->getAction() : ItemInterface::CUT;
        $model   = $this->modelCollector->getModel($source);
        $actions = [
            [
                'model' => $model,
                'item'  => new Item($action, $parentModelId, ModelId::fromModel($model))
            ]
        ];

        return $actions;
    }
private function getActionsFromSource(ModelIdInterface $source, ModelIdInterface $parentModelId = null)
    {
        $basicDefinition = $this->getEnvironment()->getDataDefinition()->getBasicDefinition();

        $filter = new Filter();
        $filter->andModelIsFromProvider($basicDefinition->getDataProvider());
        if ($basicDefinition->getParentDataProvider()) {
            $filter->andParentIsFromProvider($basicDefinition->getParentDataProvider());
        } else {
            $filter->andHasNoParent();
        }
        $filter->andModelIs($source);
        $item = $this->getEnvironment()->getClipboard()->fetch($filter)[0];

        $action  = $item ? $item->getAction() : ItemInterface::CUT;
        $model   = $this->modelCollector->getModel($source);
        $actions = [
            [
                'model' => $model,
                'item'  => new Item($action, $parentModelId, ModelId::fromModel($model))
            ]
        ];

        return $actions;
    }
private function getActionsFromSource ( ModelIdInterface $ source , ModelIdInterface $ parentModelId = null ) { $ basicDefinition = $ this -> getEnvironment ( ) -> getDataDefinition ( ) -> getBasicDefinition ( ) ; $ filter = new Filter ( ) ; $ filter -> andModelIsFromProvider ( $ basicDefinition -> getDataProvider ( ) ) ; if ( $ basicDefinition -> getParentDataProvider ( ) ) { $ filter -> andParentIsFromProvider ( $ basicDefinition -> getParentDataProvider ( ) ) ; } else { $ filter -> andHasNoParent ( ) ; } $ filter -> andModelIs ( $ source ) ; $ item = $ this -> getEnvironment ( ) -> getClipboard ( ) -> fetch ( $ filter ) [ 0 ] ; $ action = $ item ? $ item -> getAction ( ) : ItemInterface :: CUT ; $ model = $ this -> modelCollector -> getModel ( $ source ) ; $ actions = [ [ 'model' => $ model , 'item' => new Item ( $ action , $ parentModelId , ModelId :: fromModel ( $ model ) ) ] ] ; return $ actions ; }
Fetch actions from source.

@param ModelIdInterface      $source        The source id.
@param ModelIdInterface|null $parentModelId The parent id.

@return array

@throws \InvalidArgumentException When the model id is invalid.
Fetch actions from source .