Started to move doctrine annotations to attributes (rector automated)

This commit is contained in:
Jan Böhmer 2023-05-28 01:33:45 +02:00
parent bb1285c35c
commit 0bc4699cdc
73 changed files with 483 additions and 604 deletions

View file

@ -51,29 +51,14 @@ use Symfony\Component\Validator\Constraints as Assert;
use function sprintf;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
* @ORM\Table("parameters", indexes={
* @ORM\Index(name="parameter_name_idx", columns={"name"}),
* @ORM\Index(name="parameter_group_idx", columns={"param_group"}),
* @ORM\Index(name="parameter_type_element_idx", columns={"type", "element_id"})
* })
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="type", type="smallint")
* @ORM\DiscriminatorMap({
* 0 = "CategoryParameter",
* 1 = "CurrencyParameter",
* 2 = "ProjectParameter",
* 3 = "FootprintParameter",
* 4 = "GroupParameter",
* 5 = "ManufacturerParameter",
* 6 = "MeasurementUnitParameter",
* 7 = "PartParameter",
* 8 = "StorelocationParameter",
* 9 = "SupplierParameter",
* 10 = "AttachmentTypeParameter"
* })
*/
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'type', type: 'smallint')]
#[ORM\DiscriminatorMap([0 => 'CategoryParameter', 1 => 'CurrencyParameter', 2 => 'ProjectParameter', 3 => 'FootprintParameter', 4 => 'GroupParameter', 5 => 'ManufacturerParameter', 6 => 'MeasurementUnitParameter', 7 => 'PartParameter', 8 => 'StorelocationParameter', 9 => 'SupplierParameter', 10 => 'AttachmentTypeParameter'])]
#[ORM\Table('parameters')]
#[ORM\Index(name: 'parameter_name_idx', columns: ['name'])]
#[ORM\Index(name: 'parameter_group_idx', columns: ['param_group'])]
#[ORM\Index(name: 'parameter_type_element_idx', columns: ['type', 'element_id'])]
abstract class AbstractParameter extends AbstractNamedDBElement
{
/**
@ -83,59 +68,59 @@ abstract class AbstractParameter extends AbstractNamedDBElement
/**
* @var string The mathematical symbol for this specification. Can be rendered pretty later. Should be short
* @ORM\Column(type="string", nullable=false)
*/
#[Assert\Length(max: 20)]
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $symbol = '';
/**
* @var float|null the guaranteed minimum value of this property
* @ORM\Column(type="float", nullable=true)
*/
#[Assert\Type(['float', null])]
#[Assert\LessThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.min_lesser_typical')]
#[Assert\LessThan(propertyPath: 'value_max', message: 'parameters.validator.min_lesser_max')]
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
protected ?float $value_min = null;
/**
* @var float|null the typical value of this property
* @ORM\Column(type="float", nullable=true)
*/
#[Assert\Type([null, 'float'])]
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
protected ?float $value_typical = null;
/**
* @var float|null the maximum value of this property
* @ORM\Column(type="float", nullable=true)
*/
#[Assert\Type(['float', null])]
#[Assert\GreaterThanOrEqual(propertyPath: 'value_typical', message: 'parameters.validator.max_greater_typical')]
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
protected ?float $value_max = null;
/**
* @var string The unit in which the value values are given (e.g. V)
* @ORM\Column(type="string", nullable=false)
*/
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $unit = '';
/**
* @var string a text value for the given property
* @ORM\Column(type="string", nullable=false)
*/
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $value_text = '';
/**
* @var string the group this parameter belongs to
* @ORM\Column(type="string", nullable=false, name="param_group")
*/
#[Groups(['full'])]
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'param_group')]
protected string $group = '';
/**

View file

@ -46,17 +46,15 @@ use App\Entity\Base\AbstractDBElement;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class AttachmentTypeParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
/**
* @var AttachmentType the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\AttachmentType', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,17 +46,15 @@ use App\Entity\Parts\Category;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class CategoryParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Category::class;
/**
* @var Category the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Category', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -48,18 +48,17 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a category element.
*
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class CurrencyParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Currency::class;
/**
* @var Currency the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\PriceInformations\Currency', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,18 +46,16 @@ use App\Entity\Parts\Footprint;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class FootprintParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Footprint::class;
/**
* @var Footprint the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Footprint', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,18 +46,16 @@ use App\Entity\UserSystem\Group;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class GroupParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Group::class;
/**
* @var Group the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\Group', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,18 +46,16 @@ use App\Entity\Parts\Manufacturer;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class ManufacturerParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;
/**
* @var Manufacturer the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Manufacturer', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,18 +46,16 @@ use App\Entity\Parts\MeasurementUnit;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class MeasurementUnitParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
/**
* @var MeasurementUnit the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\MeasurementUnit', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,18 +46,16 @@ use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class PartParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Part::class;
/**
* @var Part the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Part', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,18 +46,16 @@ use App\Entity\ProjectSystem\Project;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class ProjectParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Project::class;
/**
* @var Project the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\ProjectSystem\Project', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,18 +46,16 @@ use App\Entity\Parts\Storelocation;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class StorelocationParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
/**
* @var Storelocation the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Storelocation', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}

View file

@ -46,18 +46,16 @@ use App\Entity\Parts\Supplier;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
*/
#[UniqueEntity(fields: ['name', 'group', 'element'])]
#[ORM\Entity(repositoryClass: 'App\Repository\ParameterRepository')]
class SupplierParameter extends AbstractParameter
{
public const ALLOWED_ELEMENT_CLASS = Supplier::class;
/**
* @var Supplier the element this para is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="parameters")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
#[ORM\ManyToOne(targetEntity: 'App\Entity\Parts\Supplier', inversedBy: 'parameters')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AbstractDBElement $element = null;
}