mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Fixed coding style.
This commit is contained in:
parent
24939f2342
commit
fd61c8d9e2
129 changed files with 962 additions and 1091 deletions
|
@ -25,7 +25,6 @@ namespace App\Entity\Parts;
|
|||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\CategoryParameter;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
@ -131,7 +130,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $partname_hint
|
||||
* @return Category
|
||||
*/
|
||||
public function setPartnameHint(string $partname_hint): self
|
||||
|
@ -147,7 +145,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $partname_regex
|
||||
* @return Category
|
||||
*/
|
||||
public function setPartnameRegex(string $partname_regex): self
|
||||
|
@ -163,7 +160,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_footprints
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableFootprints(bool $disable_footprints): self
|
||||
|
@ -179,7 +175,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_manufacturers
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableManufacturers(bool $disable_manufacturers): self
|
||||
|
@ -195,7 +190,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_autodatasheets
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableAutodatasheets(bool $disable_autodatasheets): self
|
||||
|
@ -211,7 +205,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_properties
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableProperties(bool $disable_properties): self
|
||||
|
@ -227,7 +220,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $default_description
|
||||
* @return Category
|
||||
*/
|
||||
public function setDefaultDescription(string $default_description): self
|
||||
|
@ -243,7 +235,6 @@ class Category extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $default_comment
|
||||
* @return Category
|
||||
*/
|
||||
public function setDefaultComment(string $default_comment): self
|
||||
|
|
|
@ -52,7 +52,6 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\FootprintParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
|
|
@ -52,7 +52,6 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\ManufacturerAttachment;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\ManufacturerParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
|
|
@ -44,7 +44,6 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\MeasurementUnitAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\MeasurementUnitParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -148,7 +147,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $isInteger
|
||||
* @return MeasurementUnit
|
||||
*/
|
||||
public function setIsInteger(bool $isInteger): self
|
||||
|
@ -164,7 +162,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $usesSIPrefixes
|
||||
* @return MeasurementUnit
|
||||
*/
|
||||
public function setUseSIPrefix(bool $usesSIPrefixes): self
|
||||
|
|
|
@ -52,9 +52,8 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Parameters\ParametersTrait;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\ParametersTrait;
|
||||
use App\Entity\Parameters\PartParameter;
|
||||
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
|
||||
use App\Entity\Parts\PartTraits\BasicPropertyTrait;
|
||||
|
@ -145,6 +144,26 @@ class Part extends AttachmentContainingDBElement
|
|||
$this->parameters = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
if ($this->id) {
|
||||
//Deep clone part lots
|
||||
$lots = $this->partLots;
|
||||
$this->partLots = new ArrayCollection();
|
||||
foreach ($lots as $lot) {
|
||||
$this->addPartLot(clone $lot);
|
||||
}
|
||||
|
||||
//Deep clone order details
|
||||
$orderdetails = $this->orderdetails;
|
||||
$this->orderdetails = new ArrayCollection();
|
||||
foreach ($orderdetails as $orderdetail) {
|
||||
$this->addOrderdetail(clone $orderdetail);
|
||||
}
|
||||
}
|
||||
parent::__clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
|
@ -167,24 +186,4 @@ class Part extends AttachmentContainingDBElement
|
|||
{
|
||||
return $this->devices;
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
if ($this->id) {
|
||||
//Deep clone part lots
|
||||
$lots = $this->partLots;
|
||||
$this->partLots = new ArrayCollection();
|
||||
foreach ($lots as $lot) {
|
||||
$this->addPartLot(clone $lot);
|
||||
}
|
||||
|
||||
//Deep clone order details
|
||||
$orderdetails = $this->orderdetails;
|
||||
$this->orderdetails = new ArrayCollection();
|
||||
foreach ($orderdetails as $orderdetail) {
|
||||
$this->addOrderdetail(clone $orderdetail);
|
||||
}
|
||||
}
|
||||
parent::__clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
*/
|
||||
protected $part;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
if ($this->id) {
|
||||
$this->addedDate = null;
|
||||
}
|
||||
parent::__clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID as an string, defined by the element class.
|
||||
* This should have a form like P000014, for a part with ID 14.
|
||||
|
@ -161,7 +169,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
/**
|
||||
* Sets the description of the part lot.
|
||||
*
|
||||
* @param string $description
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setDescription(string $description): self
|
||||
|
@ -184,7 +191,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
/**
|
||||
* Sets the comment for this part lot.
|
||||
*
|
||||
* @param string $comment
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setComment(string $comment): self
|
||||
|
@ -231,7 +237,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
/**
|
||||
* Sets the storage location, where this part lot is stored.
|
||||
*
|
||||
* @param Storelocation|null $storage_location
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setStorageLocation(?Storelocation $storage_location): self
|
||||
|
@ -254,8 +259,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
/**
|
||||
* Sets the part that is stored in this part lot.
|
||||
*
|
||||
* @param Part $part
|
||||
*
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setPart(Part $part): self
|
||||
|
@ -278,7 +281,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
/**
|
||||
* Set the unknown instock status of this part lot.
|
||||
*
|
||||
* @param bool $instock_unknown
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setInstockUnknown(bool $instock_unknown): self
|
||||
|
@ -316,7 +318,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $needs_refill
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setNeedsRefill(bool $needs_refill): self
|
||||
|
@ -325,12 +326,4 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
if($this->id) {
|
||||
$this->addedDate = null;
|
||||
}
|
||||
parent::__clone();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ trait AdvancedPropertyTrait
|
|||
* Sets a comma separated list of tags, that are assigned to this part.
|
||||
*
|
||||
* @param string $tags The new tags
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTags(string $tags): self
|
||||
|
@ -129,6 +130,7 @@ trait AdvancedPropertyTrait
|
|||
* Sett to null, if the mass is unknown.
|
||||
*
|
||||
* @param float|null $mass the new mass
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMass(?float $mass): self
|
||||
|
|
|
@ -164,6 +164,7 @@ trait BasicPropertyTrait
|
|||
* Sets the description of this part.
|
||||
*
|
||||
* @param string $new_description the new description
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription(?string $new_description): self
|
||||
|
@ -177,6 +178,7 @@ trait BasicPropertyTrait
|
|||
* Sets the comment property of this part.
|
||||
*
|
||||
* @param string $new_comment the new comment
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setComment(string $new_comment): self
|
||||
|
@ -191,6 +193,7 @@ trait BasicPropertyTrait
|
|||
* The category property is required for every part, so you can not pass null like the other properties (footprints).
|
||||
*
|
||||
* @param Category $category The new category of this part
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCategory(Category $category): self
|
||||
|
@ -205,6 +208,7 @@ trait BasicPropertyTrait
|
|||
*
|
||||
* @param Footprint|null $new_footprint The new footprint of this part. Set to null, if this part should not have
|
||||
* a footprint.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFootprint(?Footprint $new_footprint): self
|
||||
|
@ -219,6 +223,7 @@ trait BasicPropertyTrait
|
|||
*
|
||||
* @param bool $new_favorite_status The new favorite status, that should be applied on this part.
|
||||
* Set this to true, when the part should be a favorite.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFavorite(bool $new_favorite_status): self
|
||||
|
|
|
@ -90,7 +90,7 @@ trait InstockTrait
|
|||
/**
|
||||
* Adds the given part lot, to the list of part lots.
|
||||
* The part lot is assigned to this part.
|
||||
* @param PartLot $lot
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addPartLot(PartLot $lot): self
|
||||
|
@ -105,6 +105,7 @@ trait InstockTrait
|
|||
* Removes the given part lot from the list of part lots.
|
||||
*
|
||||
* @param PartLot $lot the part lot that should be deleted
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function removePartLot(PartLot $lot): self
|
||||
|
@ -126,7 +127,7 @@ trait InstockTrait
|
|||
/**
|
||||
* Sets the measurement unit in which the part's amount should be measured.
|
||||
* Set to null, if the part should be measured in quantities.
|
||||
* @param MeasurementUnit|null $partUnit
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPartUnit(?MeasurementUnit $partUnit): self
|
||||
|
@ -172,7 +173,6 @@ trait InstockTrait
|
|||
* Part Lots that have unknown value or are expired, are not used for this value.
|
||||
*
|
||||
* @return float The amount of parts given in partUnit
|
||||
*
|
||||
*/
|
||||
public function getAmountSum(): float
|
||||
{
|
||||
|
@ -199,6 +199,7 @@ trait InstockTrait
|
|||
* See getPartUnit() for the associated unit.
|
||||
*
|
||||
* @param float $new_minamount the new count of parts which should be in stock at least
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMinAmount(float $new_minamount): self
|
||||
|
|
|
@ -136,7 +136,6 @@ trait ManufacturerTrait
|
|||
* Sets the manufacturing status for this part
|
||||
* See getManufacturingStatus() for valid values.
|
||||
*
|
||||
* @param string $manufacturing_status
|
||||
* @return Part
|
||||
*/
|
||||
public function setManufacturingStatus(string $manufacturing_status): self
|
||||
|
@ -167,7 +166,6 @@ trait ManufacturerTrait
|
|||
/**
|
||||
* Sets the manufacturer product number (MPN) for this part.
|
||||
*
|
||||
* @param string $manufacturer_product_number
|
||||
* @return Part
|
||||
*/
|
||||
public function setManufacturerProductNumber(string $manufacturer_product_number): self
|
||||
|
@ -182,6 +180,7 @@ trait ManufacturerTrait
|
|||
* Set to "" if this part should use the automatically URL based on its manufacturer.
|
||||
*
|
||||
* @param string $new_url The new url
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setManufacturerProductURL(string $new_url): self
|
||||
|
@ -196,6 +195,7 @@ trait ManufacturerTrait
|
|||
*
|
||||
* @param Manufacturer|null $new_manufacturer The new Manufacturer of this part. Set to null, if this part should
|
||||
* not have a manufacturer.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setManufacturer(?Manufacturer $new_manufacturer): self
|
||||
|
|
|
@ -144,6 +144,7 @@ trait OrderTrait
|
|||
* The orderdetail is assigned to this part.
|
||||
*
|
||||
* @param Orderdetail $orderdetail the orderdetail that should be added
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addOrderdetail(Orderdetail $orderdetail): self
|
||||
|
@ -156,7 +157,7 @@ trait OrderTrait
|
|||
|
||||
/**
|
||||
* Removes the given orderdetail from the list of orderdetails.
|
||||
* @param Orderdetail $orderdetail
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function removeOrderdetail(Orderdetail $orderdetail): self
|
||||
|
@ -177,6 +178,7 @@ trait OrderTrait
|
|||
* (if the part has exactly one orderdetails,
|
||||
* set this orderdetails as order orderdetails.
|
||||
* Otherwise, set "no order orderdetails")
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setManualOrder(bool $new_manual_order, int $new_order_quantity = 1, ?Orderdetail $new_order_orderdetail = null): self
|
||||
|
|
|
@ -52,7 +52,6 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\StorelocationAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\StorelocationParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -153,7 +152,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $only_single_part
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setOnlySinglePart(bool $only_single_part): self
|
||||
|
@ -174,7 +172,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $limit_to_existing_parts
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setLimitToExistingParts(bool $limit_to_existing_parts): self
|
||||
|
@ -193,7 +190,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param MeasurementUnit|null $storage_type
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setStorageType(?MeasurementUnit $storage_type): self
|
||||
|
|
|
@ -52,7 +52,6 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\SupplierAttachment;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use App\Entity\Parameters\DeviceParameter;
|
||||
use App\Entity\Parameters\SupplierParameter;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
|
@ -134,7 +133,6 @@ class Supplier extends AbstractCompany
|
|||
/**
|
||||
* Sets the default currency.
|
||||
*
|
||||
* @param Currency|null $default_currency
|
||||
* @return Supplier
|
||||
*/
|
||||
public function setDefaultCurrency(?Currency $default_currency): self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue