Forked from fly2279/gist:4edee4cb14e35c133806
Last active
September 19, 2015 12:49
-
-
Save lorenzo/210fc430a0afe6469fc2 to your computer and use it in GitHub Desktop.
Query with belongsToMany and belongsTo association
This file contains 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
<?php | |
$query = $this->Articles->find('all') | |
->leftJoinWith('ArticlesAuthors') | |
->leftJoinWith('Authors') | |
->where(['Authors.id' => 1]) | |
->orWhere(['ArticlesAuthors.author_id' => 1]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment