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

@ -34,82 +34,78 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Store location.
*
* @ORM\Entity(repositoryClass="App\Repository\Parts\StorelocationRepository")
* @ORM\Table("`storelocations`", indexes={
* @ORM\Index(name="location_idx_name", columns={"name"}),
* @ORM\Index(name="location_idx_parent_name", columns={"parent_id", "name"}),
* })
*/
#[ORM\Entity(repositoryClass: 'App\Repository\Parts\StorelocationRepository')]
#[ORM\Table('`storelocations`')]
#[ORM\Index(name: 'location_idx_name', columns: ['name'])]
#[ORM\Index(name: 'location_idx_parent_name', columns: ['parent_id', 'name'])]
class Storelocation extends AbstractPartsContainingDBElement
{
/**
* @ORM\OneToMany(targetEntity="Storelocation", mappedBy="parent")
* @ORM\OrderBy({"name" = "ASC"})
* @var Collection
*/
#[ORM\OneToMany(targetEntity: 'Storelocation', mappedBy: 'parent')]
#[ORM\OrderBy(['name' => 'ASC'])]
protected Collection $children;
/**
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
#[ORM\ManyToOne(targetEntity: 'Storelocation', inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id')]
protected ?AbstractStructuralDBElement $parent;
/**
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here
* @ORM\ManyToOne(targetEntity="MeasurementUnit")
* @ORM\JoinColumn(name="storage_type_id", referencedColumnName="id")
*/
#[ORM\ManyToOne(targetEntity: 'MeasurementUnit')]
#[ORM\JoinColumn(name: 'storage_type_id')]
protected ?MeasurementUnit $storage_type = null;
/** @var Collection<int, StorelocationParameter>
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\StorelocationParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
*/
#[Assert\Valid]
#[ORM\OneToMany(targetEntity: 'App\Entity\Parameters\StorelocationParameter', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
protected Collection $parameters;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
#[Groups(['full', 'import'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
protected bool $is_full = false;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
#[Groups(['full', 'import'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
protected bool $only_single_part = false;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
#[Groups(['full', 'import'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
protected bool $limit_to_existing_parts = false;
/**
* @var User|null The owner of this storage location
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User")
* @ORM\JoinColumn(name="id_owner", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
#[Assert\Expression('this.getOwner() == null or this.getOwner().isAnonymousUser() === false', message: 'validator.part_lot.owner_must_not_be_anonymous')]
#[ORM\ManyToOne(targetEntity: 'App\Entity\UserSystem\User')]
#[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')]
protected ?User $owner = null;
/**
* @var bool If this is set to true, only parts lots, which are owned by the same user as the store location are allowed to be stored here.
* @ORM\Column(type="boolean", options={"default":false})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
protected bool $part_owner_must_match = false;
/**
* @var Collection<int, StorelocationAttachment>
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
*/
#[Assert\Valid]
#[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\StorelocationAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
protected Collection $attachments;
/********************************************************************************
@ -248,4 +244,11 @@ class Storelocation extends AbstractPartsContainingDBElement
return $this;
}
public function __construct()
{
parent::__construct();
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
}
}