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

@ -29,52 +29,51 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* This abstract class is used for companies like suppliers or manufacturers.
*
* @ORM\MappedSuperclass()
*/
#[ORM\MappedSuperclass]
abstract class AbstractCompany extends AbstractPartsContainingDBElement
{
/**
* @var string The address of the company
* @ORM\Column(type="string")
*/
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $address = '';
/**
* @var string The phone number of the company
* @ORM\Column(type="string")
*/
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $phone_number = '';
/**
* @var string The fax number of the company
* @ORM\Column(type="string")
*/
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $fax_number = '';
/**
* @var string The email address of the company
* @ORM\Column(type="string")
*/
#[Assert\Email]
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $email_address = '';
/**
* @var string The website of the company
* @ORM\Column(type="string")
*/
#[Assert\Url]
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $website = '';
/**
* @var string
* @ORM\Column(type="string")
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $auto_product_url = '';
/********************************************************************************

View file

@ -34,19 +34,18 @@ use Symfony\Component\Serializer\Annotation\Groups;
* (except special tables like "internal"...)
* Every database table which are managed with this class (or a subclass of it)
* 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'])]
#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\DBElementRepository')]
abstract class AbstractDBElement implements JsonSerializable
{
/** @var int|null The Identification number for this part. This value is unique for the element in this table.
* Null if the element is not saved to DB yet.
* @ORM\Column(type="integer")
* @ORM\Id()
* @ORM\GeneratedValue()
*/
#[Groups(['full'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $id = null;
public function __clone()

View file

@ -30,20 +30,19 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* All subclasses of this class have an attribute "name".
*
* @ORM\MappedSuperclass(repositoryClass="App\Repository\NamedDBElement")
* @ORM\HasLifecycleCallbacks()
*/
#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\NamedDBElement')]
#[ORM\HasLifecycleCallbacks]
abstract class AbstractNamedDBElement extends AbstractDBElement implements NamedElementInterface, TimeStampableInterface
{
use TimestampTrait;
/**
* @var string the name of this element
* @ORM\Column(type="string")
*/
#[Assert\NotBlank]
#[Groups(['simple', 'extended', 'full', 'import'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
protected string $name = '';
/******************************************************************************

View file

@ -28,9 +28,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
/**
* Class PartsContainingDBElement.
*
* @ORM\MappedSuperclass(repositoryClass="App\Repository\AbstractPartsContainingRepository")
*/
#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\AbstractPartsContainingRepository')]
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
{
#[Groups(['full'])]

View file

@ -43,11 +43,11 @@ use Symfony\Component\Serializer\Annotation\Groups;
* It's allowed to have instances of root elements, but if you try to change
* an attribute of a root element, you will get an exception!
*
* @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository")
*
* @ORM\EntityListeners({"App\EntityListeners\TreeCacheInvalidationListener"})
*/
#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')]
#[ORM\MappedSuperclass(repositoryClass: 'App\Repository\StructuralDBElementRepository')]
#[ORM\EntityListeners(['App\EntityListeners\TreeCacheInvalidationListener'])]
abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
{
use ParametersTrait;
@ -61,17 +61,17 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
/**
* @var string The comment info for this element
* @ORM\Column(type="text")
*/
#[Groups(['full', 'import'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
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'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
protected bool $not_selectable = false;
/**

View file

@ -33,10 +33,10 @@ 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')]
#[ORM\ManyToOne(targetEntity: 'App\Entity\Attachments\Attachment')]
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
protected ?Attachment $master_picture_attachment = null;
/**