public function getModels($includeAutoCreated = false, $app = null): array
    {
        $this->isAppReady();

        if ($includeAutoCreated && is_null($app)) {
            return $this->allModels;
        }

        if (!is_null($app)) {
            $appModels = $this->appModels[$app];
            if (!$includeAutoCreated) {
                $rModels = [];
                foreach ($appModels as $name => $appModel) {
                    if (!$appModel->getMeta()->autoCreated) {
                        $rModels[$name] = $appModel;
                    }
                }
                $appModels = $rModels;
            }

            return $appModels;
        }

        $rModels = [];
        /** @var $model Model */
        foreach ($this->allModels as $name => $model) {
            if (!$includeAutoCreated && $model->getMeta()->autoCreated) {
                continue;
            }
            $rModels[$name] = $model;
        }

        return $rModels;
    }