mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-03 15:04:32 +02:00
Use imports instead of FQNs
This commit is contained in:
parent
f63b6d7207
commit
5629215ce4
179 changed files with 792 additions and 597 deletions
|
@ -22,6 +22,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
use App\Repository\AttachmentRepository;
|
||||
use App\EntityListeners\AttachmentDeleteListener;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -34,11 +37,11 @@ use LogicException;
|
|||
/**
|
||||
* Class Attachment.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\AttachmentRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: AttachmentRepository::class)]
|
||||
#[ORM\InheritanceType('SINGLE_TABLE')]
|
||||
#[ORM\DiscriminatorColumn(name: 'class_name', type: 'string')]
|
||||
#[ORM\DiscriminatorMap(['PartDB\Part' => 'PartAttachment', 'Part' => 'PartAttachment', 'PartDB\Device' => 'ProjectAttachment', 'Device' => 'ProjectAttachment', 'AttachmentType' => 'AttachmentTypeAttachment', 'Category' => 'CategoryAttachment', 'Footprint' => 'FootprintAttachment', 'Manufacturer' => 'ManufacturerAttachment', 'Currency' => 'CurrencyAttachment', 'Group' => 'GroupAttachment', 'MeasurementUnit' => 'MeasurementUnitAttachment', 'Storelocation' => 'StorelocationAttachment', 'Supplier' => 'SupplierAttachment', 'User' => 'UserAttachment', 'LabelProfile' => 'LabelAttachment'])]
|
||||
#[ORM\EntityListeners([\App\EntityListeners\AttachmentDeleteListener::class])]
|
||||
#[ORM\EntityListeners([AttachmentDeleteListener::class])]
|
||||
#[ORM\Table(name: '`attachments`')]
|
||||
#[ORM\Index(name: 'attachments_idx_id_element_id_class_name', columns: ['id', 'element_id', 'class_name'])]
|
||||
#[ORM\Index(name: 'attachments_idx_class_name_id', columns: ['class_name', 'id'])]
|
||||
|
@ -78,13 +81,13 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
/**
|
||||
* @var string|null the original filename the file had, when the user uploaded it
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, nullable: true)]
|
||||
protected ?string $original_filename = null;
|
||||
|
||||
/**
|
||||
* @var string The path to the file relative to a placeholder path like %MEDIA%
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'path')]
|
||||
#[ORM\Column(type: Types::STRING, name: 'path')]
|
||||
protected string $path = '';
|
||||
|
||||
/**
|
||||
|
@ -92,7 +95,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
*/
|
||||
#[Assert\NotBlank(message: 'validator.attachment.name_not_blank')]
|
||||
#[Groups(['simple', 'extended', 'full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $name = '';
|
||||
|
||||
/**
|
||||
|
@ -103,7 +106,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $show_in_table = false;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\AttachmentTypeParameter;
|
||||
use App\Validator\Constraints\ValidFileFilter;
|
||||
|
@ -33,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* Class AttachmentType.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\StructuralDBElementRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: StructuralDBElementRepository::class)]
|
||||
#[ORM\Table(name: '`attachment_types`')]
|
||||
#[ORM\Index(name: 'attachment_types_idx_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'attachment_types_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
|
@ -51,33 +53,36 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
* @var string
|
||||
* @ValidFileFilter
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $filetype_filter = '';
|
||||
/**
|
||||
* @var Collection<int, AttachmentTypeAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\AttachmentTypeAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: AttachmentTypeAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, AttachmentTypeParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\AttachmentTypeParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: AttachmentTypeParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\Collection<\App\Entity\Attachments\Attachment>
|
||||
* @var Collection<Attachment>
|
||||
*/
|
||||
/**
|
||||
* @var Collection<Attachment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: 'Attachment', mappedBy: 'attachment_type')]
|
||||
protected \Doctrine\Common\Collections\Collection $attachments_with_type;
|
||||
protected Collection $attachments_with_type;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
parent::__construct();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->attachments_with_type = new ArrayCollection();
|
||||
|
|
|
@ -36,7 +36,7 @@ class AttachmentTypeAttachment extends Attachment
|
|||
/**
|
||||
* @var AttachmentContainingDBElement|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\AttachmentType::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class CategoryAttachment extends Attachment
|
|||
/**
|
||||
* @var AttachmentContainingDBElement|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Category::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class CurrencyAttachment extends Attachment
|
|||
/**
|
||||
* @var Currency|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Currency::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class FootprintAttachment extends Attachment
|
|||
/**
|
||||
* @var Footprint|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Footprint::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Footprint::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class GroupAttachment extends Attachment
|
|||
/**
|
||||
* @var Group|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\Group::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Group::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class LabelAttachment extends Attachment
|
|||
/**
|
||||
* @var LabelProfile the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\LabelSystem\LabelProfile::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: LabelProfile::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class ManufacturerAttachment extends Attachment
|
|||
/**
|
||||
* @var Manufacturer|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Manufacturer::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Manufacturer::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class MeasurementUnitAttachment extends Attachment
|
|||
/**
|
||||
* @var Manufacturer|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\MeasurementUnit::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: MeasurementUnit::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class PartAttachment extends Attachment
|
|||
/**
|
||||
* @var Part the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class ProjectAttachment extends Attachment
|
|||
/**
|
||||
* @var Project|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class StorelocationAttachment extends Attachment
|
|||
/**
|
||||
* @var Storelocation|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Storelocation::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class SupplierAttachment extends Attachment
|
|||
/**
|
||||
* @var Supplier|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class UserAttachment extends Attachment
|
|||
/**
|
||||
* @var User|null the element this attachment is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'attachments')]
|
||||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'attachments')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use function is_string;
|
||||
|
@ -37,21 +38,21 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
* @var string The address of the company
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $address = '';
|
||||
|
||||
/**
|
||||
* @var string The phone number of the company
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $phone_number = '';
|
||||
|
||||
/**
|
||||
* @var string The fax number of the company
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $fax_number = '';
|
||||
|
||||
/**
|
||||
|
@ -59,7 +60,7 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
#[Assert\Email]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $email_address = '';
|
||||
|
||||
/**
|
||||
|
@ -67,13 +68,13 @@ abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $website = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $auto_product_url = '';
|
||||
|
||||
/********************************************************************************
|
||||
|
|
|
@ -22,6 +22,37 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentTypeAttachment;
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
use App\Entity\Attachments\LabelAttachment;
|
||||
use App\Entity\Attachments\ManufacturerAttachment;
|
||||
use App\Entity\Attachments\MeasurementUnitAttachment;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Attachments\StorelocationAttachment;
|
||||
use App\Entity\Attachments\SupplierAttachment;
|
||||
use App\Entity\Attachments\UserAttachment;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Repository\DBElementRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use JsonSerializable;
|
||||
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
||||
|
@ -35,15 +66,15 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
* 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.
|
||||
*/
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => \App\Entity\Attachments\AttachmentType::class, 'attachment' => \App\Entity\Attachments\Attachment::class, 'attachment_type_attachment' => \App\Entity\Attachments\AttachmentTypeAttachment::class, 'category_attachment' => \App\Entity\Attachments\CategoryAttachment::class, 'currency_attachment' => \App\Entity\Attachments\CurrencyAttachment::class, 'footprint_attachment' => \App\Entity\Attachments\FootprintAttachment::class, 'group_attachment' => \App\Entity\Attachments\GroupAttachment::class, 'label_attachment' => \App\Entity\Attachments\LabelAttachment::class, 'manufacturer_attachment' => \App\Entity\Attachments\ManufacturerAttachment::class, 'measurement_unit_attachment' => \App\Entity\Attachments\MeasurementUnitAttachment::class, 'part_attachment' => \App\Entity\Attachments\PartAttachment::class, 'project_attachment' => \App\Entity\Attachments\ProjectAttachment::class, 'storelocation_attachment' => \App\Entity\Attachments\StorelocationAttachment::class, 'supplier_attachment' => \App\Entity\Attachments\SupplierAttachment::class, 'user_attachment' => \App\Entity\Attachments\UserAttachment::class, 'category' => \App\Entity\Parts\Category::class, 'project' => \App\Entity\ProjectSystem\Project::class, 'project_bom_entry' => \App\Entity\ProjectSystem\ProjectBOMEntry::class, 'footprint' => \App\Entity\Parts\Footprint::class, 'group' => \App\Entity\UserSystem\Group::class, 'manufacturer' => \App\Entity\Parts\Manufacturer::class, 'orderdetail' => \App\Entity\PriceInformations\Orderdetail::class, 'part' => \App\Entity\Parts\Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => \App\Entity\Parts\Storelocation::class, 'part_lot' => \App\Entity\Parts\PartLot::class, 'currency' => \App\Entity\PriceInformations\Currency::class, 'measurement_unit' => \App\Entity\Parts\MeasurementUnit::class, 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => \App\Entity\Parts\Supplier::class, 'user' => \App\Entity\UserSystem\User::class])]
|
||||
#[ORM\MappedSuperclass(repositoryClass: \App\Repository\DBElementRepository::class)]
|
||||
#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => AttachmentType::class, 'attachment' => Attachment::class, 'attachment_type_attachment' => AttachmentTypeAttachment::class, 'category_attachment' => CategoryAttachment::class, 'currency_attachment' => CurrencyAttachment::class, 'footprint_attachment' => FootprintAttachment::class, 'group_attachment' => GroupAttachment::class, 'label_attachment' => LabelAttachment::class, 'manufacturer_attachment' => ManufacturerAttachment::class, 'measurement_unit_attachment' => MeasurementUnitAttachment::class, 'part_attachment' => PartAttachment::class, 'project_attachment' => ProjectAttachment::class, 'storelocation_attachment' => StorelocationAttachment::class, 'supplier_attachment' => SupplierAttachment::class, 'user_attachment' => UserAttachment::class, 'category' => Category::class, 'project' => Project::class, 'project_bom_entry' => ProjectBOMEntry::class, 'footprint' => Footprint::class, 'group' => Group::class, 'manufacturer' => Manufacturer::class, 'orderdetail' => Orderdetail::class, 'part' => Part::class, 'pricedetail' => 'App\Entity\PriceInformation\Pricedetail', 'storelocation' => Storelocation::class, 'part_lot' => PartLot::class, 'currency' => Currency::class, 'measurement_unit' => MeasurementUnit::class, 'parameter' => 'App\Entity\Parts\AbstractParameter', 'supplier' => Supplier::class, 'user' => User::class])]
|
||||
#[ORM\MappedSuperclass(repositoryClass: DBElementRepository::class)]
|
||||
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.
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(type: Types::INTEGER)]
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
protected ?int $id = null;
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
use App\Entity\Contracts\TimeStampableInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -42,7 +43,7 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
|
|||
*/
|
||||
#[Assert\NotBlank]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $name = '';
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use App\Repository\AbstractPartsContainingRepository;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
@ -29,7 +30,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
/**
|
||||
* Class PartsContainingDBElement.
|
||||
*/
|
||||
#[ORM\MappedSuperclass(repositoryClass: \App\Repository\AbstractPartsContainingRepository::class)]
|
||||
#[ORM\MappedSuperclass(repositoryClass: AbstractPartsContainingRepository::class)]
|
||||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
{
|
||||
#[Groups(['full'])]
|
||||
|
|
|
@ -22,6 +22,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
use App\EntityListeners\TreeCacheInvalidationListener;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Parameters\ParametersTrait;
|
||||
use App\Validator\Constraints\NoneOfItsChildren;
|
||||
|
@ -46,24 +49,24 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
*
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'parent'], ignoreNull: false, message: 'structural.entity.unique_name')]
|
||||
#[ORM\MappedSuperclass(repositoryClass: \App\Repository\StructuralDBElementRepository::class)]
|
||||
#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])]
|
||||
#[ORM\MappedSuperclass(repositoryClass: StructuralDBElementRepository::class)]
|
||||
#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
|
||||
abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||
{
|
||||
use ParametersTrait;
|
||||
|
||||
public const ID_ROOT_ELEMENT = 0;
|
||||
final public const ID_ROOT_ELEMENT = 0;
|
||||
|
||||
/**
|
||||
* This is a not standard character, so build a const, so a dev can easily use it.
|
||||
*/
|
||||
public const PATH_DELIMITER_ARROW = ' → ';
|
||||
final public const PATH_DELIMITER_ARROW = ' → ';
|
||||
|
||||
/**
|
||||
* @var string The comment info for this element
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
|
@ -71,7 +74,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
* Useful if this element should be used only for grouping, sorting.
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $not_selectable = false;
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,7 @@ trait MasterAttachmentTrait
|
|||
* @var Attachment|null
|
||||
*/
|
||||
#[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')]
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\Attachment::class)]
|
||||
#[ORM\ManyToOne(targetEntity: Attachment::class)]
|
||||
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
|
||||
protected ?Attachment $master_picture_attachment = null;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
@ -35,14 +36,14 @@ trait TimestampTrait
|
|||
* @var \DateTimeInterface|null the date when this element was modified the last time
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
#[ORM\Column(name: 'last_modified', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
#[ORM\Column(name: 'last_modified', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
protected ?\DateTimeInterface $lastModified = null;
|
||||
|
||||
/**
|
||||
* @var \DateTimeInterface|null the date when this element was created
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
#[ORM\Column(name: 'datetime_added', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
#[ORM\Column(name: 'datetime_added', type: Types::DATETIME_MUTABLE, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
protected ?\DateTimeInterface $addedDate = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\LabelSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
|
@ -57,53 +58,53 @@ class LabelOptions
|
|||
* @var float The page size of the label in mm
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
protected float $width = 50.0;
|
||||
|
||||
/**
|
||||
* @var float The page size of the label in mm
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
protected float $height = 30.0;
|
||||
|
||||
/**
|
||||
* @var string The type of the barcode that should be used in the label (e.g. 'qr')
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::BARCODE_TYPES)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $barcode_type = 'none';
|
||||
|
||||
/**
|
||||
* @var string What image should be shown along the
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::PICTURE_TYPES)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $picture_type = 'none';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::SUPPORTED_ELEMENTS)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $supported_element = 'part';
|
||||
|
||||
/**
|
||||
* @var string any additional CSS for the label
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $additional_css = '';
|
||||
|
||||
/** @var string The mode that will be used to interpret the lines
|
||||
*/
|
||||
#[Assert\Choice(choices: LabelOptions::LINES_MODES)]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $lines_mode = 'html';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $lines = '';
|
||||
|
||||
public function getWidth(): float
|
||||
|
|
|
@ -41,6 +41,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\LabelSystem;
|
||||
|
||||
use App\Repository\LabelProfileRepository;
|
||||
use App\EntityListeners\TreeCacheInvalidationListener;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Attachments\LabelAttachment;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -49,15 +53,15 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[UniqueEntity(['name', 'options.supported_element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\LabelProfileRepository::class)]
|
||||
#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])]
|
||||
#[ORM\Entity(repositoryClass: LabelProfileRepository::class)]
|
||||
#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
|
||||
#[ORM\Table(name: 'label_profiles')]
|
||||
class LabelProfile extends AttachmentContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @var Collection<int, LabelAttachment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\LabelAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: LabelAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
|
@ -71,18 +75,18 @@ class LabelProfile extends AttachmentContainingDBElement
|
|||
/**
|
||||
* @var string The comment info for this element
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool determines, if this label profile should be shown in the dropdown quick menu
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $show_in_dropdown = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
parent::__construct();
|
||||
$this->options = new LabelOptions();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\LogSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
|
@ -129,19 +130,19 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/** @var User|null The user which has caused this log entry
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, fetch: 'EAGER')]
|
||||
#[ORM\ManyToOne(targetEntity: User::class, fetch: 'EAGER')]
|
||||
#[ORM\JoinColumn(name: 'id_user', onDelete: 'SET NULL')]
|
||||
protected ?User $user = null;
|
||||
|
||||
/**
|
||||
* @var string The username of the user which has caused this log entry (shown if the user is deleted)
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $username = '';
|
||||
|
||||
/** @var \DateTimeInterface|null The datetime the event associated with this log entry has occured
|
||||
*/
|
||||
#[ORM\Column(name: 'datetime', type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE)]
|
||||
#[ORM\Column(name: 'datetime', type: Types::DATETIME_MUTABLE)]
|
||||
protected ?\DateTimeInterface $timestamp = null;
|
||||
|
||||
/** @var int The priority level of the associated level. 0 is highest, 7 lowest
|
||||
|
@ -151,12 +152,12 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/** @var int The ID of the element targeted by this event
|
||||
*/
|
||||
#[ORM\Column(name: 'target_id', type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(name: 'target_id', type: Types::INTEGER)]
|
||||
protected int $target_id = 0;
|
||||
|
||||
/** @var int The Type of the targeted element
|
||||
*/
|
||||
#[ORM\Column(name: 'target_type', type: \Doctrine\DBAL\Types\Types::SMALLINT)]
|
||||
#[ORM\Column(name: 'target_type', type: Types::SMALLINT)]
|
||||
protected int $target_type = 0;
|
||||
|
||||
/** @var string The type of this log entry, aka the description what has happened.
|
||||
|
@ -167,7 +168,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/** @var array The extra data in raw (short form) saved in the DB
|
||||
*/
|
||||
#[ORM\Column(name: 'extra', type: \Doctrine\DBAL\Types\Types::JSON)]
|
||||
#[ORM\Column(name: 'extra', type: Types::JSON)]
|
||||
protected array $extra = [];
|
||||
|
||||
public function __construct()
|
||||
|
@ -370,7 +371,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
*/
|
||||
public function setTargetElement(?AbstractDBElement $element): self
|
||||
{
|
||||
if (!$element instanceof \App\Entity\Base\AbstractDBElement) {
|
||||
if (!$element instanceof AbstractDBElement) {
|
||||
$this->target_id = 0;
|
||||
$this->target_type = self::TARGET_TYPE_NONE;
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class PartStockChangedLogEntry extends AbstractLogEntry
|
|||
$this->extra['c'] = mb_strimwidth($comment, 0, self::COMMENT_MAX_LENGTH, '...');
|
||||
}
|
||||
|
||||
if ($move_to_target instanceof \App\Entity\Parts\PartLot) {
|
||||
if ($move_to_target instanceof PartLot) {
|
||||
if ($type !== self::TYPE_MOVE) {
|
||||
throw new \InvalidArgumentException('The move_to_target parameter can only be set if the type is "move"!');
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -51,7 +53,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
|
||||
use function sprintf;
|
||||
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
#[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'])]
|
||||
|
@ -71,7 +73,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
*/
|
||||
#[Assert\Length(max: 20)]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $symbol = '';
|
||||
|
||||
/**
|
||||
|
@ -81,7 +83,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
#[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)]
|
||||
#[ORM\Column(type: Types::FLOAT, nullable: true)]
|
||||
protected ?float $value_min = null;
|
||||
|
||||
/**
|
||||
|
@ -89,7 +91,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
*/
|
||||
#[Assert\Type([null, 'float'])]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
|
||||
#[ORM\Column(type: Types::FLOAT, nullable: true)]
|
||||
protected ?float $value_typical = null;
|
||||
|
||||
/**
|
||||
|
@ -98,21 +100,21 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
#[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)]
|
||||
#[ORM\Column(type: Types::FLOAT, nullable: true)]
|
||||
protected ?float $value_max = null;
|
||||
|
||||
/**
|
||||
* @var string The unit in which the value values are given (e.g. V)
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $unit = '';
|
||||
|
||||
/**
|
||||
* @var string a text value for the given property
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $value_text = '';
|
||||
|
||||
/**
|
||||
|
@ -120,7 +122,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
*/
|
||||
#[Groups(['full'])]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'param_group')]
|
||||
#[ORM\Column(type: Types::STRING, name: 'param_group')]
|
||||
protected string $group = '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,20 +41,21 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class AttachmentTypeParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
|
||||
/**
|
||||
* @var AttachmentType the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\AttachmentType::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,20 +41,21 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Category;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class CategoryParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Category::class;
|
||||
/**
|
||||
* @var Category the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Category::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -50,7 +51,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
* An attachment attached to a category element.
|
||||
*/
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class CurrencyParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Currency::class;
|
||||
|
@ -58,7 +59,7 @@ class CurrencyParameter extends AbstractParameter
|
|||
/**
|
||||
* @var Currency the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Currency::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class FootprintParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Footprint::class;
|
||||
|
@ -55,7 +56,7 @@ class FootprintParameter extends AbstractParameter
|
|||
/**
|
||||
* @var Footprint the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Footprint::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Footprint::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class GroupParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Group::class;
|
||||
|
@ -55,7 +56,7 @@ class GroupParameter extends AbstractParameter
|
|||
/**
|
||||
* @var Group the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\Group::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Group::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class ManufacturerParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;
|
||||
|
@ -55,7 +56,7 @@ class ManufacturerParameter extends AbstractParameter
|
|||
/**
|
||||
* @var Manufacturer the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Manufacturer::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Manufacturer::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class MeasurementUnitParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
|
||||
|
@ -55,7 +56,7 @@ class MeasurementUnitParameter extends AbstractParameter
|
|||
/**
|
||||
* @var MeasurementUnit the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\MeasurementUnit::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: MeasurementUnit::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Part;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class PartParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Part::class;
|
||||
|
@ -55,7 +56,7 @@ class PartParameter extends AbstractParameter
|
|||
/**
|
||||
* @var Part the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class ProjectParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Project::class;
|
||||
|
@ -55,7 +56,7 @@ class ProjectParameter extends AbstractParameter
|
|||
/**
|
||||
* @var Project the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class StorelocationParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
|
||||
|
@ -55,7 +56,7 @@ class StorelocationParameter extends AbstractParameter
|
|||
/**
|
||||
* @var Storelocation the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Storelocation::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,13 +41,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\ParameterRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
class SupplierParameter extends AbstractParameter
|
||||
{
|
||||
final public const ALLOWED_ELEMENT_CLASS = Supplier::class;
|
||||
|
@ -55,7 +56,7 @@ class SupplierParameter extends AbstractParameter
|
|||
/**
|
||||
* @var Supplier the element this para is associated with
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'parameters')]
|
||||
#[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Repository\Parts\CategoryRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
|
@ -34,7 +37,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* Class AttachmentType.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\Parts\CategoryRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: CategoryRepository::class)]
|
||||
#[ORM\Table(name: '`categories`')]
|
||||
#[ORM\Index(name: 'category_idx_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'category_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
|
@ -55,56 +58,56 @@ class Category extends AbstractPartsContainingDBElement
|
|||
* @var string
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $partname_hint = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $partname_regex = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $disable_footprints = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $disable_manufacturers = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $disable_autodatasheets = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $disable_properties = false;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $default_description = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $default_comment = '';
|
||||
|
||||
/**
|
||||
|
@ -112,7 +115,7 @@ class Category extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\CategoryAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: CategoryAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
|
@ -120,7 +123,7 @@ class Category extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\CategoryParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: CategoryParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
|
@ -222,8 +225,8 @@ class Category extends AbstractPartsContainingDBElement
|
|||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Repository\Parts\FootprintRepository;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\FootprintParameter;
|
||||
|
@ -32,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* Class Footprint.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\Parts\FootprintRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: FootprintRepository::class)]
|
||||
#[ORM\Table('`footprints`')]
|
||||
#[ORM\Index(name: 'footprint_idx_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'footprint_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
|
@ -40,7 +43,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
{
|
||||
#[ORM\ManyToOne(targetEntity: 'Footprint', inversedBy: 'children')]
|
||||
#[ORM\JoinColumn(name: 'parent_id')]
|
||||
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null;
|
||||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
|
@ -53,21 +56,21 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
* @var Collection<int, FootprintAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\FootprintAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: FootprintAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
* @var FootprintAttachment|null
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\FootprintAttachment::class)]
|
||||
#[ORM\ManyToOne(targetEntity: FootprintAttachment::class)]
|
||||
#[ORM\JoinColumn(name: 'id_footprint_3d')]
|
||||
protected ?FootprintAttachment $footprint_3d = null;
|
||||
|
||||
/** @var Collection<int, FootprintParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\FootprintParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: FootprintParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
|
@ -102,8 +105,8 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Repository\Parts\ManufacturerRepository;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attachments\ManufacturerAttachment;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use App\Entity\Parameters\ManufacturerParameter;
|
||||
|
@ -32,7 +35,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* Class Manufacturer.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\Parts\ManufacturerRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: ManufacturerRepository::class)]
|
||||
#[ORM\Table('`manufacturers`')]
|
||||
#[ORM\Index(name: 'manufacturer_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'manufacturer_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
|
@ -40,7 +43,7 @@ class Manufacturer extends AbstractCompany
|
|||
{
|
||||
#[ORM\ManyToOne(targetEntity: 'Manufacturer', inversedBy: 'children')]
|
||||
#[ORM\JoinColumn(name: 'parent_id')]
|
||||
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null;
|
||||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/**
|
||||
* @var Collection
|
||||
|
@ -53,21 +56,21 @@ class Manufacturer extends AbstractCompany
|
|||
* @var Collection<int, ManufacturerAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\ManufacturerAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: ManufacturerAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, ManufacturerParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\ManufacturerParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: ManufacturerParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Repository\Parts\MeasurementUnitRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attachments\MeasurementUnitAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Parameters\MeasurementUnitParameter;
|
||||
|
@ -36,7 +40,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* This could be something like N, grams, meters, etc...
|
||||
*/
|
||||
#[UniqueEntity('unit')]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\Parts\MeasurementUnitRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: MeasurementUnitRepository::class)]
|
||||
#[ORM\Table(name: '`measurement_units`')]
|
||||
#[ORM\Index(name: 'unit_idx_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'unit_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
|
@ -48,7 +52,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
#[Assert\Length(max: 10)]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'unit', nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, name: 'unit', nullable: true)]
|
||||
protected ?string $unit = null;
|
||||
|
||||
/**
|
||||
|
@ -56,7 +60,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* Set to false, to measure continuous sizes likes masses or lengths.
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'is_integer')]
|
||||
#[ORM\Column(type: Types::BOOLEAN, name: 'is_integer')]
|
||||
protected bool $is_integer = false;
|
||||
|
||||
/**
|
||||
|
@ -65,7 +69,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
*/
|
||||
#[Assert\Expression('this.isUseSIPrefix() == false or this.getUnit() != null', message: 'validator.measurement_unit.use_si_prefix_needs_unit')]
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'use_si_prefix')]
|
||||
#[ORM\Column(type: Types::BOOLEAN, name: 'use_si_prefix')]
|
||||
protected bool $use_si_prefix = false;
|
||||
|
||||
/**
|
||||
|
@ -77,20 +81,20 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
|
||||
#[ORM\ManyToOne(targetEntity: 'MeasurementUnit', inversedBy: 'children')]
|
||||
#[ORM\JoinColumn(name: 'parent_id')]
|
||||
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent = null;
|
||||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, MeasurementUnitAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\MeasurementUnitAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: MeasurementUnitAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, MeasurementUnitParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\MeasurementUnitParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: MeasurementUnitParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
|
@ -135,8 +139,8 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Repository\PartRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
|
@ -49,7 +51,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
* Otherwise, this class would be too big, to be maintained.
|
||||
*/
|
||||
#[UniqueEntity(fields: ['ipn'], message: 'part.ipn.must_be_unique')]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\PartRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: PartRepository::class)]
|
||||
#[ORM\Table('`parts`')]
|
||||
#[ORM\Index(name: 'parts_idx_datet_name_last_id_needs', columns: ['datetime_added', 'name', 'last_modified', 'id', 'needs_review'])]
|
||||
#[ORM\Index(name: 'parts_idx_name', columns: ['name'])]
|
||||
|
@ -69,7 +71,7 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\PartParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: PartParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
|
@ -81,7 +83,7 @@ class Part extends AttachmentContainingDBElement
|
|||
/**
|
||||
* @var string The name of this part
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $name = '';
|
||||
|
||||
/**
|
||||
|
@ -89,7 +91,7 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['full'])]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\PartAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: PartAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
|
@ -97,13 +99,13 @@ class Part extends AttachmentContainingDBElement
|
|||
* @var Attachment|null
|
||||
*/
|
||||
#[Assert\Expression('value == null or value.isPicture()', message: 'part.master_attachment.must_be_picture')]
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Attachments\Attachment::class)]
|
||||
#[ORM\ManyToOne(targetEntity: Attachment::class)]
|
||||
#[ORM\JoinColumn(name: 'id_preview_attachment', onDelete: 'SET NULL')]
|
||||
protected ?Attachment $master_picture_attachment = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
parent::__construct();
|
||||
$this->partLots = new ArrayCollection();
|
||||
$this->orderdetails = new ArrayCollection();
|
||||
|
@ -142,7 +144,7 @@ class Part extends AttachmentContainingDBElement
|
|||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
//Ensure that the part name fullfills the regex of the category
|
||||
if ($this->category instanceof \App\Entity\Parts\Category) {
|
||||
if ($this->category instanceof Category) {
|
||||
$regex = $this->category->getPartnameRegex();
|
||||
if (!empty($regex) && !preg_match($regex, $this->name)) {
|
||||
$context->buildViolation('part.name.must_match_category_regex')
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
|
@ -55,14 +56,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
* @var string A short description about this lot, shown in table
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string a comment stored with this lot
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
|
@ -70,7 +71,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
* Set to null, if the lot can be used indefinitely.
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, name: 'expiration_date', nullable: true)]
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, name: 'expiration_date', nullable: true)]
|
||||
protected ?\DateTimeInterface $expiration_date = null;
|
||||
|
||||
/**
|
||||
|
@ -86,7 +87,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
* @var bool If this is set to true, the instock amount is marked as not known
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $instock_unknown = false;
|
||||
|
||||
/**
|
||||
|
@ -94,14 +95,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
protected float $amount = 0.0;
|
||||
|
||||
/**
|
||||
* @var bool determines if this lot was manually marked for refilling
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $needs_refill = false;
|
||||
|
||||
/**
|
||||
|
@ -115,7 +116,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
/**
|
||||
* @var User|null The owner of this part lot
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class)]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[ORM\JoinColumn(name: 'id_owner', onDelete: 'SET NULL')]
|
||||
protected ?User $owner = null;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Parts\Part;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
@ -36,14 +37,14 @@ trait AdvancedPropertyTrait
|
|||
* @var bool Determines if this part entry needs review (for example, because it is work in progress)
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $needs_review = false;
|
||||
|
||||
/**
|
||||
* @var string a comma separated list of tags, associated with the part
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $tags = '';
|
||||
|
||||
/**
|
||||
|
@ -51,7 +52,7 @@ trait AdvancedPropertyTrait
|
|||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, nullable: true)]
|
||||
#[ORM\Column(type: Types::FLOAT, nullable: true)]
|
||||
protected ?float $mass = null;
|
||||
|
||||
/**
|
||||
|
@ -59,7 +60,7 @@ trait AdvancedPropertyTrait
|
|||
*/
|
||||
#[Assert\Length(max: 100)]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 100, nullable: true, unique: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 100, nullable: true, unique: true)]
|
||||
protected ?string $ipn = null;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
|
@ -35,27 +36,27 @@ trait BasicPropertyTrait
|
|||
* @var string A text describing what this part does
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var string A comment/note related to this part
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool Kept for compatibility (it is not used now, and I don't think it was used in old versions)
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $visible = true;
|
||||
|
||||
/**
|
||||
* @var bool true, if the part is marked as favorite
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $favorite = false;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -41,7 +42,7 @@ trait InstockTrait
|
|||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\OneToMany(targetEntity: 'PartLot', mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['amount' => 'DESC'])]
|
||||
protected \Doctrine\Common\Collections\Collection $partLots;
|
||||
protected Collection $partLots;
|
||||
|
||||
/**
|
||||
* @var float The minimum amount of the part that has to be instock, otherwise more is ordered.
|
||||
|
@ -49,7 +50,7 @@ trait InstockTrait
|
|||
*/
|
||||
#[Assert\PositiveOrZero]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
protected float $minamount = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
|
@ -48,14 +49,14 @@ trait ManufacturerTrait
|
|||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $manufacturer_product_url = '';
|
||||
|
||||
/**
|
||||
* @var string The product number used by the manufacturer. If this is set to "", the name field is used.
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $manufacturer_product_number = '';
|
||||
|
||||
/**
|
||||
|
@ -63,7 +64,7 @@ trait ManufacturerTrait
|
|||
*/
|
||||
#[Assert\Choice(['announced', 'active', 'nrfnd', 'eol', 'discontinued', ''])]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
|
||||
protected ?string $manufacturing_status = '';
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
@ -39,26 +40,26 @@ trait OrderTrait
|
|||
*/
|
||||
#[Assert\Valid]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: Orderdetail::class, mappedBy: 'part', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['supplierpartnr' => 'ASC'])]
|
||||
protected \Doctrine\Common\Collections\Collection $orderdetails;
|
||||
protected Collection $orderdetails;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(type: Types::INTEGER)]
|
||||
protected int $order_quantity = 0;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $manual_order = false;
|
||||
|
||||
/**
|
||||
* @var Orderdetail|null
|
||||
*/
|
||||
#[ORM\OneToOne(targetEntity: \App\Entity\PriceInformations\Orderdetail::class)]
|
||||
#[ORM\OneToOne(targetEntity: Orderdetail::class)]
|
||||
#[ORM\JoinColumn(name: 'order_orderdetails_id')]
|
||||
protected ?Orderdetail $order_orderdetail = null;
|
||||
|
||||
|
|
|
@ -11,15 +11,18 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
trait ProjectTrait
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\Collection<\App\Entity\ProjectSystem\ProjectBOMEntry> $project_bom_entries
|
||||
* @var Collection<ProjectBOMEntry> $project_bom_entries
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\ProjectSystem\ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)]
|
||||
protected \Doctrine\Common\Collections\Collection $project_bom_entries;
|
||||
/**
|
||||
* @var Collection<ProjectBOMEntry> $project_bom_entries
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: ProjectBOMEntry::class, mappedBy: 'part', cascade: ['remove'], orphanRemoval: true)]
|
||||
protected Collection $project_bom_entries;
|
||||
|
||||
/**
|
||||
* @var Project|null If a project is set here, then this part is special and represents the builds of a project.
|
||||
*/
|
||||
#[ORM\OneToOne(targetEntity: \App\Entity\ProjectSystem\Project::class, inversedBy: 'build_part')]
|
||||
#[ORM\OneToOne(targetEntity: Project::class, inversedBy: 'build_part')]
|
||||
#[ORM\JoinColumn]
|
||||
protected ?Project $built_project = null;
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Repository\Parts\StorelocationRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attachments\StorelocationAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
|
@ -35,7 +38,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* Class Store location.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\Parts\StorelocationRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: StorelocationRepository::class)]
|
||||
#[ORM\Table('`storelocations`')]
|
||||
#[ORM\Index(name: 'location_idx_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'location_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
|
@ -62,7 +65,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
/** @var Collection<int, StorelocationParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\StorelocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: StorelocationParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
|
@ -70,42 +73,42 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
* @var bool
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $is_full = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $only_single_part = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $limit_to_existing_parts = false;
|
||||
|
||||
/**
|
||||
* @var User|null The owner of this storage location
|
||||
*/
|
||||
#[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::class)]
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
#[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: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
|
||||
#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
|
||||
protected bool $part_owner_must_match = false;
|
||||
|
||||
/**
|
||||
* @var Collection<int, StorelocationAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\StorelocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: StorelocationAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
protected Collection $attachments;
|
||||
|
||||
/********************************************************************************
|
||||
|
@ -229,8 +232,8 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
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();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Repository\Parts\SupplierRepository;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use App\Entity\Attachments\SupplierAttachment;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
|
@ -38,7 +41,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* Class Supplier.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\Parts\SupplierRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: SupplierRepository::class)]
|
||||
#[ORM\Table('`suppliers`')]
|
||||
#[ORM\Index(name: 'supplier_idx_name', columns: ['name'])]
|
||||
#[ORM\Index(name: 'supplier_idx_parent_name', columns: ['parent_id', 'name'])]
|
||||
|
@ -56,9 +59,12 @@ class Supplier extends AbstractCompany
|
|||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\Collection<int, \App\Entity\PriceInformations\Orderdetail>|\App\Entity\PriceInformations\Orderdetail[]
|
||||
* @var Collection<int, Orderdetail>|Orderdetail[]
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Orderdetail::class, mappedBy: 'supplier')]
|
||||
/**
|
||||
* @var Collection<int, Orderdetail>|Orderdetail[]
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Orderdetail::class, mappedBy: 'supplier')]
|
||||
protected Collection $orderdetails;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +72,7 @@ class Supplier extends AbstractCompany
|
|||
* Set to null, to use global base currency.
|
||||
* @Selectable()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)]
|
||||
#[ORM\ManyToOne(targetEntity: Currency::class)]
|
||||
#[ORM\JoinColumn(name: 'default_currency_id')]
|
||||
protected ?Currency $default_currency = null;
|
||||
|
||||
|
@ -82,14 +88,14 @@ class Supplier extends AbstractCompany
|
|||
* @var Collection<int, SupplierAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\SupplierAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: SupplierAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, SupplierParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\SupplierParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: SupplierParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
|
@ -128,7 +134,7 @@ class Supplier extends AbstractCompany
|
|||
*/
|
||||
public function setShippingCosts(?BigDecimal $shipping_costs): self
|
||||
{
|
||||
if (!$shipping_costs instanceof \Brick\Math\BigDecimal) {
|
||||
if (!$shipping_costs instanceof BigDecimal) {
|
||||
$this->shipping_costs = null;
|
||||
}
|
||||
|
||||
|
@ -142,9 +148,9 @@ class Supplier extends AbstractCompany
|
|||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->orderdetails = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->orderdetails = new ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\PriceInformations;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\CurrencyParameter;
|
||||
|
@ -60,7 +61,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
*/
|
||||
#[Assert\Currency]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $iso_code = "";
|
||||
|
||||
#[ORM\OneToMany(targetEntity: 'Currency', mappedBy: 'parent', cascade: ['persist'])]
|
||||
|
@ -75,27 +76,27 @@ class Currency extends AbstractStructuralDBElement
|
|||
* @var Collection<int, CurrencyAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\CurrencyAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: CurrencyAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, CurrencyParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\CurrencyParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: CurrencyParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
/** @var Collection<int, Pricedetail>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\PriceInformations\Pricedetail::class, mappedBy: 'currency')]
|
||||
#[ORM\OneToMany(targetEntity: Pricedetail::class, mappedBy: 'currency')]
|
||||
protected Collection $pricedetails;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
$this->pricedetails = new ArrayCollection();
|
||||
parent::__construct();
|
||||
}
|
||||
|
@ -129,7 +130,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
{
|
||||
$tmp = $this->getExchangeRate();
|
||||
|
||||
if (!$tmp instanceof \Brick\Math\BigDecimal || $tmp->isZero()) {
|
||||
if (!$tmp instanceof BigDecimal || $tmp->isZero()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -153,7 +154,7 @@ class Currency extends AbstractStructuralDBElement
|
|||
*/
|
||||
public function setExchangeRate(?BigDecimal $exchange_rate): self
|
||||
{
|
||||
if (!$exchange_rate instanceof \Brick\Math\BigDecimal) {
|
||||
if (!$exchange_rate instanceof BigDecimal) {
|
||||
$this->exchange_rate = null;
|
||||
}
|
||||
$tmp = $exchange_rate->toScale(self::PRICE_SCALE, RoundingMode::HALF_UP);
|
||||
|
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\PriceInformations;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
|
@ -59,14 +60,14 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
* @var string
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $supplierpartnr = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $obsolete = false;
|
||||
|
||||
/**
|
||||
|
@ -74,14 +75,14 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
*/
|
||||
#[Assert\Url]
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $supplier_product_url = '';
|
||||
|
||||
/**
|
||||
* @var Part|null
|
||||
*/
|
||||
#[Assert\NotNull]
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'orderdetails')]
|
||||
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'orderdetails')]
|
||||
#[ORM\JoinColumn(name: 'part_id', nullable: false, onDelete: 'CASCADE')]
|
||||
protected ?Part $part = null;
|
||||
|
||||
|
@ -90,7 +91,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
*/
|
||||
#[Assert\NotNull(message: 'validator.orderdetail.supplier_must_not_be_null')]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Supplier::class, inversedBy: 'orderdetails')]
|
||||
#[ORM\ManyToOne(targetEntity: Supplier::class, inversedBy: 'orderdetails')]
|
||||
#[ORM\JoinColumn(name: 'id_supplier')]
|
||||
protected ?Supplier $supplier = null;
|
||||
|
||||
|
@ -194,7 +195,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
return $this->supplier_product_url;
|
||||
}
|
||||
|
||||
if (!$this->getSupplier() instanceof \App\Entity\Parts\Supplier) {
|
||||
if (!$this->getSupplier() instanceof Supplier) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\PriceInformations;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Contracts\TimeStampableInterface;
|
||||
|
@ -73,7 +74,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*/
|
||||
#[Assert\Positive]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
protected float $price_related_quantity = 1.0;
|
||||
|
||||
/**
|
||||
|
@ -81,13 +82,13 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*/
|
||||
#[Assert\Positive]
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT)]
|
||||
#[ORM\Column(type: Types::FLOAT)]
|
||||
protected float $min_discount_quantity = 1.0;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $manual_input = true;
|
||||
|
||||
/**
|
||||
|
@ -166,7 +167,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*
|
||||
* @return BigDecimal the price as a bcmath string
|
||||
*/
|
||||
public function getPricePerUnit(float|string|\Brick\Math\BigDecimal $multiplier = 1.0): BigDecimal
|
||||
public function getPricePerUnit(float|string|BigDecimal $multiplier = 1.0): BigDecimal
|
||||
{
|
||||
$tmp = BigDecimal::of($multiplier);
|
||||
$tmp = $tmp->multipliedBy($this->price);
|
||||
|
|
|
@ -22,6 +22,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\ProjectSystem;
|
||||
|
||||
use App\Repository\Parts\DeviceRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\ProjectParameter;
|
||||
|
@ -37,7 +39,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
/**
|
||||
* Class AttachmentType.
|
||||
*/
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\Parts\DeviceRepository::class)]
|
||||
#[ORM\Entity(repositoryClass: DeviceRepository::class)]
|
||||
#[ORM\Table(name: 'projects')]
|
||||
class Project extends AbstractStructuralDBElement
|
||||
{
|
||||
|
@ -57,7 +59,7 @@ class Project extends AbstractStructuralDBElement
|
|||
#[ORM\OneToMany(targetEntity: 'ProjectBOMEntry', mappedBy: 'project', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
protected Collection $bom_entries;
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(type: Types::INTEGER)]
|
||||
protected int $order_quantity = 0;
|
||||
|
||||
/**
|
||||
|
@ -65,33 +67,33 @@ class Project extends AbstractStructuralDBElement
|
|||
*/
|
||||
#[Assert\Choice(['draft', 'planning', 'in_production', 'finished', 'archived'])]
|
||||
#[Groups(['extended', 'full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 64, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 64, nullable: true)]
|
||||
protected ?string $status = null;
|
||||
|
||||
|
||||
/**
|
||||
* @var Part|null The (optional) part that represents the builds of this project in the stock
|
||||
*/
|
||||
#[ORM\OneToOne(targetEntity: \App\Entity\Parts\Part::class, mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)]
|
||||
#[ORM\OneToOne(targetEntity: Part::class, mappedBy: 'built_project', cascade: ['persist'], orphanRemoval: true)]
|
||||
protected ?Part $build_part = null;
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $order_only_missing_parts = false;
|
||||
|
||||
#[Groups(['simple', 'extended', 'full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $description = '';
|
||||
|
||||
/**
|
||||
* @var Collection<int, ProjectAttachment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\ProjectAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: ProjectAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, ProjectParameter>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\ProjectParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: ProjectParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
|
@ -103,8 +105,8 @@ class Project extends AbstractStructuralDBElement
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
parent::__construct();
|
||||
$this->bom_entries = new ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
|
@ -241,7 +243,7 @@ class Project extends AbstractStructuralDBElement
|
|||
*/
|
||||
public function hasBuildPart(): bool
|
||||
{
|
||||
return $this->build_part instanceof \App\Entity\Parts\Part;
|
||||
return $this->build_part instanceof Part;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -258,7 +260,7 @@ class Project extends AbstractStructuralDBElement
|
|||
public function setBuildPart(?Part $build_part): void
|
||||
{
|
||||
$this->build_part = $build_part;
|
||||
if ($build_part instanceof \App\Entity\Parts\Part) {
|
||||
if ($build_part instanceof Part) {
|
||||
$build_part->setBuiltProject($this);
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +271,7 @@ class Project extends AbstractStructuralDBElement
|
|||
//If this project has subprojects, and these have builds part, they must be included in the BOM
|
||||
foreach ($this->getChildren() as $child) {
|
||||
/** @var $child Project */
|
||||
if (!$child->getBuildPart() instanceof \App\Entity\Parts\Part) {
|
||||
if (!$child->getBuildPart() instanceof Part) {
|
||||
continue;
|
||||
}
|
||||
//We have to search all bom entries for the build part
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\ProjectSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Parts\Part;
|
||||
|
@ -50,26 +51,26 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
* @var float
|
||||
*/
|
||||
#[Assert\Positive]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'quantity')]
|
||||
#[ORM\Column(type: Types::FLOAT, name: 'quantity')]
|
||||
protected float $quantity;
|
||||
|
||||
/**
|
||||
* @var string A comma separated list of the names, where this parts should be placed
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'mountnames')]
|
||||
#[ORM\Column(type: Types::TEXT, name: 'mountnames')]
|
||||
protected string $mountnames = '';
|
||||
|
||||
/**
|
||||
* @var string|null An optional name describing this BOM entry (useful for non-part entries)
|
||||
*/
|
||||
#[Assert\Expression('this.getPart() !== null or this.getName() !== null', message: 'validator.project.bom_entry.name_or_part_needed')]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, nullable: true)]
|
||||
protected ?string $name = null;
|
||||
|
||||
/**
|
||||
* @var string An optional comment for this BOM entry
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $comment;
|
||||
|
||||
/**
|
||||
|
@ -82,7 +83,7 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
/**
|
||||
* @var Part|null The part associated with this
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\Parts\Part::class, inversedBy: 'project_bom_entries')]
|
||||
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'project_bom_entries')]
|
||||
#[ORM\JoinColumn(name: 'id_part')]
|
||||
protected ?Part $part = null;
|
||||
|
||||
|
@ -97,7 +98,7 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
* @var ?Currency The currency for the price of this non-part BOM entry
|
||||
* @Selectable()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)]
|
||||
#[ORM\ManyToOne(targetEntity: Currency::class)]
|
||||
#[ORM\JoinColumn]
|
||||
protected ?Currency $price_currency = null;
|
||||
|
||||
|
@ -213,18 +214,18 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
*/
|
||||
public function isPartBomEntry(): bool
|
||||
{
|
||||
return $this->part instanceof \App\Entity\Parts\Part;
|
||||
return $this->part instanceof Part;
|
||||
}
|
||||
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload): void
|
||||
{
|
||||
//Round quantity to whole numbers, if the part is not a decimal part
|
||||
if ($this->part instanceof \App\Entity\Parts\Part && (!$this->part->getPartUnit() || $this->part->getPartUnit()->isInteger())) {
|
||||
if ($this->part instanceof Part && (!$this->part->getPartUnit() || $this->part->getPartUnit()->isInteger())) {
|
||||
$this->quantity = round($this->quantity);
|
||||
}
|
||||
//Non-Part BOM entries are rounded
|
||||
if (!$this->part instanceof \App\Entity\Parts\Part) {
|
||||
if (!$this->part instanceof Part) {
|
||||
$this->quantity = round($this->quantity);
|
||||
}
|
||||
|
||||
|
@ -248,14 +249,14 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
}
|
||||
|
||||
//Prices are only allowed on non-part BOM entries
|
||||
if ($this->part instanceof \App\Entity\Parts\Part && $this->price instanceof \Brick\Math\BigDecimal) {
|
||||
if ($this->part instanceof Part && $this->price instanceof BigDecimal) {
|
||||
$context->buildViolation('project.bom_entry.price_not_allowed_on_parts')
|
||||
->atPath('price')
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
//Check that the part is not the build representation part of this device or one of its parents
|
||||
if ($this->part && $this->part->getBuiltProject() instanceof \App\Entity\ProjectSystem\Project) {
|
||||
if ($this->part && $this->part->getBuiltProject() instanceof Project) {
|
||||
//Get the associated project
|
||||
$associated_project = $this->part->getBuiltProject();
|
||||
//Check that it is not the same as the current project neither one of its parents
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\UserSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\GroupParameter;
|
||||
|
@ -63,13 +64,13 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
* @var bool If true all users associated with this group must have enabled some kind of two-factor authentication
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'enforce_2fa')]
|
||||
#[ORM\Column(type: Types::BOOLEAN, name: 'enforce_2fa')]
|
||||
protected bool $enforce2FA = false;
|
||||
/**
|
||||
* @var Collection<int, GroupAttachment>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\GroupAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: GroupAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
|
@ -84,14 +85,14 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
/** @var Collection<int, GroupParameter>
|
||||
*/
|
||||
#[Assert\Valid]
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Parameters\GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: GroupParameter::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
|
||||
protected Collection $parameters;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->parameters = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
parent::__construct();
|
||||
$this->permissions = new PermissionData();
|
||||
$this->users = new ArrayCollection();
|
||||
|
@ -122,7 +123,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
|
||||
public function getPermissions(): PermissionData
|
||||
{
|
||||
if (!$this->permissions instanceof \App\Entity\UserSystem\PermissionData) {
|
||||
if (!$this->permissions instanceof PermissionData) {
|
||||
$this->permissions = new PermissionData();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
namespace App\Entity\UserSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
|
@ -52,7 +53,7 @@ final class PermissionData implements \JsonSerializable
|
|||
* operation => value,
|
||||
* ]
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'data')]
|
||||
#[ORM\Column(type: Types::JSON, name: 'data')]
|
||||
protected array $data = [])
|
||||
{
|
||||
//If the passed data did not contain a schema version, we set it to the current version
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\UserSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Jbtronics\TFAWebauthn\Model\LegacyU2FKeyInterface;
|
||||
|
@ -41,39 +42,39 @@ class U2FKey implements LegacyU2FKeyInterface
|
|||
*
|
||||
* @var string
|
||||
**/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 128)]
|
||||
#[ORM\Column(type: Types::STRING, length: 128)]
|
||||
public string $keyHandle;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
**/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
public string $publicKey;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
**/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
public string $certificate;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
**/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
public int $counter;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(type: Types::INTEGER)]
|
||||
#[ORM\GeneratedValue]
|
||||
protected int $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
**/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $name;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'u2fKeys')]
|
||||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'u2fKeys')]
|
||||
protected ?User $user = null;
|
||||
|
||||
public function getKeyHandle(): string
|
||||
|
|
|
@ -22,6 +22,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\UserSystem;
|
||||
|
||||
use App\Repository\UserRepository;
|
||||
use App\EntityListeners\TreeCacheInvalidationListener;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Attachments\UserAttachment;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
|
@ -56,8 +59,8 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
|||
* Also, this entity is able to save some information about the user, like the names, email-address and other info.
|
||||
*/
|
||||
#[UniqueEntity('name', message: 'validator.user.username_already_used')]
|
||||
#[ORM\Entity(repositoryClass: \App\Repository\UserRepository::class)]
|
||||
#[ORM\EntityListeners([\App\EntityListeners\TreeCacheInvalidationListener::class])]
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
#[ORM\EntityListeners([TreeCacheInvalidationListener::class])]
|
||||
#[ORM\Table('`users`')]
|
||||
#[ORM\Index(name: 'user_idx_username', columns: ['name'])]
|
||||
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface, TwoFactorInterface,
|
||||
|
@ -74,7 +77,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* @var bool Determines if the user is disabled (user can not log in)
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $disabled = false;
|
||||
|
||||
/**
|
||||
|
@ -82,42 +85,42 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* @ValidTheme()
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_theme', nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, name: 'config_theme', nullable: true)]
|
||||
protected ?string $theme = null;
|
||||
|
||||
/**
|
||||
* @var string|null the hash of a token the user must provide when he wants to reset his password
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, nullable: true)]
|
||||
protected ?string $pw_reset_token = null;
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'config_instock_comment_a')]
|
||||
#[ORM\Column(type: Types::TEXT, name: 'config_instock_comment_a')]
|
||||
protected string $instock_comment_a = '';
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'config_instock_comment_w')]
|
||||
#[ORM\Column(type: Types::TEXT, name: 'config_instock_comment_w')]
|
||||
protected string $instock_comment_w = '';
|
||||
|
||||
/**
|
||||
* @var string A self-description of the user
|
||||
*/
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
protected string $aboutMe = '';
|
||||
|
||||
/** @var int The version of the trusted device cookie. Used to invalidate all trusted device cookies at once.
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(type: Types::INTEGER)]
|
||||
protected int $trustedDeviceCookieVersion = 0;
|
||||
|
||||
/**
|
||||
* @var string[]|null A list of backup codes that can be used, if the user has no access to its Google Authenticator device
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
|
||||
#[ORM\Column(type: Types::JSON)]
|
||||
protected ?array $backupCodes = [];
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(type: Types::INTEGER)]
|
||||
protected ?int $id = null;
|
||||
|
||||
/**
|
||||
|
@ -133,7 +136,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* @var string|null The secret used for Google authenticator
|
||||
*/
|
||||
#[ORM\Column(name: 'google_authenticator_secret', type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
|
||||
#[ORM\Column(name: 'google_authenticator_secret', type: Types::STRING, nullable: true)]
|
||||
protected ?string $googleAuthenticatorSecret = null;
|
||||
|
||||
/**
|
||||
|
@ -141,7 +144,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
#[Assert\Timezone]
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_timezone', nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, name: 'config_timezone', nullable: true)]
|
||||
protected ?string $timezone = '';
|
||||
|
||||
/**
|
||||
|
@ -149,7 +152,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
#[Assert\Language]
|
||||
#[Groups(['full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, name: 'config_language', nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, name: 'config_language', nullable: true)]
|
||||
protected ?string $language = '';
|
||||
|
||||
/**
|
||||
|
@ -157,82 +160,82 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*/
|
||||
#[Assert\Email]
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
|
||||
protected ?string $email = '';
|
||||
|
||||
/**
|
||||
* @var bool True if the user wants to show his email address on his (public) profile
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, options: ['default' => false])]
|
||||
#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]
|
||||
protected bool $show_email_on_profile = false;
|
||||
|
||||
/**
|
||||
* @var string|null The department the user is working
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
|
||||
protected ?string $department = '';
|
||||
|
||||
/**
|
||||
* @var string|null The last name of the User
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
|
||||
protected ?string $last_name = '';
|
||||
|
||||
/**
|
||||
* @var string|null The first name of the User
|
||||
*/
|
||||
#[Groups(['simple', 'extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 255, nullable: true)]
|
||||
protected ?string $first_name = '';
|
||||
|
||||
/**
|
||||
* @var bool True if the user needs to change password after log in
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $need_pw_change = true;
|
||||
|
||||
/**
|
||||
* @var string|null The hashed password
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, nullable: true)]
|
||||
#[ORM\Column(type: Types::STRING, nullable: true)]
|
||||
protected ?string $password = null;
|
||||
|
||||
#[Assert\NotBlank]
|
||||
#[Assert\Regex('/^[\w\.\+\-\$]+$/', message: 'user.invalid_username')]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING, length: 180, unique: true)]
|
||||
#[ORM\Column(type: Types::STRING, length: 180, unique: true)]
|
||||
protected string $name = '';
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
|
||||
#[ORM\Column(type: Types::JSON)]
|
||||
protected ?array $settings = [];
|
||||
|
||||
/**
|
||||
* @var Collection<int, UserAttachment>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\Attachments\UserAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: UserAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
||||
#[ORM\OrderBy(['name' => 'ASC'])]
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var \DateTimeInterface|null The time when the backup codes were generated
|
||||
*/
|
||||
#[Groups(['full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
protected ?\DateTimeInterface $backupCodesGenerationDate = null;
|
||||
|
||||
/** @var Collection<int, LegacyU2FKeyInterface>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\UserSystem\U2FKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: U2FKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
|
||||
protected Collection $u2fKeys;
|
||||
|
||||
/**
|
||||
* @var Collection<int, WebauthnKey>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: \App\Entity\UserSystem\WebauthnKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
|
||||
#[ORM\OneToMany(targetEntity: WebauthnKey::class, mappedBy: 'user', cascade: ['REMOVE'], orphanRemoval: true)]
|
||||
protected Collection $webauthn_keys;
|
||||
|
||||
/**
|
||||
|
@ -243,7 +246,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* @Selectable()
|
||||
*/
|
||||
#[Groups(['extended', 'full', 'import'])]
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\PriceInformations\Currency::class)]
|
||||
#[ORM\ManyToOne(targetEntity: Currency::class)]
|
||||
#[ORM\JoinColumn(name: 'currency_id')]
|
||||
protected ?Currency $currency = null;
|
||||
|
||||
|
@ -258,19 +261,19 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* @var \DateTimeInterface|null the time until the password reset token is valid
|
||||
*/
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
protected ?\DateTimeInterface $pw_reset_expires = null;
|
||||
|
||||
/**
|
||||
* @var bool True if the user was created by a SAML provider (and therefore cannot change its password)
|
||||
*/
|
||||
#[Groups(['extended', 'full'])]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
|
||||
#[ORM\Column(type: Types::BOOLEAN)]
|
||||
protected bool $saml_user = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->attachments = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->attachments = new ArrayCollection();
|
||||
parent::__construct();
|
||||
$this->permissions = new PermissionData();
|
||||
$this->u2fKeys = new ArrayCollection();
|
||||
|
@ -419,7 +422,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
public function getPermissions(): PermissionData
|
||||
{
|
||||
if (!$this->permissions instanceof \App\Entity\UserSystem\PermissionData) {
|
||||
if (!$this->permissions instanceof PermissionData) {
|
||||
$this->permissions = new PermissionData();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
namespace App\Entity\UserSystem;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Webauthn\PublicKeyCredentialSource as BasePublicKeyCredentialSource;
|
||||
|
@ -32,14 +33,14 @@ class WebauthnKey extends BasePublicKeyCredentialSource
|
|||
use TimestampTrait;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
|
||||
#[ORM\Column(type: Types::INTEGER)]
|
||||
#[ORM\GeneratedValue]
|
||||
protected int $id;
|
||||
|
||||
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::STRING)]
|
||||
#[ORM\Column(type: Types::STRING)]
|
||||
protected string $name;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: \App\Entity\UserSystem\User::class, inversedBy: 'webauthn_keys')]
|
||||
#[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'webauthn_keys')]
|
||||
protected ?User $user = null;
|
||||
|
||||
public function getName(): string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue