Hii There,
I’m trying to make a little JSON API which I can use to get data about my projects.
For this, I’m first starting off with making a list of all projects found in the tables with only one condition: The project has to have at least one release (found in the projects_releases
table with an association) which has it’s published
value set to 1
.
If the project has multiple releases which have this, then ignore this.
It doesn’t need to include the data of any release, just be in my object if it has one (or more) releases and ignored when it has none.
I currently have this code, but it results in duplicate entries in the final object :\
$projects = $projectsTable
->find()
->leftJoinWith('ProjectsReleases', function ($q) {
return $q->where(['published' => 1]);
});
I hope this makes sense?
Cheers