Bundle/WidgetMapBundle/Manager/WidgetMapManager.php
public function insert(Widget $widget, View $view, $slotId, $position, $widgetReference)
    {
        $quantum = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->findOneBy([
            'view'     => $view,
            'slot'     => $slotId,
            'position' => $position,
            'parent'   => $widgetReference,
            'action'   => [
                WidgetMap::ACTION_CREATE,
                WidgetMap::ACTION_OVERWRITE,
            ],
        ]);

        if ($quantum) {
            $widget->setWidgetMap($quantum);
            $view->addWidgetMap($quantum);
        } else {
            $parent = null;
            if ($widgetReference) {
                $parent = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->find($widgetReference);
            }
            //create the new widget map
            $widgetMapEntry = new WidgetMap();
            $widgetMapEntry->setAction(WidgetMap::ACTION_CREATE);
            $widgetMapEntry->setSlot($slotId);
            $widgetMapEntry->setPosition($position);
            $widgetMapEntry->setParent($parent);
            $widget->setWidgetMap($widgetMapEntry);

            $view->addWidgetMap($widgetMapEntry);
        }
    }
public function insert(Widget $widget, View $view, $slotId, $position, $widgetReference)
    {
        $quantum = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->findOneBy([
            'view'     => $view,
            'slot'     => $slotId,
            'position' => $position,
            'parent'   => $widgetReference,
            'action'   => [
                WidgetMap::ACTION_CREATE,
                WidgetMap::ACTION_OVERWRITE,
            ],
        ]);

        if ($quantum) {
            $widget->setWidgetMap($quantum);
            $view->addWidgetMap($quantum);
        } else {
            $parent = null;
            if ($widgetReference) {
                $parent = $this->em->getRepository('VictoireWidgetMapBundle:WidgetMap')->find($widgetReference);
            }
            //create the new widget map
            $widgetMapEntry = new WidgetMap();
            $widgetMapEntry->setAction(WidgetMap::ACTION_CREATE);
            $widgetMapEntry->setSlot($slotId);
            $widgetMapEntry->setPosition($position);
            $widgetMapEntry->setParent($parent);
            $widget->setWidgetMap($widgetMapEntry);

            $view->addWidgetMap($widgetMapEntry);
        }
    }
public function insert ( Widget $ widget , View $ view , $ slotId , $ position , $ widgetReference ) { $ quantum = $ this -> em -> getRepository ( 'VictoireWidgetMapBundle:WidgetMap' ) -> findOneBy ( [ 'view' => $ view , 'slot' => $ slotId , 'position' => $ position , 'parent' => $ widgetReference , 'action' => [ WidgetMap :: ACTION_CREATE , WidgetMap :: ACTION_OVERWRITE , ] , ] ) ; if ( $ quantum ) { $ widget -> setWidgetMap ( $ quantum ) ; $ view -> addWidgetMap ( $ quantum ) ; } else { $ parent = null ; if ( $ widgetReference ) { $ parent = $ this -> em -> getRepository ( 'VictoireWidgetMapBundle:WidgetMap' ) -> find ( $ widgetReference ) ; } //create the new widget map $ widgetMapEntry = new WidgetMap ( ) ; $ widgetMapEntry -> setAction ( WidgetMap :: ACTION_CREATE ) ; $ widgetMapEntry -> setSlot ( $ slotId ) ; $ widgetMapEntry -> setPosition ( $ position ) ; $ widgetMapEntry -> setParent ( $ parent ) ; $ widget -> setWidgetMap ( $ widgetMapEntry ) ; $ view -> addWidgetMap ( $ widgetMapEntry ) ; } }
Insert a WidgetMap in a view at given position.

@param string $slotId
Insert a WidgetMap in a view at given position .