Skip to content
Permalink
Browse files

apply TypeMap into matching/notMatching/innerJoinWith...

apply TypeMap into matching/notMatching/innerJoinWith/leftJoinWith
  • Loading branch information...
saeideng committed Sep 25, 2016
1 parent 85ed1aa commit 875d911beaa1df9b2d3330dbe6fc78556e7a7aa0
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/ORM/Query.php
@@ -450,7 +450,8 @@ protected function _addAssociationsToTypeMap($table, $typeMap, $associations)
*/
public function matching($assoc, callable $builder = null)
{
$this->eagerLoader()->matching($assoc, $builder);
$result = $this->eagerLoader()->matching($assoc, $builder);
$this->_addAssociationsToTypeMap($this->repository(), $this->typeMap(), $result);
$this->_dirty();
return $this;
@@ -521,10 +522,11 @@ public function matching($assoc, callable $builder = null)
*/
public function leftJoinWith($assoc, callable $builder = null)
{
$this->eagerLoader()->matching($assoc, $builder, [
$result = $this->eagerLoader()->matching($assoc, $builder, [
'joinType' => 'LEFT',
'fields' => false
]);
$this->_addAssociationsToTypeMap($this->repository(), $this->typeMap(), $result);
$this->_dirty();
return $this;
@@ -567,10 +569,11 @@ public function leftJoinWith($assoc, callable $builder = null)
*/
public function innerJoinWith($assoc, callable $builder = null)
{
$this->eagerLoader()->matching($assoc, $builder, [
$result = $this->eagerLoader()->matching($assoc, $builder, [
'joinType' => 'INNER',
'fields' => false
]);
$this->_addAssociationsToTypeMap($this->repository(), $this->typeMap(), $result);
$this->_dirty();
return $this;
@@ -628,11 +631,12 @@ public function innerJoinWith($assoc, callable $builder = null)
*/
public function notMatching($assoc, callable $builder = null)
{
$this->eagerLoader()->matching($assoc, $builder, [
$result = $this->eagerLoader()->matching($assoc, $builder, [
'joinType' => 'LEFT',
'fields' => false,
'negateMatch' => true
]);
$this->_addAssociationsToTypeMap($this->repository(), $this->typeMap(), $result);
$this->_dirty();
return $this;

0 comments on commit 875d911

Please sign in to comment.
You can’t perform that action at this time.