Bundle/WidgetMapBundle/Manager/WidgetMapManager.php
public function move(View $view, $sortedWidget)
    {
        /** @var WidgetMap $parentWidgetMap */
        $parentWidgetMap = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->find((int) $sortedWidget['parentWidgetMap']);
        $position = $sortedWidget['position'];
        $slot = $sortedWidget['slot'];
        /** @var WidgetMap $widgetMap */
        $widgetMap = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->find((int) $sortedWidget['widgetMap']);

        $originalParent = $widgetMap->getParent();
        $originalPosition = $widgetMap->getPosition();

        $children = $this->resolver->getChildren($widgetMap, $view);
        $beforeChild = !empty($children[WidgetMap::POSITION_BEFORE]) ? $children[WidgetMap::POSITION_BEFORE] : null;
        $afterChild = !empty($children[WidgetMap::POSITION_AFTER]) ? $children[WidgetMap::POSITION_AFTER] : null;

        $parentWidgetMapChildren = $this->getChildrenByView($parentWidgetMap);

        $widgetMap = $this->moveWidgetMap($view, $widgetMap, $parentWidgetMap, $position, $slot);

        $this->moveChildren($view, $beforeChild, $afterChild, $originalParent, $originalPosition);

        foreach ($parentWidgetMapChildren['views'] as $_view) {
            if ($_view !== $view) {
                if (isset($parentWidgetMapChildren['before'][$_view->getId()]) && $parentWidgetMapChildren['before'][$_view->getId()]->getPosition() == $widgetMap->getPosition()) {
                    $parentWidgetMapChildren['before'][$_view->getId()]->setParent($widgetMap);
                }
                if (isset($parentWidgetMapChildren['after'][$_view->getId()]) && $parentWidgetMapChildren['after'][$_view->getId()]->getPosition() == $widgetMap->getPosition()) {
                    $parentWidgetMapChildren['after'][$_view->getId()]->setParent($widgetMap);
                }
            }
        }
    }
public function move(View $view, $sortedWidget)
    {
        /** @var WidgetMap $parentWidgetMap */
        $parentWidgetMap = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->find((int) $sortedWidget['parentWidgetMap']);
        $position = $sortedWidget['position'];
        $slot = $sortedWidget['slot'];
        /** @var WidgetMap $widgetMap */
        $widgetMap = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->find((int) $sortedWidget['widgetMap']);

        $originalParent = $widgetMap->getParent();
        $originalPosition = $widgetMap->getPosition();

        $children = $this->resolver->getChildren($widgetMap, $view);
        $beforeChild = !empty($children[WidgetMap::POSITION_BEFORE]) ? $children[WidgetMap::POSITION_BEFORE] : null;
        $afterChild = !empty($children[WidgetMap::POSITION_AFTER]) ? $children[WidgetMap::POSITION_AFTER] : null;

        $parentWidgetMapChildren = $this->getChildrenByView($parentWidgetMap);

        $widgetMap = $this->moveWidgetMap($view, $widgetMap, $parentWidgetMap, $position, $slot);

        $this->moveChildren($view, $beforeChild, $afterChild, $originalParent, $originalPosition);

        foreach ($parentWidgetMapChildren['views'] as $_view) {
            if ($_view !== $view) {
                if (isset($parentWidgetMapChildren['before'][$_view->getId()]) && $parentWidgetMapChildren['before'][$_view->getId()]->getPosition() == $widgetMap->getPosition()) {
                    $parentWidgetMapChildren['before'][$_view->getId()]->setParent($widgetMap);
                }
                if (isset($parentWidgetMapChildren['after'][$_view->getId()]) && $parentWidgetMapChildren['after'][$_view->getId()]->getPosition() == $widgetMap->getPosition()) {
                    $parentWidgetMapChildren['after'][$_view->getId()]->setParent($widgetMap);
                }
            }
        }
    }
public function move ( View $ view , $ sortedWidget ) { /** @var WidgetMap $parentWidgetMap */ $ parentWidgetMap = $ this -> em -> getRepository ( 'VictoireWidgetMapBundle:WidgetMap' ) -> find ( ( int ) $ sortedWidget [ 'parentWidgetMap' ] ) ; $ position = $ sortedWidget [ 'position' ] ; $ slot = $ sortedWidget [ 'slot' ] ; /** @var WidgetMap $widgetMap */ $ widgetMap = $ this -> em -> getRepository ( 'VictoireWidgetMapBundle:WidgetMap' ) -> find ( ( int ) $ sortedWidget [ 'widgetMap' ] ) ; $ originalParent = $ widgetMap -> getParent ( ) ; $ originalPosition = $ widgetMap -> getPosition ( ) ; $ children = $ this -> resolver -> getChildren ( $ widgetMap , $ view ) ; $ beforeChild = ! empty ( $ children [ WidgetMap :: POSITION_BEFORE ] ) ? $ children [ WidgetMap :: POSITION_BEFORE ] : null ; $ afterChild = ! empty ( $ children [ WidgetMap :: POSITION_AFTER ] ) ? $ children [ WidgetMap :: POSITION_AFTER ] : null ; $ parentWidgetMapChildren = $ this -> getChildrenByView ( $ parentWidgetMap ) ; $ widgetMap = $ this -> moveWidgetMap ( $ view , $ widgetMap , $ parentWidgetMap , $ position , $ slot ) ; $ this -> moveChildren ( $ view , $ beforeChild , $ afterChild , $ originalParent , $ originalPosition ) ; foreach ( $ parentWidgetMapChildren [ 'views' ] as $ _view ) { if ( $ _view !== $ view ) { if ( isset ( $ parentWidgetMapChildren [ 'before' ] [ $ _view -> getId ( ) ] ) && $ parentWidgetMapChildren [ 'before' ] [ $ _view -> getId ( ) ] -> getPosition ( ) == $ widgetMap -> getPosition ( ) ) { $ parentWidgetMapChildren [ 'before' ] [ $ _view -> getId ( ) ] -> setParent ( $ widgetMap ) ; } if ( isset ( $ parentWidgetMapChildren [ 'after' ] [ $ _view -> getId ( ) ] ) && $ parentWidgetMapChildren [ 'after' ] [ $ _view -> getId ( ) ] -> getPosition ( ) == $ widgetMap -> getPosition ( ) ) { $ parentWidgetMapChildren [ 'after' ] [ $ _view -> getId ( ) ] -> setParent ( $ widgetMap ) ; } } } }
moves a widget in a view.

@param View  $view
@param array $sortedWidget
moves a widget in a view .