Persists and flush a panel.

@param FacetPanel $panel

@return FacetPanel
961302
public function editPanel(PanelFacet $panel)
    {
        $this->om->persist($panel);
        $this->om->flush();

        return $panel;
    }
128697
public function send($flush = false)
	{
		if ($this->compress)
		{
			$this->setContent($this->squeeze($this->getContent()));
		}

		$this->sendHeaders();
		$this->sendContent();

		if ($flush)
		{
			if (function_exists('fastcgi_finish_request'))
			{
				fastcgi_finish_request();
			}
			elseif ('cli' !== PHP_SAPI)
			{
				static::closeOutputBuffers(0, true);
				flush();
			}
		}

		return $this;
	}
1183466
public function resetPanelFacets()
    {
        foreach ($this->panelFacets as $panelFacet) {
            $panelFacet->setFacet(null);
        }

        $this->panelFacets = new ArrayCollection();
    }
784316
public function search($params, $panel)
    {
        $models = $panel->models;
        $dataProvider = new DataProvider($panel, [
            'allModels' => $models,
            'sort' => [
                'attributes' => ['category', 'timestamp']
            ],
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $filter = new Filter();
        $this->addCondition($filter, 'category', true);
        if ($this->duration > 0) {
            $filter->addMatcher('duration', new GreaterThanOrEqual(['value' => $this->duration / 1000]));
        }
        $dataProvider->allModels = $filter->filter($models);

        return $dataProvider;
    }
807600
public function addPanel(callable $panel): self
    {
        if (!\in_array($panel, $this->panels, true)) {
            $this->panels[] = $panel;
        }

        return $this;
    }
38093
public function flush($entity = null)
    {
        if ($entity !== null) {
            $this->persist($entity);
        }

        return $this->getEntityManager()->flush();
    }
981066
final public function save(BaseEntityInterface $entity, $flush = false): self
    {
        $this->_em->persist($entity);

        if (true === $flush) {
            $this->_em->flush();
        }

        return $this;
    }
956544
public function moveFacetUp(Facet $facet)
    {
        $currentPosition = $facet->getPosition();

        if ($currentPosition < $this->om->count('Claroline\CoreBundle\Entity\Facet\Facet') - 1) {
            $nextPosition = $currentPosition + 1;
            $nextFacet = $this->om
                ->getRepository('ClarolineCoreBundle:Facet\Facet')
                ->findOneBy(array('position' => $nextPosition));
            $nextFacet->setPosition($currentPosition);
            $facet->setPosition($nextPosition);
            $this->om->persist($nextFacet);
            $this->om->persist($facet);
            $this->om->flush();
        }
    }
392844
public function persist(ProfileInterface $profile)
    {
        foreach ($this->persistenceHandlers as $persistenceHandler) {
            $persistenceHandler->persist($profile);
        }

        return $this;
    }
1144510
protected function populatePanel(EnvironmentInterface $environment)
    {
        /** @var BackendViewInterface $view */
        $view = $environment->getView();

        // Already populated or not in Backend? Get out then.
        if (!(($view instanceof BaseView))) {
            return;
        }

        if (!$environment->getDataDefinition()->hasDefinition(Contao2BackendViewDefinitionInterface::NAME)) {
            return;
        }

        // Already populated.
        if ($view->getPanel()) {
            return;
        }

        $view->setPanel((new PanelBuilder($environment))->build());
    }
996634
public function persistAndFlush()
    {
        if (0 === func_num_args()) {
            throw new \LogicException('Missing arguments');
        }

        $persists = [];
        $entities = func_get_args();

        foreach ($entities as $entity) {
            if (true === is_array($entity)) {
                $persists = array_merge($persists, $entity);
            } else {
                $persists[] = $entity;
            }
        }

        foreach ($persists as $persist) {
            $this->getDoctrine()->getManager()->persist($persist);
        }

        $this->getDoctrine()->getManager()->flush();

        return $this;
    }
1017185
public function flush()
    {
        $output = $this->getXml()->flush();
        fwrite($this->resource, $output);
        return $this;
    }
246628
public function setPersistent($persistent)
    {
        Argument::i()->test(1, 'bool');

        $this->persistent = 1;

        if($persistent) {
            $this->persistent = 2;
        }

        return $this;
    }
1279042
public function flush()
    {
        /** @var $document \Sokil\Mongo\Document */
        foreach ($this->pool as $document) {
            switch ($this->pool->offsetGet($document)) {
                case self::STATE_SAVE:
                    $document->save();
                    break;

                case self::STATE_REMOVE:
                    // delete document form db
                    $document->delete();
                    // remove link form pool
                    $this->detach($document);
                    break;
            }
        }

        return $this;
    }
1330412
public function reorderFields(PanelFacet $panelFacet)
    {
        $fields = $panelFacet->getFieldsFacet();
        $order = 0;

        foreach ($fields as $field) {
            $field->setPosition($order);
            $order++;
            $this->om->persist($field);
        }

        $this->om->flush();
    }
509672
public function useDefaultPanel($title = '')
    {

        /** @var $panel \FrenchFrogs\Panel\Panel\Panel */
        $panel = configurator()->get('panel.class');
        $panel = new $panel;
        $panel->setTitle(strval($title));

        return $this->setPanel($panel);
    }
362759
public function usePalette(PaletteInterface $palette)
    {
        if ($this->palette) {
            $this->finishPalette();
        }

        $event = new UsePaletteEvent($palette, $this);
        $this->dispatchEvent($event);
        $this->palette = $palette;

        return $this;
    }