src/Manipulation/AbstractBaseQuery.php
public function getSql($formatted = false)
    {
        if ($formatted) {
            return $this->getBuilder()->writeFormatted($this);
        }

        return $this->getBuilder()->write($this);
    }
public function getSql($formatted = false)
    {
        if ($formatted) {
            return $this->getBuilder()->writeFormatted($this);
        }

        return $this->getBuilder()->write($this);
    }
Converts this query into an SQL string by using the injected builder.
Optionally can return the SQL with formatted structure.

@param bool $formatted

@return string