mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
f7c2f1032f
commit
21a81486df
24 changed files with 64 additions and 84 deletions
|
@ -61,7 +61,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
|
||||
|
@ -70,11 +69,8 @@ use App\Entity\Parts\PartTraits\BasicPropertyTrait;
|
|||
use App\Entity\Parts\PartTraits\InstockTrait;
|
||||
use App\Entity\Parts\PartTraits\ManufacturerTrait;
|
||||
use App\Entity\Parts\PartTraits\OrderTrait;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Security\Annotations\ColumnSecurity;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
@ -116,6 +112,18 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
protected $lastModified;
|
||||
|
||||
/***************************************************************
|
||||
* Overriden properties
|
||||
* (They are defined here and not in a trait, to avoid conflicts)
|
||||
****************************************************************/
|
||||
|
||||
/**
|
||||
* @var string The name of this part
|
||||
* @ORM\Column(type="string")
|
||||
* @ColumnSecurity(prefix="name")
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=false)
|
||||
* @ColumnSecurity(type="collection", prefix="attachments")
|
||||
|
|
|
@ -40,13 +40,6 @@ use App\Validator\Constraints\Selectable;
|
|||
|
||||
trait BasicPropertyTrait
|
||||
{
|
||||
/**
|
||||
* @var string The name of this part
|
||||
* @ORM\Column(type="string")
|
||||
* @ColumnSecurity(prefix="name")
|
||||
*/
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var string A text describing what this part does
|
||||
* @ORM\Column(type="text")
|
||||
|
@ -182,7 +175,7 @@ trait BasicPropertyTrait
|
|||
* @param Category $category The new category of this part
|
||||
* @return self
|
||||
*/
|
||||
public function setCategory(Category $category): Part
|
||||
public function setCategory(Category $category): self
|
||||
{
|
||||
$this->category = $category;
|
||||
return $this;
|
||||
|
@ -196,7 +189,7 @@ trait BasicPropertyTrait
|
|||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setFootprint(?Footprint $new_footprint): Part
|
||||
public function setFootprint(?Footprint $new_footprint): self
|
||||
{
|
||||
$this->footprint = $new_footprint;
|
||||
return $this;
|
||||
|
|
|
@ -33,7 +33,6 @@ namespace App\Entity\Parts\PartTraits;
|
|||
|
||||
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Security\Annotations\ColumnSecurity;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -181,7 +180,7 @@ trait InstockTrait
|
|||
/**
|
||||
* Set the minimum amount of parts that have to be instock.
|
||||
* See getPartUnit() for the associated unit.
|
||||
* @param int $new_minamount the new count of parts which should be in stock at least
|
||||
* @param float $new_minamount the new count of parts which should be in stock at least
|
||||
* @return self
|
||||
*/
|
||||
public function setMinAmount(float $new_minamount): self
|
||||
|
|
|
@ -73,7 +73,7 @@ trait ManufacturerTrait
|
|||
* @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""})
|
||||
* @ColumnSecurity(type="string", prefix="status", placeholder="")
|
||||
*/
|
||||
protected $manufacturing_status = "";
|
||||
protected $manufacturing_status = '';
|
||||
|
||||
/**
|
||||
* Get the link to the website of the article on the manufacturers website
|
||||
|
|
|
@ -158,7 +158,7 @@ trait OrderTrait
|
|||
*
|
||||
* @param bool $new_manual_order the new "manual_order" attribute
|
||||
* @param int $new_order_quantity the new order quantity
|
||||
* @param int|null $new_order_orderdetails_id * the ID of the new order orderdetails
|
||||
* @param Orderdetail|null $new_order_orderdetail * the ID of the new order orderdetails
|
||||
* * or Zero for "no order orderdetails"
|
||||
* * or NULL for automatic order orderdetails
|
||||
* (if the part has exactly one orderdetails,
|
||||
|
@ -167,7 +167,7 @@ trait OrderTrait
|
|||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setManualOrder(bool $new_manual_order, int $new_order_quantity = 1, ?Orderdetail $new_order_orderdetail = null): Part
|
||||
public function setManualOrder(bool $new_manual_order, int $new_order_quantity = 1, ?Orderdetail $new_order_orderdetail = null): self
|
||||
{
|
||||
//Assert::greaterThan($new_order_quantity, 0, 'The new order quantity must be greater zero. Got %s!');
|
||||
|
||||
|
|
|
@ -62,7 +62,6 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Base\PartsContainingDBElement;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
|
|
|
@ -117,14 +117,16 @@ class Supplier extends Company
|
|||
protected $parts;
|
||||
|
||||
/**
|
||||
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
|
||||
* @return ?Currency
|
||||
*/
|
||||
public function getDefaultCurrency()
|
||||
public function getDefaultCurrency() : ?Currency
|
||||
{
|
||||
return $this->default_currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default currency.
|
||||
* @param ?Currency $default_currency
|
||||
* @return Supplier
|
||||
*/
|
||||
|
@ -135,16 +137,17 @@ class Supplier extends Company
|
|||
}
|
||||
|
||||
/**
|
||||
* @return ?string
|
||||
* Gets the shipping costs for an order with this supplier, given in base currency.
|
||||
* @return string|null A bcmath string with the shipping costs
|
||||
*/
|
||||
public function getShippingCosts() : ?string
|
||||
{
|
||||
dump($this);
|
||||
return $this->shipping_costs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ?string $shipping_costs
|
||||
* Sets the shipping costs for an order with this supplier.
|
||||
* @param string|null $shipping_costs A bcmath string with the shipping costs.
|
||||
* @return Supplier
|
||||
*/
|
||||
public function setShippingCosts(?string $shipping_costs) : Supplier
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue