mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-03 15:04:32 +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
|
@ -29,6 +29,7 @@ use App\Entity\Parts\Footprint;
|
|||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\PartAssociation;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\Parts\StorageLocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
|
@ -63,6 +64,8 @@ enum LogTargetType: int
|
|||
case PARAMETER = 18;
|
||||
case LABEL_PROFILE = 19;
|
||||
|
||||
case PART_ASSOCIATION = 20;
|
||||
|
||||
/**
|
||||
* Returns the class name of the target type or null if the target type is NONE.
|
||||
* @return string|null
|
||||
|
@ -90,6 +93,7 @@ enum LogTargetType: int
|
|||
self::MEASUREMENT_UNIT => MeasurementUnit::class,
|
||||
self::PARAMETER => AbstractParameter::class,
|
||||
self::LABEL_PROFILE => LabelProfile::class,
|
||||
self::PART_ASSOCIATION => PartAssociation::class,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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