Added some basic DB fields for the new project system

This commit is contained in:
Jan Böhmer 2022-12-18 20:34:25 +01:00
parent 8ae4e9fe05
commit 0c7ec9f0c7
36 changed files with 281 additions and 130 deletions

View file

@ -44,7 +44,7 @@ use LogicException;
* @ORM\DiscriminatorColumn(name="class_name", type="string")
* @ORM\DiscriminatorMap({
* "PartDB\Part" = "PartAttachment", "Part" = "PartAttachment",
* "PartDB\Device" = "DeviceAttachment", "Device" = "DeviceAttachment",
* "PartDB\Device" = "ProjectAttachment", "Device" = "ProjectAttachment",
* "AttachmentType" = "AttachmentTypeAttachment", "Category" = "CategoryAttachment",
* "Footprint" = "FootprintAttachment", "Manufacturer" = "ManufacturerAttachment",
* "Currency" = "CurrencyAttachment", "Group" = "GroupAttachment",

View file

@ -22,7 +22,7 @@ declare(strict_types=1);
namespace App\Entity\Attachments;
use App\Entity\Devices\Device;
use App\Entity\ProjectSystem\Project;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@ -32,12 +32,12 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
* @ORM\Entity()
* @UniqueEntity({"name", "attachment_type", "element"})
*/
class DeviceAttachment extends Attachment
class ProjectAttachment extends Attachment
{
public const ALLOWED_ELEMENT_CLASS = Device::class;
public const ALLOWED_ELEMENT_CLASS = Project::class;
/**
* @var Device the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="attachments")
* @var Project the element this attachment is associated with
* @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
*/
protected ?AttachmentContainingDBElement $element = null;