From a4802e290f56e4ccb2965d0985de391206789e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Wed, 1 Apr 2020 15:37:06 +0200 Subject: [PATCH] Order attachments and part lots by a reasonable parameter. --- src/Entity/Attachments/AttachmentType.php | 1 + src/Entity/Devices/Device.php | 1 + src/Entity/Parts/Category.php | 1 + src/Entity/Parts/Footprint.php | 1 + src/Entity/Parts/Manufacturer.php | 1 + src/Entity/Parts/MeasurementUnit.php | 1 + src/Entity/Parts/Part.php | 1 + src/Entity/Parts/PartTraits/InstockTrait.php | 1 + src/Entity/Parts/PartTraits/OrderTrait.php | 2 ++ src/Entity/Parts/Storelocation.php | 1 + src/Entity/Parts/Supplier.php | 1 + src/Entity/PriceInformations/Currency.php | 1 + src/Entity/UserSystem/Group.php | 1 + src/Entity/UserSystem/User.php | 1 + 14 files changed, 15 insertions(+) diff --git a/src/Entity/Attachments/AttachmentType.php b/src/Entity/Attachments/AttachmentType.php index dfb08385..cef36d79 100644 --- a/src/Entity/Attachments/AttachmentType.php +++ b/src/Entity/Attachments/AttachmentType.php @@ -58,6 +58,7 @@ class AttachmentType extends AbstractStructuralDBElement /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/Devices/Device.php b/src/Entity/Devices/Device.php index 8a1dfd0f..7b15e971 100644 --- a/src/Entity/Devices/Device.php +++ b/src/Entity/Devices/Device.php @@ -95,6 +95,7 @@ class Device extends AbstractPartsContainingDBElement /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) */ protected $attachments; diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index c40b7066..06d33aab 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -103,6 +103,7 @@ class Category extends AbstractPartsContainingDBElement /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/Parts/Footprint.php b/src/Entity/Parts/Footprint.php index 90042889..d48ce706 100644 --- a/src/Entity/Parts/Footprint.php +++ b/src/Entity/Parts/Footprint.php @@ -83,6 +83,7 @@ class Footprint extends AbstractPartsContainingDBElement /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/Parts/Manufacturer.php b/src/Entity/Parts/Manufacturer.php index f61a33d0..0411ac6f 100644 --- a/src/Entity/Parts/Manufacturer.php +++ b/src/Entity/Parts/Manufacturer.php @@ -83,6 +83,7 @@ class Manufacturer extends AbstractCompany /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index 5f9008f7..5c8fc080 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -100,6 +100,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index 840e9f39..02a23472 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -121,6 +121,7 @@ class Part extends AttachmentContainingDBElement * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ColumnSecurity(type="collection", prefix="attachments") + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php index 9678ac96..2eb596eb 100644 --- a/src/Entity/Parts/PartTraits/InstockTrait.php +++ b/src/Entity/Parts/PartTraits/InstockTrait.php @@ -57,6 +57,7 @@ trait InstockTrait * @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) * @Assert\Valid() * @ColumnSecurity(type="collection", prefix="lots") + * @ORM\OrderBy({"amount" = "DESC"}) */ protected $partLots; diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php index 8b022e67..d5f7237f 100644 --- a/src/Entity/Parts/PartTraits/OrderTrait.php +++ b/src/Entity/Parts/PartTraits/OrderTrait.php @@ -44,6 +44,7 @@ namespace App\Entity\Parts\PartTraits; use App\Entity\PriceInformations\Orderdetail; use App\Security\Annotations\ColumnSecurity; +use Doctrine\ORM\Mapping as ORM; use function count; use Doctrine\Common\Collections\Collection; @@ -57,6 +58,7 @@ trait OrderTrait * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) * @Assert\Valid() * @ColumnSecurity(prefix="orderdetails", type="collection") + * @ORM\OrderBy({"supplier" = "ASC", "supplierpartnr" = "ASC"}) */ protected $orderdetails; diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index d7e5d25a..add96b45 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -94,6 +94,7 @@ class Storelocation extends AbstractPartsContainingDBElement /** @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) * @Assert\Valid() */ diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index a5b02781..06af968c 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -111,6 +111,7 @@ class Supplier extends AbstractCompany /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\SupplierAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index d6d8b49e..cfef3566 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -90,6 +90,7 @@ class Currency extends AbstractStructuralDBElement /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/UserSystem/Group.php b/src/Entity/UserSystem/Group.php index 36278e7b..4164359d 100644 --- a/src/Entity/UserSystem/Group.php +++ b/src/Entity/UserSystem/Group.php @@ -83,6 +83,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) * @Assert\Valid() */ protected $attachments; diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index db504219..e7b35ada 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -229,6 +229,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\UserAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\OrderBy({"attachment_type" = "ASC", "name" = "ASC"}) */ protected $attachments;