public function setSetting($setting_key, $focus, $value, $context = '', $user = null)
    {
        $em = $this->getEntityManager();

        $params = array();
        $params['setting_key'] = $setting_key;
        $params['focus'] = $focus;

        if ($context) {
            $params['context'] = $context;
        }
        if ($user) {
            $params['user'] = $user;
        }

        $setting = $this->findOneBy($params);

        // We create the new setting if it not exists
        if (!$setting) {
            $class_name = $this->container->getParameter('acs_settings.setting_class');
            $setting = new $class_name;
            $setting->setSettingKey($setting_key);
            $setting->setFocus($focus);
            $setting->setContext($context);
        }

        $setting->setValue($value);

        $em->persist($setting);
        $em->flush();

        return $setting;
    }
public function setSetting($setting_key, $focus, $value, $context = '', $user = null)
    {
        $em = $this->getEntityManager();

        $params = array();
        $params['setting_key'] = $setting_key;
        $params['focus'] = $focus;

        if ($context) {
            $params['context'] = $context;
        }
        if ($user) {
            $params['user'] = $user;
        }

        $setting = $this->findOneBy($params);

        // We create the new setting if it not exists
        if (!$setting) {
            $class_name = $this->container->getParameter('acs_settings.setting_class');
            $setting = new $class_name;
            $setting->setSettingKey($setting_key);
            $setting->setFocus($focus);
            $setting->setContext($context);
        }

        $setting->setValue($value);

        $em->persist($setting);
        $em->flush();

        return $setting;
    }
public function setSetting ( $ setting_key , $ focus , $ value , $ context = '' , $ user = null ) { $ em = $ this -> getEntityManager ( ) ; $ params = array ( ) ; $ params [ 'setting_key' ] = $ setting_key ; $ params [ 'focus' ] = $ focus ; if ( $ context ) { $ params [ 'context' ] = $ context ; } if ( $ user ) { $ params [ 'user' ] = $ user ; } $ setting = $ this -> findOneBy ( $ params ) ; // We create the new setting if it not exists if ( ! $ setting ) { $ class_name = $ this -> container -> getParameter ( 'acs_settings.setting_class' ) ; $ setting = new $ class_name ; $ setting -> setSettingKey ( $ setting_key ) ; $ setting -> setFocus ( $ focus ) ; $ setting -> setContext ( $ context ) ; } $ setting -> setValue ( $ value ) ; $ em -> persist ( $ setting ) ; $ em -> flush ( ) ; return $ setting ; }
Sets a setting value
Sets a setting value