nette/database

joinWhere with multiple joins throws InvalidArgumentException

Closed this issue · 1 comments

  • bug report? yes
  • feature request? no
  • version: 2.4.2

There is problem with throwing InvalidArgumentException (There are more placeholders than passed parameters.) when you use multiple joinWhere() functions. If you switch JoinWhere in example, it works. I Think there is problem in parseJoinConditions() function in SqlBuilder class.

If you look what $tableJoins variable contains
[
[b1] = ['some data']
[author] = []
[b2] = ['some data']
]

Steps To Reproduce

$this->database->table('author')
->select('*')
->alias(':book', 'b1')
->alias(':book', 'b2')
->joinWhere('b1', ':b1.author_id = author.id')
->joinWhere('b2', ':b2.author_id = author.id AND b2.title LIKE ?', '%e%')-fetch();

dg commented

Closed by #182