Get model path on storage

@param  string $modelName Input model name from command argument
@return string            Model path on storage
176384
protected function getModelPath($modelName)
    {
        $inputName = explode('/', ucfirst($modelName));
        array_pop($inputName);

        return implode('/', $inputName);
    }
684242
public function getParameter(string $parameterName)
    {
        if (!$this->hasParameter($parameterName)) {
            return null;
        }

        return $this->storage->offsetGet($parameterName);
    }
105486
public function actionMigration($modelName = null)
    {
        $queryTemplate = <<<EOD
        \$query = <<<SQL
{Query}
SQL;
        \$this->execute(\$query);
EOD;
        $queries = [
            'up' => [],
            'down' => [],
        ];
        /** @var \yii\db\Command $command */
        foreach ($this->getAuditManager()->getDbCommands($modelName, 'up') as $command) {
            $queries['up'][] = strtr($queryTemplate, ['{Query}' => $command->getSql()]);
        }
        foreach ($this->getAuditManager()->getDbCommands($modelName, 'down') as $command) {
            $queries['down'][] = strtr($queryTemplate, ['{Query}' => $command->getSql()]);
        }

        if (empty($queries['up']) && empty($queries['down'])) {
            $this->stdout('Warning: nothing to do, would create an empty migration.'."\n", Console::FG_YELLOW);
            return self::EXIT_CODE_ERROR;
        }


        $name = 'm'.gmdate('ymd_His').'_audit';
        if ($modelName !== null) {
            $parts = explode('\\', $modelName);
            $modelName = end($parts);
            $name .= '_' . $modelName;
        }
        $file = $this->migrationPath . DIRECTORY_SEPARATOR . $name . '.php';

        if ($this->confirm("Create new migration '$file'?")) {
            $content = $this->getTemplate($name, $queries);
            file_put_contents($file, $content);
            $this->stdout("New migration created successfully.\n", Console::FG_GREEN);
        }
        return self::EXIT_CODE_NORMAL;
    }
75067
public function getFilePath($fileName = null)
    {
        if ($fileName === null) {
            $fileName = $this->fileName;
        }

        return $this->theme->getPath().'/'.$this->getObjectTypeDirName().'/'.$fileName;
    }
59499
public function getRepository($modelName, $collection = null)
    {
        return $this->repositoryFactory->getRepository($this, $modelName, $collection);
    }
1041704
public function getModelName($path = null)
    {
        $path = $path ?: __DIR__.'/../tmp-model.txt';

        // Have we already fetched the model name?
        if (! is_null($this->model))
        {
            return $this->model;
        }

        // If not, let's grab it if it exists.
        if (file_exists($path))
        {
            return $this->model = $this->file->get($path);
        }
    }
166833
protected function getArgumentPath($withName = false)
    {
        $name = $this->argumentName();

        if (str_contains($name, '.')) {
            $name = str_replace('.', '/', $name);
        }

        if (str_contains($name, '\\')) {
            $name = str_replace('\\', '/', $name);
        }

        // ucfirst char, for correct namespace
        $name = implode('/', array_map('ucfirst', explode('/', $name)));

        // if we need to keep lowercase
        if ($this->settingsDirectoryFormat() === 'strtolower') {
            $name = implode('/', array_map('strtolower', explode('/', $name)));
        }

        // if we want the path with name
        if ($withName) {
            return $name . '/';
        }

        if (str_contains($name, '/')) {
            return substr($name, 0, strripos($name, '/') + 1);
        }

        return '';
    }
932549
public static function getModelClass($name)
    {
        // If the name contains a backslash it is already fully qualified. However in some cases
        // a model might be replaced by a new class and so we must first look to see if this model is
        // mapped and if so return it's replacement instead.
        if (stripos($name, "\\") !== false) {
            $newName = self::getModelNameFromClass($name);

            if ($newName === null) {
                // $name hasn't been registered as a model object. Play safe and return the
                // same class name passed to us.
                return '\\' . ltrim($name, '\\');
            }

            $name = $newName;
        }

        if (self::$modelClassesCache == null) {
            self::$modelClassesCache = [];

            $schemas = self::getAllSchemas();

            self::$modelNamesCache = [];

            foreach ($schemas as $schema) {
                self::$modelClassesCache = array_merge(self::$modelClassesCache, $schema->models);
                self::$modelNamesCache = array_merge(self::$modelNamesCache, $schema->modelClassNames);
            }
        }

        if (isset(self::$modelClassesCache[$name])) {
            return '\\' . ltrim(self::$modelClassesCache[$name], '\\');
        }

        return null;
    }
798390
protected static function getOutputPath($filename)
    {
        $outputFilename = StaticContainer::get('path.tmp') . '/assets/' . $filename;

        @chmod($outputFilename, 0600);

        if(file_exists($outputFilename)){
            @unlink($outputFilename);
        }

        return $outputFilename;
    }
12412
public static function createForModelName($modelName)
    {
        if (!class_exists($modelName)) {
            throw new \Parable\ORM\Exception("Model '{$modelName}' does not exist.");
        }
        return self::createForModel($modelName::create());
    }
900185
public function getModelClass(string $modelName): ?string
    {
        if (isset($this->models[$modelName])) {
            return $this->models[$modelName];
        }

        return null;
    }
166720
protected function getPath($model, $path)
    {
        $name = Str::lower(str_replace('\\', '_', $model));

        return $path.'/'.$name.'.php';
    }
35765
public function joinSlug($modelName, $tableName)
    {
        if ($this->_aliasIsJoined === false) {
            $subSql = 'SELECT ' . SeoSlug::tableName() . '.*
    	FROM ' . SeoSlug::tableName() . '
      	JOIN (
			SELECT ' . SeoSlug::tableName() . '.model_id, MAX(id) AS max_id
           	FROM ' . SeoSlug::tableName() . '
           	WHERE ' . SeoSlug::tableName() . '.model = ' . Yii::$app->db->quoteValue($modelName) . '
            GROUP BY ' . SeoSlug::tableName() . '.model_id
		) as sel ON ' . SeoSlug::tableName() . '.model_id = sel.model_id AND ' . SeoSlug::tableName() . '.id = sel.max_id';
            $sql = '(' . $subSql . ') as ' . SeoSlug::tableName() . '';
            $this->leftJoin($sql, $tableName . '.id = ' . SeoSlug::tableName() . '.model_id');
            $this->_aliasIsJoined = true;
        }
        return $this;
    }
228647
protected function getFilePath($filename)
    {
        if ($filename{0} == '/' || strstr($filename, ':') !== false) {
            return $filename;
        }

        return realpath(getcwd() . '/' . $filename);
    }
564682
protected function _getSchemaCache($modelName = null) {
		if (empty($modelName)) {
			return null;
		}

		$modelName = (string)$modelName;
		if (!isset($this->_schemaCache[$modelName])) {
			return null;
		}

		return $this->_schemaCache[$modelName];
	}
504737
public function path($filename)
    {
        if (preg_match('~^' . $this->base_directory . '~', $filename)) {
            return $filename;
        }

        return rtrim($this->base_directory, '/') . '/' . ltrim($filename, '/');
    }
376869
public function getStoragePath($modelClass = null)
    {
        $sanitisedClassName = $this->sanitiseClassName($modelClass ?: $this->modelClass);
        return str_replace('{model}', $sanitisedClassName, $this->config()->get('storage_path'));
    }