Created
November 3, 2015 23:35
-
-
Save damianoporta/0084d87540e4231bbae7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
} else { | |
// Matching | |
$associationConditions = $this->association($options['association'])->conditions(); | |
return $query | |
->join([ | |
'table' => 'tags_associations', | |
'alias' => $options['association'], | |
'type' => 'INNER', | |
'conditions' => [ | |
"{$options['association']}.foreign_key = Ads.id", | |
"{$options['association']}.model" => "Ads", | |
] + $associationConditions | |
]) | |
->join([ | |
'table' => 'tags', | |
'alias' => "{$options['association']}Tags", | |
'type' => 'INNER', | |
'conditions' => [ | |
"{$options['association']}.tag_id = {$options['association']}Tags.id", | |
] | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment