Skip to content

Commit fa3b864

Browse files
committed
use parent property to fallback method call to the parent object
1 parent b1043a4 commit fa3b864

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/Universal/Syntax/Conditions.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ public function __construct(array $exprs = array(), $parent = null)
6161
$this->parent = $parent;
6262
}
6363

64+
public function setParent($parent)
65+
{
66+
$this->parent = $parent;
67+
}
68+
6469
/**
6570
* http://dev.mysql.com/doc/refman/5.0/en/expressions.html.
6671
*/

src/Universal/Traits/WhereTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ trait WhereTrait
2121
public function where($expr = null, array $args = array())
2222
{
2323
if (!$this->where) {
24-
$this->where = new Conditions();
24+
$this->where = new Conditions([], $this);
2525
}
2626
if ($expr) {
2727
if (is_string($expr)) {
@@ -40,6 +40,7 @@ public function where($expr = null, array $args = array())
4040

4141
public function setWhere(Conditions $where)
4242
{
43+
$where->setParent($this);
4344
$this->where = $where;
4445
}
4546

@@ -49,7 +50,7 @@ public function getWhere()
4950
return $this->where;
5051
}
5152

52-
return $this->where = new Conditions();
53+
return $this->where = new Conditions([], $this);
5354
}
5455

5556
public function buildWhereClause(BaseDriver $driver, ArgumentArray $args)

0 commit comments

Comments
 (0)