Skip to content

Releases: bpolaszek/where

Random named placeholders

22 Jul 11:04
Compare
Choose a tag to compare

To avoid conflicts with existing placeholders into the same query, we added support for random named placeholders in field helpers. They can be simply enabled by passing ?? as the $placeholder argument.

Examples:

use function BenTools\Where\field;

$condition = field('foo')->equals('bar');
echo $condition; // "foo = ?"
var_dump($condition->getValues()); // ['bar']

$condition = field('foo')->equals('bar', null);
echo $condition; // "foo = bar"
var_dump($condition->getValues()); // []

$condition = field('foo')->equals('bar', 'baz');
echo $condition; // "foo = :baz"
var_dump($condition->getValues()); // ['baz' => 'bar']

$condition = field('foo')->equals('bar', '??');
echo $condition; // "foo = :pbdnsvvx"
var_dump($condition->getValues()); // ['pbdnsvvx' => 'bar']

$condition = field('foo')->in(['bar', 'baz']);
echo $condition; // "foo IN (?, ?)"
var_dump($condition->getValues()); // ['bar', 'baz']

$condition = field('foo')->in(['bar', 'baz'], '??');
echo $condition; // "foo IN (:qifhdhff, :rqxshnae)"
var_dump($condition->getValues()); // ['qifhdhff' => 'bar', 'rqxshnae' => 'baz']

Preview Helper

17 May 10:11
Compare
Choose a tag to compare

Expression objects now have a preview() method, allowing you to debug prepared statements.

Initial release

26 Sep 10:22
Compare
Choose a tag to compare
1.0

Initial commit