Skip to content

Is there a better way how to search value in postgres jsonb? #492

Answered by hrach
mabar asked this question in Q&A
Discussion options

You must be logged in to vote

This is rather a Dbal question. There are two possible solution:

  1. Register own modifier and implement its parsing.
  1. Manually prepare placeholders for the value:
	protected function evaluateInDb(DbalExpressionResult $expression, $value): DbalExpressionResult
	{
		assert(is_array($value));

		$size = count($value);
		$placeholders = implode(', ', array_fill(0, $size, '%s'));
		$arrayExpression = "array[$placeholders]";
		return $expression->append("?| %arrayExpre…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@hrach
Comment options

@mabar
Comment options

@hrach
Comment options

@hrach
Comment options

Answer selected by mabar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants