protected function prepareJoins($fromAlias): string
    {
        if (!isset($this->join[$fromAlias])) {
            return '';
        }

        $query = '';

        foreach ($this->join[$fromAlias] as $join) {
            $query .= ' ' . strtoupper($join['joinType'])
                . ' JOIN ' . Db::quoteIdentifier($join['joinTable']) . ' AS ' . Db::quoteIdentifier($join['joinAlias'])
                . ' ON ' . $join['joinCondition'];
            $query .= $this->prepareJoins($join['joinAlias']);
        }

        return $query;
    }