mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-29 21:14:29 +02:00
Applied rector rules up to symfony 6.2
This commit is contained in:
parent
88ea920dfb
commit
a43af180a7
145 changed files with 563 additions and 889 deletions
|
@ -37,38 +37,38 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
/**
|
||||
* @var string The address of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected string $address = '';
|
||||
|
||||
/**
|
||||
* @var string The phone number of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected string $phone_number = '';
|
||||
|
||||
/**
|
||||
* @var string The fax number of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected string $fax_number = '';
|
||||
|
||||
/**
|
||||
* @var string The email address of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Email()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Email]
|
||||
#[Groups(['full'])]
|
||||
protected string $email_address = '';
|
||||
|
||||
/**
|
||||
* @var string The website of the company
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\Url()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full'])]
|
||||
protected string $website = '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,41 +36,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
* must have the table row "id"!! The ID is the unique key to identify the elements.
|
||||
*
|
||||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\DBElementRepository")
|
||||
*
|
||||
* @DiscriminatorMap(typeProperty="type", mapping={
|
||||
* "attachment_type" = "App\Entity\Attachments\AttachmentType",
|
||||
* "attachment" = "App\Entity\Attachments\Attachment",
|
||||
* "attachment_type_attachment" = "App\Entity\Attachments\AttachmentTypeAttachment",
|
||||
* "category_attachment" = "App\Entity\Attachments\CategoryAttachment",
|
||||
* "currency_attachment" = "App\Entity\Attachments\CurrencyAttachment",
|
||||
* "footprint_attachment" = "App\Entity\Attachments\FootprintAttachment",
|
||||
* "group_attachment" = "App\Entity\Attachments\GroupAttachment",
|
||||
* "label_attachment" = "App\Entity\Attachments\LabelAttachment",
|
||||
* "manufacturer_attachment" = "App\Entity\Attachments\ManufacturerAttachment",
|
||||
* "measurement_unit_attachment" = "App\Entity\Attachments\MeasurementUnitAttachment",
|
||||
* "part_attachment" = "App\Entity\Attachments\PartAttachment",
|
||||
* "project_attachment" = "App\Entity\Attachments\ProjectAttachment",
|
||||
* "storelocation_attachment" = "App\Entity\Attachments\StorelocationAttachment",
|
||||
* "supplier_attachment" = "App\Entity\Attachments\SupplierAttachment",
|
||||
* "user_attachment" = "App\Entity\Attachments\UserAttachment",
|
||||
* "category" = "App\Entity\Parts\Category",
|
||||
* "project" = "App\Entity\ProjectSystem\Project",
|
||||
* "project_bom_entry" = "App\Entity\ProjectSystem\ProjectBOMEntry",
|
||||
* "footprint" = "App\Entity\Parts\Footprint",
|
||||
* "group" = "App\Entity\UserSystem\Group",
|
||||
* "manufacturer" = "App\Entity\Parts\Manufacturer",
|
||||
* "orderdetail" = "App\Entity\PriceInformations\Orderdetail",
|
||||
* "part" = "App\Entity\Parts\Part",
|
||||
* "pricedetail" = "App\Entity\PriceInformation\Pricedetail",
|
||||
* "storelocation" = "App\Entity\Parts\Storelocation",
|
||||
* "part_lot" = "App\Entity\Parts\PartLot",
|
||||
* "currency" = "App\Entity\PriceInformations\Currency",
|
||||
* "measurement_unit" = "App\Entity\Parts\MeasurementUnit",
|
||||
* "parameter" = "App\Entity\Parts\AbstractParameter",
|
||||
* "supplier" = "App\Entity\Parts\Supplier",
|
||||
* "user" = "App\Entity\UserSystem\User"
|
||||
* })
|
||||
*/
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => 'App\Entity\Attachments\AttachmentType', 'attachment' => 'App\Entity\Attachments\Attachment', 'attachment_type_attachment' => 'App\Entity\Attachments\AttachmentTypeAttachment', 'category_attachment' => 'App\Entity\Attachments\CategoryAttachment', 'currency_attachment' => 'App\Entity\Attachments\CurrencyAttachment', 'footprint_attachment' => 'App\Entity\Attachments\FootprintAttachment', 'group_attachment' => 'App\Entity\Attachments\GroupAttachment', 'label_attachment' => 'App\Entity\Attachments\LabelAttachment', 'manufacturer_attachment' => 'App\Entity\Attachments\ManufacturerAttachment', 'measurement_unit_attachment' => 'App\Entity\Attachments\MeasurementUnitAttachment', 'part_attachment' => 'App\Entity\Attachments\PartAttachment', 'project_attachment' => 'App\Entity\Attachments\ProjectAttachment', 'storelocation_attachment' => 'App\Entity\Attachments\StorelocationAttachment', 'supplier_attachment' => 'App\Entity\Attachments\SupplierAttachment', 'user_attachment' => 'App\Entity\Attachments\UserAttachment', 'category' => 'App\Entity\Parts\Category', 'project' => 'App\Entity\ProjectSystem\Project', 'project_bom_entry' => 'App\Entity\ProjectSystem\ProjectBOMEntry', 'footprint' => 'App\Entity\Parts\Footprint', 'group' => 'App\Entity\UserSystem\Group', 'manufacturer' => 'App\Entity\Parts\Manufacturer', 'orderdetail' => 'App\Entity\PriceInformations\Orderdetail', 'part' => 'App\Entity\Parts\Part', 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => 'App\Entity\Parts\Storelocation', 'part_lot' => 'App\Entity\Parts\PartLot', 'currency' => 'App\Entity\PriceInformations\Currency', 'measurement_unit' => 'App\Entity\Parts\MeasurementUnit', 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => 'App\Entity\Parts\Supplier', 'user' => 'App\Entity\UserSystem\User'])]
|
||||
abstract class AbstractDBElement implements JsonSerializable
|
||||
{
|
||||
/** @var int|null The Identification number for this part. This value is unique for the element in this table.
|
||||
|
@ -78,8 +45,8 @@ abstract class AbstractDBElement implements JsonSerializable
|
|||
* @ORM\Column(type="integer")
|
||||
* @ORM\Id()
|
||||
* @ORM\GeneratedValue()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
protected ?int $id = null;
|
||||
|
||||
public function __clone()
|
||||
|
|
|
@ -41,9 +41,9 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
|
|||
/**
|
||||
* @var string the name of this element
|
||||
* @ORM\Column(type="string")
|
||||
* @Assert\NotBlank()
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
*/
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
protected string $name = '';
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -33,6 +33,6 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
*/
|
||||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
{
|
||||
/** @Groups({"full"}) */
|
||||
#[Groups(['full'])]
|
||||
protected Collection $parameters;
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
*
|
||||
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"})
|
||||
*
|
||||
* @UniqueEntity(fields={"name", "parent"}, ignoreNull=false, message="structural.entity.unique_name")
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')]
|
||||
abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||
{
|
||||
use ParametersTrait;
|
||||
|
@ -63,16 +62,16 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* @var string The comment info for this element
|
||||
* @ORM\Column(type="text")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool If this property is set, this element can not be selected for part properties.
|
||||
* Useful if this element should be used only for grouping, sorting.
|
||||
* @ORM\Column(type="boolean")
|
||||
* @Groups({"full", "import"})
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
protected bool $not_selectable = false;
|
||||
|
||||
/**
|
||||
|
@ -85,15 +84,15 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
* subclasses.
|
||||
*
|
||||
* @var AbstractStructuralDBElement[]|Collection
|
||||
* @Groups({"include_children"})
|
||||
*/
|
||||
#[Groups(['include_children'])]
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @var AbstractStructuralDBElement
|
||||
* @NoneOfItsChildren()
|
||||
* @Groups({"include_parents", "import"})
|
||||
*/
|
||||
#[Groups(['include_parents', 'import'])]
|
||||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/** @var string[] all names of all parent elements as an array of strings,
|
||||
|
|
|
@ -35,8 +35,8 @@ trait MasterAttachmentTrait
|
|||
* @var Attachment|null
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
|
||||
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true)
|
||||
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
|
||||
*/
|
||||
#[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')]
|
||||
protected ?Attachment $master_picture_attachment = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,15 +34,15 @@ trait TimestampTrait
|
|||
/**
|
||||
* @var DateTime|null the date when this element was modified the last time
|
||||
* @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
protected ?DateTime $lastModified = null;
|
||||
|
||||
/**
|
||||
* @var DateTime|null the date when this element was created
|
||||
* @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"})
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
protected ?DateTime $addedDate = null;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue