mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-14 15:09:31 +00:00
Move logic to AdvancedPropertyTrait.php
This commit is contained in:
parent
3408334a1f
commit
47cbf6c2dd
2 changed files with 31 additions and 30 deletions
|
|
@ -138,16 +138,6 @@ class Part extends AttachmentContainingDBElement
|
||||||
#[UniqueObjectCollection(fields: ['name', 'group', 'element'])]
|
#[UniqueObjectCollection(fields: ['name', 'group', 'element'])]
|
||||||
protected Collection $parameters;
|
protected Collection $parameters;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \DateTimeInterface|null Set a time when the new order will arive.
|
|
||||||
* Set to null, if there is no known date or no order.
|
|
||||||
*/
|
|
||||||
#[Groups(['extended', 'full', 'import', 'part_lot:read', 'part_lot:write'])]
|
|
||||||
#[ORM\Column(name: 'orderDelivery', type: Types::DATETIME_MUTABLE, nullable: true)]
|
|
||||||
#[Year2038BugWorkaround]
|
|
||||||
protected ?\DateTimeInterface $orderDelivery = null;
|
|
||||||
|
|
||||||
|
|
||||||
/** *************************************************************
|
/** *************************************************************
|
||||||
* Overridden properties
|
* Overridden properties
|
||||||
* (They are defined here and not in a trait, to avoid conflicts).
|
* (They are defined here and not in a trait, to avoid conflicts).
|
||||||
|
|
@ -244,26 +234,6 @@ class Part extends AttachmentContainingDBElement
|
||||||
parent::__clone();
|
parent::__clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the expected delivery date of the part. Returns null, if no delivery is due.
|
|
||||||
*/
|
|
||||||
public function getOrderDelivery(): ?\DateTimeInterface
|
|
||||||
{
|
|
||||||
return $this->orderDelivery;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the expected delivery date of the part. Set to null, if no delivery is due.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function setOrderDelivery(?\DateTimeInterface $orderDelivery): self
|
|
||||||
{
|
|
||||||
$this->orderDelivery = $orderDelivery;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[Assert\Callback]
|
#[Assert\Callback]
|
||||||
public function validate(ExecutionContextInterface $context, $payload): void
|
public function validate(ExecutionContextInterface $context, $payload): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||||
namespace App\Entity\Parts\PartTraits;
|
namespace App\Entity\Parts\PartTraits;
|
||||||
|
|
||||||
use App\Entity\Parts\InfoProviderReference;
|
use App\Entity\Parts\InfoProviderReference;
|
||||||
|
use App\Validator\Constraints\Year2038BugWorkaround;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
@ -57,6 +58,15 @@ trait AdvancedPropertyTrait
|
||||||
#[ORM\Column(type: Types::FLOAT, nullable: true)]
|
#[ORM\Column(type: Types::FLOAT, nullable: true)]
|
||||||
protected ?float $mass = null;
|
protected ?float $mass = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \DateTimeInterface|null Set a time when the new order will arive.
|
||||||
|
* Set to null, if there is no known date or no order.
|
||||||
|
*/
|
||||||
|
#[Groups(['extended', 'full', 'import', 'part_lot:read', 'part_lot:write'])]
|
||||||
|
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||||
|
#[Year2038BugWorkaround]
|
||||||
|
protected ?\DateTimeInterface $orderDelivery = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null The internal part number of the part
|
* @var string|null The internal part number of the part
|
||||||
*/
|
*/
|
||||||
|
|
@ -141,6 +151,27 @@ trait AdvancedPropertyTrait
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the expected delivery date of the part. Returns null, if no delivery is due.
|
||||||
|
*/
|
||||||
|
public function getOrderDelivery(): ?\DateTimeInterface
|
||||||
|
{
|
||||||
|
return $this->orderDelivery;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the expected delivery date of the part. Set to null, if no delivery is due.
|
||||||
|
*
|
||||||
|
* @param \DateTimeInterface|null $orderDelivery The new delivery date
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setOrderDelivery(?\DateTimeInterface $orderDelivery): self
|
||||||
|
{
|
||||||
|
$this->orderDelivery = $orderDelivery;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the internal part number of the part.
|
* Returns the internal part number of the part.
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue