mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-26 13:54:42 +02:00
Added very basic possibility to add an association
This commit is contained in:
parent
b7cfdebad5
commit
8ab9cf1417
8 changed files with 143 additions and 6 deletions
|
@ -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;
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue