Skip to content

Commit

Permalink
Fix options parsing and SQL debug output (#694)
Browse files Browse the repository at this point in the history
* Fix specifying multiple comma separated options

* Show formatted SQL when debugging on cli
  • Loading branch information
andig committed Jun 16, 2018
1 parent 62d05d1 commit c66bc88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Controller/DataController.php
Expand Up @@ -45,7 +45,7 @@ class DataController extends Controller {

public function __construct(Request $request, EntityManager $em, View $view) {
parent::__construct($request, $em, $view);
$this->options = (array) strtolower($this->getParameters()->get('options'));
$this->options = (array) explode(',', strtolower($this->getParameters()->get('options')));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions lib/Util/Debug.php
Expand Up @@ -152,6 +152,9 @@ public static function getParametrizedQuery($sql, $sqlParameters) {
while (count($sqlParameters)) {
$sql = preg_replace('/\?/', self::formatSQLParameter(array_shift($sqlParameters)), $sql, 1);
}
if (php_sapi_name() === 'cli' && class_exists('\SqlFormatter')) {
$sql = \SqlFormatter::format($sql, false);
}
return $sql;
}

Expand Down

0 comments on commit c66bc88

Please sign in to comment.