Added possibility to set project status

This commit is contained in:
Jan Böhmer 2022-12-29 15:22:34 +01:00
parent 5521995f79
commit adc070d10c
7 changed files with 191 additions and 33 deletions

View file

@ -15,6 +15,13 @@ trait ProjectTrait
*/
protected $project_bom_entries = [];
/**
* @var Project|null If a project is set here, then this part is special and represents the builds of a project.
* @ORM\OneToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="build_part")
* @ORM\JoinColumn(nullable=true)
*/
protected ?Project $built_project = null;
/**
* Returns all ProjectBOMEntries that use this part.
* @return Collection<int, ProjectBOMEntry>|ProjectBOMEntry[]
@ -24,6 +31,36 @@ trait ProjectTrait
return $this->project_bom_entries;
}
/**
* Checks whether this part represents the builds of a project
* @return bool True if it represents the builds, false if not
*/
public function isProjectBuildPart(): bool
{
return $this->built_project !== null;
}
/**
* Returns the project that this part represents the builds of, or null if it doesnt
* @return Project|null
*/
public function getBuiltProject(): ?Project
{
return $this->built_project;
}
/**
* Sets the project that this part represents the builds of
* @param Project|null $built_project The project that this part represents the builds of, or null if it is not a build part
*/
public function setBuiltProject(?Project $built_project): self
{
$this->built_project = $built_project;
return $this;
}
/**
* Get all devices which uses this part.
*