src/Kunstmaan/DashboardBundle/Repository/AnalyticsConfigRepository.php
public function flushConfig($id = false)
    {
        $em = $this->getEntityManager();

        // Backward compatibilty to flush overviews without a config set
        if (!$id) {
            $overviewRepository = $em->getRepository('KunstmaanDashboardBundle:AnalyticsOverview');
            foreach ($overviewRepository->findAll() as $overview) {
                $em->remove($overview);
            }
            $em->flush();

            return;
        }

        $config = $id ? $this->find($id) : $this->findFirst();
        foreach ($config->getOverviews() as $overview) {
            $em->remove($overview);
        }
        foreach ($config->getSegments() as $segment) {
            $em->remove($segment);
        }
        $em->flush();
    }
public function flushConfig($id = false)
    {
        $em = $this->getEntityManager();

        // Backward compatibilty to flush overviews without a config set
        if (!$id) {
            $overviewRepository = $em->getRepository('KunstmaanDashboardBundle:AnalyticsOverview');
            foreach ($overviewRepository->findAll() as $overview) {
                $em->remove($overview);
            }
            $em->flush();

            return;
        }

        $config = $id ? $this->find($id) : $this->findFirst();
        foreach ($config->getOverviews() as $overview) {
            $em->remove($overview);
        }
        foreach ($config->getSegments() as $segment) {
            $em->remove($segment);
        }
        $em->flush();
    }
public function flushConfig ( $ id = false ) { $ em = $ this -> getEntityManager ( ) ; // Backward compatibilty to flush overviews without a config set if ( ! $ id ) { $ overviewRepository = $ em -> getRepository ( 'KunstmaanDashboardBundle:AnalyticsOverview' ) ; foreach ( $ overviewRepository -> findAll ( ) as $ overview ) { $ em -> remove ( $ overview ) ; } $ em -> flush ( ) ; return ; } $ config = $ id ? $ this -> find ( $ id ) : $ this -> findFirst ( ) ; foreach ( $ config -> getOverviews ( ) as $ overview ) { $ em -> remove ( $ overview ) ; } foreach ( $ config -> getSegments ( ) as $ segment ) { $ em -> remove ( $ segment ) ; } $ em -> flush ( ) ; }
Flush a config

@param int $id the config id
Flush a config