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

Issue #3360301: Make it possible to set the plan with a setter

parent f199e641
No related branches found
No related tags found
1 merge request!15Issue #3360301: Make it possible to set the plan with a setter
......@@ -13,6 +13,7 @@ class TeamNode extends Node {
const NODE_TYPE = 'team';
const MEMBERS_FIELD = 'field_team_members';
const ADMIN_FIELD = 'field_team_admins';
const PLAN_FIELD = 'field_plan';
const PROJECT_LIMIT_FIELD = 'field_project_limit';
/**
......@@ -26,6 +27,17 @@ class TeamNode extends Node {
return (int) $this->get(self::PROJECT_LIMIT_FIELD)->first()->getString();
}
/**
* Setter for the plan.
*/
public function setPlan($plan) : void {
if (!$this->hasField(self::PLAN_FIELD)) {
throw new \RuntimeException('The plan field is not present on the team node');
}
// @todo Some validation of what plans we are setting, probably?
$this->get(self::PLAN_FIELD)->setValue($plan);
}
/**
* Get the team plan.
*/
......
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