src/Kunstmaan/DashboardBundle/Repository/AnalyticsConfigRepository.php
public function findFirst($createNew = true)
    {
        // Backwards compatibility: select the first config, still used in the dashboard, specified config ids are set in the dashboard collection bundle
        $em = $this->getEntityManager();
        $query = $em->createQuery('SELECT c FROM KunstmaanDashboardBundle:AnalyticsConfig c');
        $result = $query->getResult();
        // if no configs exist, create a new one
        if (!$result && $createNew) {
            return $this->createConfig();
        } elseif ($result) {
            return $result[0];
        } else {
            return false;
        }
    }
public function findFirst($createNew = true)
    {
        // Backwards compatibility: select the first config, still used in the dashboard, specified config ids are set in the dashboard collection bundle
        $em = $this->getEntityManager();
        $query = $em->createQuery('SELECT c FROM KunstmaanDashboardBundle:AnalyticsConfig c');
        $result = $query->getResult();
        // if no configs exist, create a new one
        if (!$result && $createNew) {
            return $this->createConfig();
        } elseif ($result) {
            return $result[0];
        } else {
            return false;
        }
    }
public function findFirst ( $ createNew = true ) { // Backwards compatibility: select the first config, still used in the dashboard, specified config ids are set in the dashboard collection bundle $ em = $ this -> getEntityManager ( ) ; $ query = $ em -> createQuery ( 'SELECT c FROM KunstmaanDashboardBundle:AnalyticsConfig c' ) ; $ result = $ query -> getResult ( ) ; // if no configs exist, create a new one if ( ! $ result && $ createNew ) { return $ this -> createConfig ( ) ; } elseif ( $ result ) { return $ result [ 0 ] ; } else { return false ; } }
Get the first config from the database, creates a new entry if the config doesn't exist yet

@return AnalyticsConfig $config
Get the first config from the database creates a new entry if the config doesn t exist yet