Skip to content
Snippets Groups Projects
Commit f199e641 authored by Eirik Morland's avatar Eirik Morland
Browse files

Issue #3358364 by eiriksm: Make it possible to get all projects of a team

parent 1a65e7c7
No related branches found
No related tags found
1 merge request!14Issue #3358364: Make it possible to get all projects of a team
......@@ -38,6 +38,25 @@ class TeamManager {
$this->state = $state;
}
/**
* Get all the projects of a team.
*
* @return \Drupal\violinist_projects\ProjectNode[]
* An array of project nodes.
*/
public function getProjects(TeamNode $node) : array {
$storage = $this->entityTypeManager->getStorage('node');
$nids = $storage
->getQuery()
// @todo We would have used the constants from the projects module here,
// but we can not depend on that module since that would create a circular
// dependency, really.
->condition('type', 'project')
->condition('field_team', $node->id())
->execute();
return $storage->loadMultiple($nids);
}
/**
* Gets all the teams for a given user.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment