Added very basic possibility to add an association

This commit is contained in:
Jan Böhmer 2023-11-13 00:11:58 +01:00
parent b7cfdebad5
commit 8ab9cf1417
8 changed files with 143 additions and 6 deletions

View file

@ -26,7 +26,7 @@ namespace App\Entity\Parts;
/**
* The values of this enums are used to describe how two parts are associated with each other.
*/
enum PartAssociationType: int
enum AssociationType: int
{
/** A user definable association type, which can be described in the comment field */
case OTHER = 0;

View file

@ -41,10 +41,10 @@ class PartAssociation extends AbstractDBElement
use TimestampTrait;
/**
* @var PartAssociationType The type of this association (how the two parts are related)
* @var AssociationType The type of this association (how the two parts are related)
*/
#[ORM\Column(type: Types::SMALLINT, enumType: PartAssociationType::class)]
protected PartAssociationType $type = PartAssociationType::OTHER;
#[ORM\Column(type: Types::SMALLINT, enumType: AssociationType::class)]
protected AssociationType $type = AssociationType::OTHER;
/**
* @var string|null A comment describing this association further. Can also be used to specify the OTHER type
@ -69,12 +69,12 @@ class PartAssociation extends AbstractDBElement
#[Assert\NotNull]
protected ?Part $other = null;
public function getType(): PartAssociationType
public function getType(): AssociationType
{
return $this->type;
}
public function setType(PartAssociationType $type): PartAssociation
public function setType(AssociationType $type): PartAssociation
{
$this->type = $type;
return $this;