src/Service/MelisCorePlatformSchemeService.php
public function getCurrentScheme($colorsOnly = false)
    {

        // Event parameters prepare
        $arrayParameters = $this->makeArrayFromParameters(__METHOD__, func_get_args());
        $results         = null;

        // Sending service start event
        $arrayParameters = $this->sendEvent('melis_core_package_scheme_get_current_scheme_start', $arrayParameters);

        $table = $this->schemeTable();

        $schemeData = $table->getActiveScheme($colorsOnly)->current();

        if(!$schemeData) {
            $schemeData = $table->getDefaultScheme($colorsOnly)->current();
        }

        // check if scheme has data
        if($schemeData) {

            $entScheme = new MelisCorePlatformScheme();

            $entScheme->setId($schemeData->pscheme_id);
            $entScheme->setName($schemeData->pscheme_name);
            $entScheme->setColors($schemeData->pscheme_colors);

            if(!$colorsOnly) {
                $entScheme->setSidebarHeaderLogo($schemeData->pscheme_sidebar_header_logo);
                $entScheme->setSidebarHeaderText($schemeData->pscheme_sidebar_header_text);
                $entScheme->setLoginLogo($schemeData->pscheme_login_logo);
                $entScheme->setLoginBackground($schemeData->pscheme_login_background);
                $entScheme->setFavicon($schemeData->pscheme_favicon);
            }

            $entScheme->setIsActive($schemeData->pscheme_is_active);

            $results = $entScheme;
        }

        // Adding results to parameters for events treatment if needed
        $arrayParameters['results'] = $results;
        // Sending service end event
        $arrayParameters = $this->sendEvent('melis_core_package_scheme_get_current_scheme_end', $arrayParameters);

        return $arrayParameters['results'];
    }
public function getCurrentScheme($colorsOnly = false)
    {

        // Event parameters prepare
        $arrayParameters = $this->makeArrayFromParameters(__METHOD__, func_get_args());
        $results         = null;

        // Sending service start event
        $arrayParameters = $this->sendEvent('melis_core_package_scheme_get_current_scheme_start', $arrayParameters);

        $table = $this->schemeTable();

        $schemeData = $table->getActiveScheme($colorsOnly)->current();

        if(!$schemeData) {
            $schemeData = $table->getDefaultScheme($colorsOnly)->current();
        }

        // check if scheme has data
        if($schemeData) {

            $entScheme = new MelisCorePlatformScheme();

            $entScheme->setId($schemeData->pscheme_id);
            $entScheme->setName($schemeData->pscheme_name);
            $entScheme->setColors($schemeData->pscheme_colors);

            if(!$colorsOnly) {
                $entScheme->setSidebarHeaderLogo($schemeData->pscheme_sidebar_header_logo);
                $entScheme->setSidebarHeaderText($schemeData->pscheme_sidebar_header_text);
                $entScheme->setLoginLogo($schemeData->pscheme_login_logo);
                $entScheme->setLoginBackground($schemeData->pscheme_login_background);
                $entScheme->setFavicon($schemeData->pscheme_favicon);
            }

            $entScheme->setIsActive($schemeData->pscheme_is_active);

            $results = $entScheme;
        }

        // Adding results to parameters for events treatment if needed
        $arrayParameters['results'] = $results;
        // Sending service end event
        $arrayParameters = $this->sendEvent('melis_core_package_scheme_get_current_scheme_end', $arrayParameters);

        return $arrayParameters['results'];
    }
public function getCurrentScheme ( $ colorsOnly = false ) { // Event parameters prepare $ arrayParameters = $ this -> makeArrayFromParameters ( __METHOD__ , func_get_args ( ) ) ; $ results = null ; // Sending service start event $ arrayParameters = $ this -> sendEvent ( 'melis_core_package_scheme_get_current_scheme_start' , $ arrayParameters ) ; $ table = $ this -> schemeTable ( ) ; $ schemeData = $ table -> getActiveScheme ( $ colorsOnly ) -> current ( ) ; if ( ! $ schemeData ) { $ schemeData = $ table -> getDefaultScheme ( $ colorsOnly ) -> current ( ) ; } // check if scheme has data if ( $ schemeData ) { $ entScheme = new MelisCorePlatformScheme ( ) ; $ entScheme -> setId ( $ schemeData -> pscheme_id ) ; $ entScheme -> setName ( $ schemeData -> pscheme_name ) ; $ entScheme -> setColors ( $ schemeData -> pscheme_colors ) ; if ( ! $ colorsOnly ) { $ entScheme -> setSidebarHeaderLogo ( $ schemeData -> pscheme_sidebar_header_logo ) ; $ entScheme -> setSidebarHeaderText ( $ schemeData -> pscheme_sidebar_header_text ) ; $ entScheme -> setLoginLogo ( $ schemeData -> pscheme_login_logo ) ; $ entScheme -> setLoginBackground ( $ schemeData -> pscheme_login_background ) ; $ entScheme -> setFavicon ( $ schemeData -> pscheme_favicon ) ; } $ entScheme -> setIsActive ( $ schemeData -> pscheme_is_active ) ; $ results = $ entScheme ; } // Adding results to parameters for events treatment if needed $ arrayParameters [ 'results' ] = $ results ; // Sending service end event $ arrayParameters = $ this -> sendEvent ( 'melis_core_package_scheme_get_current_scheme_end' , $ arrayParameters ) ; return $ arrayParameters [ 'results' ] ; }
Returns the currently active scheme, if there's none active
it returns the Melis default scheme
@param bool $colorsOnly : true|false - if true it returns only the colors that will be used in the platform
@return MelisCorePlatformScheme|null
Returns the currently active scheme if there s none active it returns the Melis default scheme