mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 19:58:53 +02:00
Started to move doctrine annotations to attributes (rector automated)
This commit is contained in:
parent
bb1285c35c
commit
0bc4699cdc
73 changed files with 483 additions and 604 deletions
|
@ -44,9 +44,7 @@ namespace App\Entity\LabelSystem;
|
|||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Embeddable()
|
||||
*/
|
||||
#[ORM\Embeddable]
|
||||
class LabelOptions
|
||||
{
|
||||
public const BARCODE_TYPES = ['none', /*'ean8',*/ 'qr', 'code39', 'datamatrix', 'code93', 'code128'];
|
||||
|
@ -57,55 +55,55 @@ class LabelOptions
|
|||
|
||||
/**
|
||||
* @var float The page size of the label in mm
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
protected float $width = 50.0;
|
||||
|
||||
/**
|
||||
* @var float The page size of the label in mm
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
protected float $height = 30.0;
|
||||
|
||||
/**
|
||||
* @var string The type of the barcode that should be used in the label (e.g. 'qr')
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
protected string $barcode_type = 'none';
|
||||
|
||||
/**
|
||||
* @var string What image should be shown along the
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
protected string $picture_type = 'none';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
protected string $supported_element = 'part';
|
||||
|
||||
/**
|
||||
* @var string any additional CSS for the label
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
protected string $additional_css = '';
|
||||
|
||||
/** @var string The mode that will be used to interpret the lines
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::LINES_MODES)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
protected string $lines_mode = 'html';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
protected string $lines = '';
|
||||
|
||||
public function getWidth(): float
|
||||
|
|
|
@ -48,42 +48,41 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity(repositoryClass="App\Repository\LabelProfileRepository")
|
||||
* @ORM\Table(name="label_profiles")
|
||||
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"})
|
||||
*/
|
||||
#[UniqueEntity(['name', 'options.supported_element'])]
|
||||
#[ORM\Entity(repositoryClass: 'App\Repository\LabelProfileRepository')]
|
||||
#[ORM\EntityListeners(['App\EntityListeners\TreeCacheInvalidationListener'])]
|
||||
#[ORM\Table(name: 'label_profiles')]
|
||||
class LabelProfile extends AttachmentContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @var Collection<int, LabelAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\LabelAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: 'App\Entity\Attachments\LabelAttachment', mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
* @var LabelOptions
|
||||
* @ORM\Embedded(class="LabelOptions")
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\Embedded(class: 'LabelOptions')]
|
||||
protected LabelOptions $options;
|
||||
|
||||
/**
|
||||
* @var string The comment info for this element
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool determines, if this label profile should be shown in the dropdown quick menu
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
protected bool $show_in_dropdown = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
parent::__construct();
|
||||
$this->options = new LabelOptions();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue