public function setupClassInfo($fields = [], $kwargs = [])
    {
//        if (ArrayHelper::hasKey($kwargs, 'registry')) {
//            $registry = $kwargs['registry'];
//        } else {
//            $registry = BaseOrm::getRegistry(false);
//        }

        try {
            $registry = ArrayHelper::getValue($kwargs, 'registry',
                ArrayHelper::STRICT);
        } catch (KeyError $e) {
            throw new InvalidArgumentException('registry not provided');
        }

        // if the registry is already ready and an
        // instance of this class has already been registered with the registry
        // there is no need to register again, just re-use the meta
        // information of the already registered instance
        // remember meta only holds information that related to the
        // class as a whole and not the instances.
        if ($registry->hasModel(get_class($this)) && $registry->ready) {
            $this->loadMeta($registry);
        } else {
            // get meta settings for this model

            $metaSettings = Tools::getClassMetaSettings($this);
            $metaSettings['registry'] = $registry;

            if ($kwargs) {
                if (ArrayHelper::hasKey($kwargs, 'meta')) {
                    $metaSettings = array_merge($kwargs['meta'], $metaSettings);
                }
            }

            $meta = Meta::createObject($metaSettings);

            $this->addToClass('meta', $meta);

            /** @var $immediateParent ReflectionObject */
            list(
                $concreteParentName, $immediateParent,
                $classFields, $parentLink
                ) = self::getHierarchyMeta($this);

            $this->setupFields($fields, $classFields);

            // proxy model setup
            /* @var $concreteParent Model */
            if ($this->getMeta()->proxy) {
                $concreteParentName = Tools::unifyModelName($concreteParentName);
                $concreteParent = $this->getMeta()->getRegistry()
                    ->getRegisteredModel($concreteParentName);
                $this->proxySetup($concreteParent);
            } else {
                $this->getMeta()->setConcreteModel($this);

                // setup for multiple inheritance
                if ($parentLink) {
                    $this->getMeta()->setParentLinks($parentLink);
                }
            }

            // ensure the model is ready for use.
            $this->prepare();

            // register the model
            $meta->getRegistry()->registerModel($this);
        }
    }