src/Kunstmaan/DashboardBundle/Repository/AnalyticsSegmentRepository.php
public function initSegment($segment, $configId = false)
    {
        if (!count($segment->getOverviews()->toArray())) {
            if ($configId) {
                $config = $this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->find($configId);
            } else {
                $config = $this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->findFirst();
            }
            $this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsOverview')->addOverviews($config, $segment);
        }
    }
public function initSegment($segment, $configId = false)
    {
        if (!count($segment->getOverviews()->toArray())) {
            if ($configId) {
                $config = $this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->find($configId);
            } else {
                $config = $this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsConfig')->findFirst();
            }
            $this->getEntityManager()->getRepository('KunstmaanDashboardBundle:AnalyticsOverview')->addOverviews($config, $segment);
        }
    }
public function initSegment ( $ segment , $ configId = false ) { if ( ! count ( $ segment -> getOverviews ( ) -> toArray ( ) ) ) { if ( $ configId ) { $ config = $ this -> getEntityManager ( ) -> getRepository ( 'KunstmaanDashboardBundle:AnalyticsConfig' ) -> find ( $ configId ) ; } else { $ config = $ this -> getEntityManager ( ) -> getRepository ( 'KunstmaanDashboardBundle:AnalyticsConfig' ) -> findFirst ( ) ; } $ this -> getEntityManager ( ) -> getRepository ( 'KunstmaanDashboardBundle:AnalyticsOverview' ) -> addOverviews ( $ config , $ segment ) ; } }
Initialise a segment by adding new overviews if they don't exist yet

@param AnalyticsSegment $segment
@param int              $configId
Initialise a segment by adding new overviews if they don t exist yet