Applied rector rules up to symfony 6.2

This commit is contained in:
Jan Böhmer 2023-05-28 01:21:05 +02:00
parent 88ea920dfb
commit a43af180a7
145 changed files with 563 additions and 889 deletions

View file

@ -38,13 +38,13 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* This entity describes a currency that can be used for price information.
*
* @UniqueEntity("iso_code")
* @ORM\Entity()
* @ORM\Table(name="currencies", indexes={
* @ORM\Index(name="currency_idx_name", columns={"name"}),
* @ORM\Index(name="currency_idx_parent_name", columns={"parent_id", "name"}),
* })
*/
#[UniqueEntity('iso_code')]
class Currency extends AbstractStructuralDBElement
{
public const PRICE_SCALE = 5;
@ -60,9 +60,9 @@ class Currency extends AbstractStructuralDBElement
/**
* @var string the 3-letter ISO code of the currency
* @ORM\Column(type="string")
* @Assert\Currency()
* @Groups({"extended", "full", "import"})
*/
#[Assert\Currency]
#[Groups(['extended', 'full', 'import'])]
protected string $iso_code = "";
/**
@ -81,15 +81,15 @@ class Currency extends AbstractStructuralDBElement
* @var Collection<int, CurrencyAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"name" = "ASC"})
* @Assert\Valid()
*/
#[Assert\Valid]
protected Collection $attachments;
/** @var Collection<int, CurrencyParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
* @Assert\Valid()
*/
#[Assert\Valid]
protected Collection $parameters;
/** @var Collection<int, Pricedetail>

View file

@ -45,57 +45,57 @@ use Symfony\Component\Validator\Constraints as Assert;
* })
* @ORM\Entity()
* @ORM\HasLifecycleCallbacks()
* @UniqueEntity({"supplierpartnr", "supplier", "part"})
*/
#[UniqueEntity(['supplierpartnr', 'supplier', 'part'])]
class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface
{
use TimestampTrait;
/**
* @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
* @ORM\OrderBy({"min_discount_quantity" = "ASC"})
* @Groups({"extended", "full", "import"})
*/
#[Assert\Valid]
#[Groups(['extended', 'full', 'import'])]
protected Collection $pricedetails;
/**
* @var string
* @ORM\Column(type="string")
* @Groups({"extended", "full", "import"})
*/
#[Groups(['extended', 'full', 'import'])]
protected string $supplierpartnr = '';
/**
* @var bool
* @ORM\Column(type="boolean")
* @Groups({"extended", "full", "import"})
*/
#[Groups(['extended', 'full', 'import'])]
protected bool $obsolete = false;
/**
* @var string
* @ORM\Column(type="string")
* @Assert\Url()
* @Groups({"full", "import"})
*/
#[Assert\Url]
#[Groups(['full', 'import'])]
protected string $supplier_product_url = '';
/**
* @var Part|null
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails")
* @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
#[Assert\NotNull]
protected ?Part $part = null;
/**
* @var Supplier|null
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails")
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id")
* @Assert\NotNull(message="validator.orderdetail.supplier_must_not_be_null")
* @Groups({"extended", "full", "import"})
*/
#[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')]
#[Groups(['extended', 'full', 'import'])]
protected ?Supplier $supplier = null;
public function __construct()

View file

@ -44,8 +44,8 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Index(name="pricedetails_idx_min_discount_price_qty", columns={"min_discount_quantity", "price_related_quantity"}),
* })
* @ORM\HasLifecycleCallbacks()
* @UniqueEntity(fields={"min_discount_quantity", "orderdetail"})
*/
#[UniqueEntity(fields: ['min_discount_quantity', 'orderdetail'])]
class Pricedetail extends AbstractDBElement implements TimeStampableInterface
{
use TimestampTrait;
@ -56,8 +56,8 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @var BigDecimal The price related to the detail. (Given in the selected currency)
* @ORM\Column(type="big_decimal", precision=11, scale=5)
* @BigDecimalPositive()
* @Groups({"extended", "full"})
*/
#[Groups(['extended', 'full'])]
protected BigDecimal $price;
/**
@ -66,24 +66,24 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @ORM\ManyToOne(targetEntity="Currency", inversedBy="pricedetails")
* @ORM\JoinColumn(name="id_currency", referencedColumnName="id", nullable=true)
* @Selectable()
* @Groups({"extended", "full", "import"})
*/
#[Groups(['extended', 'full', 'import'])]
protected ?Currency $currency = null;
/**
* @var float
* @ORM\Column(type="float")
* @Assert\Positive()
* @Groups({"extended", "full", "import"})
*/
#[Assert\Positive]
#[Groups(['extended', 'full', 'import'])]
protected float $price_related_quantity = 1.0;
/**
* @var float
* @ORM\Column(type="float")
* @Assert\Positive()
* @Groups({"extended", "full", "import"})
*/
#[Assert\Positive]
#[Groups(['extended', 'full', 'import'])]
protected float $min_discount_quantity = 1.0;
/**
@ -96,8 +96,8 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
* @var Orderdetail|null
* @ORM\ManyToOne(targetEntity="Orderdetail", inversedBy="pricedetails")
* @ORM\JoinColumn(name="orderdetails_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
* @Assert\NotNull()
*/
#[Assert\NotNull]
protected ?Orderdetail $orderdetail = null;
public function __construct()