Renamed Storelocation entity to StorageLocation

This commit is contained in:
Jan Böhmer 2023-09-04 22:57:40 +02:00
parent 09acca950d
commit 0af5a58dbe
59 changed files with 218 additions and 176 deletions

View file

@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Attachments;
use App\Entity\Parts\PartTraits\ProjectTrait;
use App\Repository\AttachmentRepository;
use App\EntityListeners\AttachmentDeleteListener;
use Doctrine\DBAL\Types\Types;
@ -42,7 +43,12 @@ use LogicException;
#[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\DiscriminatorMap(['PartDB\Part' => PartAttachment::class, 'Part' => PartAttachment::class,
'PartDB\Device' => ProjectAttachment::class, 'Device' => ProjectAttachment::class, 'AttachmentType' => AttachmentTypeAttachment::class,
'Category' => CategoryAttachment::class, 'Footprint' => FootprintAttachment::class, 'Manufacturer' => ManufacturerAttachment::class,
'Currency' => CurrencyAttachment::class, 'Group' => GroupAttachment::class, 'MeasurementUnit' => MeasurementUnitAttachment::class,
'Storelocation' => StorageLocationAttachment::class, 'Supplier' => SupplierAttachment::class,
'User' => UserAttachment::class, 'LabelProfile' => LabelAttachment::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'])]

View file

@ -22,24 +22,24 @@ declare(strict_types=1);
namespace App\Entity\Attachments;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\StorageLocation;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* An attachment attached to a measurement unit element.
* @extends Attachment<Storelocation>
* @extends Attachment<StorageLocation>
*/
#[UniqueEntity(['name', 'attachment_type', 'element'])]
#[ORM\Entity]
class StorelocationAttachment extends Attachment
class StorageLocationAttachment extends Attachment
{
final public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
final public const ALLOWED_ELEMENT_CLASS = StorageLocation::class;
/**
* @var Storelocation|null the element this attachment is associated with
* @var StorageLocation|null the element this attachment is associated with
*/
#[ORM\ManyToOne(targetEntity: Storelocation::class, inversedBy: 'attachments')]
#[ORM\ManyToOne(targetEntity: StorageLocation::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
protected ?AttachmentContainingDBElement $element = null;
}