protected function registerExtension($extension, $name)
    {

        $subExtensions = array();

        $subExtensions[$name] = $extension;
        $parent               = get_parent_class($extension);

        /*foreach($this->extensions as $name => $ext){
                echo ".".$name."------------------";
        }*/

        while ($parent != "" && $parent != "OWeb\\types\\Extension") {
            if (isset($this->extensions[$parent])) {
                throw new \OWeb\Exception("The plugin '$name' has already been registered as : " . get_class(
                        $this->extensions[$parent]
                    ));
            }
            $subExtensions[$parent] = $extension;
            $parent                 = get_parent_class($parent);
        }
        $this->obj_extension[$name] = $extension;
        $this->extensions           = array_merge($this->extensions, $subExtensions);
    }