source/Core/UtilsObject.php
public function oxNew($className)
    {
        $arguments = func_get_args();
        array_shift($arguments);
        $argumentsCount = count($arguments);
        $shouldUseCache = $this->shouldCacheObject($className, $arguments);
        if (!\OxidEsales\Eshop\Core\NamespaceInformationProvider::isNamespacedClass($className)) {
            $className = strtolower($className);
        }

        //Get storage key as the class might be aliased.
        $storageKey = Registry::getStorageKey($className);

        //UtilsObject::$_aClassInstances is only intended to be used in unit tests.
        if (defined('OXID_PHP_UNIT') && isset(static::$_aClassInstances[$storageKey])) {
            return static::$_aClassInstances[$storageKey];
        }
        if (!defined('OXID_PHP_UNIT') && $shouldUseCache) {
            $cacheKey = ($argumentsCount) ? $storageKey . md5(serialize($arguments)) : $storageKey;
            if (isset(static::$_aInstanceCache[$cacheKey])) {
                return clone static::$_aInstanceCache[$cacheKey];
            }
        }

        if (!defined('OXID_PHP_UNIT') && isset($this->_aClassNameCache[$className])) {
            $realClassName = $this->_aClassNameCache[$className];
        } else {
            $realClassName = $this->getClassName($className);
            //expect __autoload() (oxfunctions.php) to do its job when class_exists() is called
            if (!class_exists($realClassName)) {
                $exception =  new \OxidEsales\Eshop\Core\Exception\SystemComponentException();
                /** Use setMessage here instead of passing it in constructor in order to test exception message */
                $exception->setMessage('EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND' . ' ' . $realClassName);
                throw $exception;
            }

            $this->_aClassNameCache[$className] = $realClassName;
        }

        $object = new $realClassName(...$arguments);
        if (isset($cacheKey) && $shouldUseCache && $object instanceof \OxidEsales\Eshop\Core\Model\BaseModel) {
            static::$_aInstanceCache[$cacheKey] = clone $object;
        }

        return $object;
    }
public function oxNew($className)
    {
        $arguments = func_get_args();
        array_shift($arguments);
        $argumentsCount = count($arguments);
        $shouldUseCache = $this->shouldCacheObject($className, $arguments);
        if (!\OxidEsales\Eshop\Core\NamespaceInformationProvider::isNamespacedClass($className)) {
            $className = strtolower($className);
        }

        //Get storage key as the class might be aliased.
        $storageKey = Registry::getStorageKey($className);

        //UtilsObject::$_aClassInstances is only intended to be used in unit tests.
        if (defined('OXID_PHP_UNIT') && isset(static::$_aClassInstances[$storageKey])) {
            return static::$_aClassInstances[$storageKey];
        }
        if (!defined('OXID_PHP_UNIT') && $shouldUseCache) {
            $cacheKey = ($argumentsCount) ? $storageKey . md5(serialize($arguments)) : $storageKey;
            if (isset(static::$_aInstanceCache[$cacheKey])) {
                return clone static::$_aInstanceCache[$cacheKey];
            }
        }

        if (!defined('OXID_PHP_UNIT') && isset($this->_aClassNameCache[$className])) {
            $realClassName = $this->_aClassNameCache[$className];
        } else {
            $realClassName = $this->getClassName($className);
            //expect __autoload() (oxfunctions.php) to do its job when class_exists() is called
            if (!class_exists($realClassName)) {
                $exception =  new \OxidEsales\Eshop\Core\Exception\SystemComponentException();
                /** Use setMessage here instead of passing it in constructor in order to test exception message */
                $exception->setMessage('EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND' . ' ' . $realClassName);
                throw $exception;
            }

            $this->_aClassNameCache[$className] = $realClassName;
        }

        $object = new $realClassName(...$arguments);
        if (isset($cacheKey) && $shouldUseCache && $object instanceof \OxidEsales\Eshop\Core\Model\BaseModel) {
            static::$_aInstanceCache[$cacheKey] = clone $object;
        }

        return $object;
    }
public function oxNew ( $ className ) { $ arguments = func_get_args ( ) ; array_shift ( $ arguments ) ; $ argumentsCount = count ( $ arguments ) ; $ shouldUseCache = $ this -> shouldCacheObject ( $ className , $ arguments ) ; if ( ! \ OxidEsales \ Eshop \ Core \ NamespaceInformationProvider :: isNamespacedClass ( $ className ) ) { $ className = strtolower ( $ className ) ; } //Get storage key as the class might be aliased. $ storageKey = Registry :: getStorageKey ( $ className ) ; //UtilsObject::$_aClassInstances is only intended to be used in unit tests. if ( defined ( 'OXID_PHP_UNIT' ) && isset ( static :: $ _aClassInstances [ $ storageKey ] ) ) { return static :: $ _aClassInstances [ $ storageKey ] ; } if ( ! defined ( 'OXID_PHP_UNIT' ) && $ shouldUseCache ) { $ cacheKey = ( $ argumentsCount ) ? $ storageKey . md5 ( serialize ( $ arguments ) ) : $ storageKey ; if ( isset ( static :: $ _aInstanceCache [ $ cacheKey ] ) ) { return clone static :: $ _aInstanceCache [ $ cacheKey ] ; } } if ( ! defined ( 'OXID_PHP_UNIT' ) && isset ( $ this -> _aClassNameCache [ $ className ] ) ) { $ realClassName = $ this -> _aClassNameCache [ $ className ] ; } else { $ realClassName = $ this -> getClassName ( $ className ) ; //expect __autoload() (oxfunctions.php) to do its job when class_exists() is called if ( ! class_exists ( $ realClassName ) ) { $ exception = new \ OxidEsales \ Eshop \ Core \ Exception \ SystemComponentException ( ) ; /** Use setMessage here instead of passing it in constructor in order to test exception message */ $ exception -> setMessage ( 'EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND' . ' ' . $ realClassName ) ; throw $ exception ; } $ this -> _aClassNameCache [ $ className ] = $ realClassName ; } $ object = new $ realClassName ( ... $ arguments ) ; if ( isset ( $ cacheKey ) && $ shouldUseCache && $ object instanceof \ OxidEsales \ Eshop \ Core \ Model \ BaseModel ) { static :: $ _aInstanceCache [ $ cacheKey ] = clone $ object ; } return $ object ; }
Creates and returns new object. If creation is not available, dies and outputs
error message.

@param string $className Name of class

@throws SystemComponentException in case that class does not exists

@return object
Creates and returns new object . If creation is not available dies and outputs error message .