diff --git a/migrations/Version20221218192108.php b/migrations/Version20221218192108.php new file mode 100644 index 00000000..8de3b04d --- /dev/null +++ b/migrations/Version20221218192108.php @@ -0,0 +1,33 @@ +addSql('ALTER TABLE device_parts ADD name LONGTEXT NOT NULL, ADD comment LONGTEXT NOT NULL, ADD last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, ADD datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, CHANGE quantity quantity DOUBLE PRECISION NOT NULL'); + $this->addSql('ALTER TABLE devices ADD description LONGTEXT NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE devices DROP description'); + $this->addSql('ALTER TABLE device_parts DROP name, DROP comment, DROP last_modified, DROP datetime_added, CHANGE quantity quantity INT NOT NULL'); + } +} diff --git a/src/Command/Migrations/ConvertBBCodeCommand.php b/src/Command/Migrations/ConvertBBCodeCommand.php index 0712f6fd..6b2b3fd7 100644 --- a/src/Command/Migrations/ConvertBBCodeCommand.php +++ b/src/Command/Migrations/ConvertBBCodeCommand.php @@ -24,7 +24,7 @@ namespace App\Command\Migrations; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\AbstractNamedDBElement; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Manufacturer; use App\Entity\Parts\MeasurementUnit; @@ -94,7 +94,7 @@ class ConvertBBCodeCommand extends Command Part::class => ['description', 'comment'], AttachmentType::class => ['comment'], Storelocation::class => ['comment'], - Device::class => ['comment'], + Project::class => ['comment'], Category::class => ['comment'], Manufacturer::class => ['comment'], MeasurementUnit::class => ['comment'], diff --git a/src/Controller/AdminPages/DeviceController.php b/src/Controller/AdminPages/ProjectAdminController.php similarity index 74% rename from src/Controller/AdminPages/DeviceController.php rename to src/Controller/AdminPages/ProjectAdminController.php index 7f98a218..736d1302 100644 --- a/src/Controller/AdminPages/DeviceController.php +++ b/src/Controller/AdminPages/ProjectAdminController.php @@ -22,10 +22,11 @@ declare(strict_types=1); namespace App\Controller\AdminPages; -use App\Entity\Attachments\DeviceAttachment; -use App\Entity\Devices\Device; -use App\Entity\Parameters\DeviceParameter; +use App\Entity\Attachments\ProjectAttachment; +use App\Entity\ProjectSystem\Project; +use App\Entity\Parameters\ProjectParameter; use App\Form\AdminPages\BaseEntityAdminForm; +use App\Form\AdminPages\ProjectAdminForm; use App\Services\ImportExportSystem\EntityExporter; use App\Services\ImportExportSystem\EntityImporter; use App\Services\Trees\StructuralElementRecursionHelper; @@ -38,19 +39,19 @@ use Symfony\Component\Routing\Annotation\Route; /** * @Route("/device") */ -class DeviceController extends BaseAdminController +class ProjectAdminController extends BaseAdminController { - protected $entity_class = Device::class; + protected $entity_class = Project::class; protected $twig_template = 'AdminPages/DeviceAdmin.html.twig'; - protected $form_class = BaseEntityAdminForm::class; + protected $form_class = ProjectAdminForm::class; protected $route_base = 'device'; - protected $attachment_class = DeviceAttachment::class; - protected $parameter_class = DeviceParameter::class; + protected $attachment_class = ProjectAttachment::class; + protected $parameter_class = ProjectParameter::class; /** * @Route("/{id}", name="device_delete", methods={"DELETE"}) */ - public function delete(Request $request, Device $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse + public function delete(Request $request, Project $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse { return $this->_delete($request, $entity, $recursionHelper); } @@ -59,7 +60,7 @@ class DeviceController extends BaseAdminController * @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="device_edit") * @Route("/{id}", requirements={"id"="\d+"}) */ - public function edit(Device $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response + public function edit(Project $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response { return $this->_edit($entity, $request, $em, $timestamp); } @@ -69,7 +70,7 @@ class DeviceController extends BaseAdminController * @Route("/{id}/clone", name="device_clone") * @Route("/") */ - public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Device $entity = null): Response + public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Project $entity = null): Response { return $this->_new($request, $em, $importer, $entity); } @@ -85,7 +86,7 @@ class DeviceController extends BaseAdminController /** * @Route("/{id}/export", name="device_export") */ - public function exportEntity(Device $entity, EntityExporter $exporter, Request $request): Response + public function exportEntity(Project $entity, EntityExporter $exporter, Request $request): Response { return $this->_exportEntity($entity, $exporter, $request); } diff --git a/src/Controller/TreeController.php b/src/Controller/TreeController.php index fbfd2c18..f5d8bd81 100644 --- a/src/Controller/TreeController.php +++ b/src/Controller/TreeController.php @@ -22,7 +22,7 @@ declare(strict_types=1); namespace App\Controller; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -136,10 +136,10 @@ class TreeController extends AbstractController * @Route("/device/{id}", name="tree_device") * @Route("/devices", name="tree_device_root") */ - public function deviceTree(?Device $device = null): JsonResponse + public function deviceTree(?Project $device = null): JsonResponse { if ($this->isGranted('@devices.read')) { - $tree = $this->treeGenerator->getTreeView(Device::class, $device, 'devices'); + $tree = $this->treeGenerator->getTreeView(Project::class, $device, 'devices'); } else { return new JsonResponse("Access denied", 403); } diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php index 3a08d0d6..efefc78e 100644 --- a/src/Controller/TypeaheadController.php +++ b/src/Controller/TypeaheadController.php @@ -24,7 +24,7 @@ namespace App\Controller; use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\CategoryParameter; -use App\Entity\Parameters\DeviceParameter; +use App\Entity\Parameters\ProjectParameter; use App\Entity\Parameters\FootprintParameter; use App\Entity\Parameters\GroupParameter; use App\Entity\Parameters\ManufacturerParameter; @@ -105,7 +105,7 @@ class TypeaheadController extends AbstractController case 'part': return PartParameter::class; case 'device': - return DeviceParameter::class; + return ProjectParameter::class; case 'footprint': return FootprintParameter::class; case 'manufacturer': diff --git a/src/DataFixtures/DataStructureFixtures.php b/src/DataFixtures/DataStructureFixtures.php index 5697b156..c7416abe 100644 --- a/src/DataFixtures/DataStructureFixtures.php +++ b/src/DataFixtures/DataStructureFixtures.php @@ -24,7 +24,7 @@ namespace App\DataFixtures; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\AbstractStructuralDBElement; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -51,7 +51,7 @@ class DataStructureFixtures extends Fixture public function load(ObjectManager $manager): void { //Reset autoincrement - $types = [AttachmentType::class, Device::class, Category::class, Footprint::class, Manufacturer::class, + $types = [AttachmentType::class, Project::class, Category::class, Footprint::class, Manufacturer::class, MeasurementUnit::class, Storelocation::class, Supplier::class, ]; foreach ($types as $type) { diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 0f603c09..a4807a21 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -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", diff --git a/src/Entity/Attachments/DeviceAttachment.php b/src/Entity/Attachments/ProjectAttachment.php similarity index 81% rename from src/Entity/Attachments/DeviceAttachment.php rename to src/Entity/Attachments/ProjectAttachment.php index 4f394789..1fab6bc8 100644 --- a/src/Entity/Attachments/DeviceAttachment.php +++ b/src/Entity/Attachments/ProjectAttachment.php @@ -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; diff --git a/src/Entity/Base/AbstractPartsContainingDBElement.php b/src/Entity/Base/AbstractPartsContainingDBElement.php index a8ba8e8c..f30819f5 100644 --- a/src/Entity/Base/AbstractPartsContainingDBElement.php +++ b/src/Entity/Base/AbstractPartsContainingDBElement.php @@ -29,6 +29,7 @@ use Doctrine\ORM\Mapping as ORM; * * @ORM\MappedSuperclass(repositoryClass="App\Repository\AbstractPartsContainingRepository") */ -abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement +abstract class +AbstractPartsContainingDBElement extends AbstractStructuralDBElement { } diff --git a/src/Entity/LogSystem/AbstractLogEntry.php b/src/Entity/LogSystem/AbstractLogEntry.php index 840d7a31..2fafd8a1 100644 --- a/src/Entity/LogSystem/AbstractLogEntry.php +++ b/src/Entity/LogSystem/AbstractLogEntry.php @@ -25,8 +25,8 @@ namespace App\Entity\LogSystem; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Base\AbstractDBElement; -use App\Entity\Devices\Device; -use App\Entity\Devices\DevicePart; +use App\Entity\ProjectSystem\Project; +use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Entity\LabelSystem\LabelProfile; use App\Entity\Parameters\AbstractParameter; use App\Entity\Parts\Category; @@ -124,8 +124,8 @@ abstract class AbstractLogEntry extends AbstractDBElement self::TARGET_TYPE_ATTACHEMENT => Attachment::class, self::TARGET_TYPE_ATTACHEMENTTYPE => AttachmentType::class, self::TARGET_TYPE_CATEGORY => Category::class, - self::TARGET_TYPE_DEVICE => Device::class, - self::TARGET_TYPE_DEVICEPART => DevicePart::class, + self::TARGET_TYPE_DEVICE => Project::class, + self::TARGET_TYPE_DEVICEPART => ProjectBOMEntry::class, self::TARGET_TYPE_FOOTPRINT => Footprint::class, self::TARGET_TYPE_GROUP => Group::class, self::TARGET_TYPE_MANUFACTURER => Manufacturer::class, diff --git a/src/Entity/LogSystem/CollectionElementDeleted.php b/src/Entity/LogSystem/CollectionElementDeleted.php index 0e8c06a0..5b12119a 100644 --- a/src/Entity/LogSystem/CollectionElementDeleted.php +++ b/src/Entity/LogSystem/CollectionElementDeleted.php @@ -46,7 +46,7 @@ use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CurrencyAttachment; -use App\Entity\Attachments\DeviceAttachment; +use App\Entity\Attachments\ProjectAttachment; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\GroupAttachment; use App\Entity\Attachments\ManufacturerAttachment; @@ -58,12 +58,12 @@ use App\Entity\Attachments\UserAttachment; use App\Entity\Base\AbstractDBElement; use App\Entity\Contracts\LogWithEventUndoInterface; use App\Entity\Contracts\NamedElementInterface; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parameters\AbstractParameter; use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\CategoryParameter; use App\Entity\Parameters\CurrencyParameter; -use App\Entity\Parameters\DeviceParameter; +use App\Entity\Parameters\ProjectParameter; use App\Entity\Parameters\FootprintParameter; use App\Entity\Parameters\GroupParameter; use App\Entity\Parameters\ManufacturerParameter; @@ -159,8 +159,8 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU return CategoryParameter::class; case Currency::class: return CurrencyParameter::class; - case Device::class: - return DeviceParameter::class; + case Project::class: + return ProjectParameter::class; case Footprint::class: return FootprintParameter::class; case Group::class: @@ -189,8 +189,8 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU return CategoryAttachment::class; case Currency::class: return CurrencyAttachment::class; - case Device::class: - return DeviceAttachment::class; + case Project::class: + return ProjectAttachment::class; case Footprint::class: return FootprintAttachment::class; case Group::class: diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 55ebd9e5..5a3f00e3 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -62,7 +62,7 @@ use function sprintf; * @ORM\DiscriminatorMap({ * 0 = "CategoryParameter", * 1 = "CurrencyParameter", - * 2 = "DeviceParameter", + * 2 = "ProjectParameter", * 3 = "FootprintParameter", * 4 = "GroupParameter", * 5 = "ManufacturerParameter", diff --git a/src/Entity/Parameters/DeviceParameter.php b/src/Entity/Parameters/ProjectParameter.php similarity index 87% rename from src/Entity/Parameters/DeviceParameter.php rename to src/Entity/Parameters/ProjectParameter.php index d52e9037..2961a843 100644 --- a/src/Entity/Parameters/DeviceParameter.php +++ b/src/Entity/Parameters/ProjectParameter.php @@ -41,7 +41,7 @@ declare(strict_types=1); namespace App\Entity\Parameters; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; @@ -49,13 +49,13 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; * @ORM\Entity(repositoryClass="App\Repository\ParameterRepository") * @UniqueEntity(fields={"name", "group", "element"}) */ -class DeviceParameter extends AbstractParameter +class ProjectParameter extends AbstractParameter { - public const ALLOWED_ELEMENT_CLASS = Device::class; + public const ALLOWED_ELEMENT_CLASS = Project::class; /** - * @var Device the element this para is associated with - * @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="parameters") + * @var Project the element this para is associated with + * @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="parameters") * @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE"). */ protected $element; diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index 27aeabaa..20bc1020 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -25,7 +25,7 @@ namespace App\Entity\Parts; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\PartAttachment; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parameters\ParametersTrait; use App\Entity\Parameters\PartParameter; use App\Entity\Parts\PartTraits\AdvancedPropertyTrait; @@ -152,7 +152,7 @@ class Part extends AttachmentContainingDBElement /** * Get all devices which uses this part. * - * @return Device[] * all devices which uses this part as a one-dimensional array of Device objects + * @return Project[] * all devices which uses this part as a one-dimensional array of Device objects * (empty array if there are no ones) * * the array is sorted by the devices names */ diff --git a/src/Entity/Devices/Device.php b/src/Entity/ProjectSystem/Project.php similarity index 64% rename from src/Entity/Devices/Device.php rename to src/Entity/ProjectSystem/Project.php index 15fee00a..30c6d684 100644 --- a/src/Entity/Devices/Device.php +++ b/src/Entity/ProjectSystem/Project.php @@ -20,11 +20,12 @@ declare(strict_types=1); -namespace App\Entity\Devices; +namespace App\Entity\ProjectSystem; -use App\Entity\Attachments\DeviceAttachment; -use App\Entity\Base\AbstractPartsContainingDBElement; -use App\Entity\Parameters\DeviceParameter; +use App\Entity\Attachments\ProjectAttachment; +use App\Entity\Base\AbstractStructuralDBElement; +use App\Entity\Parameters\ProjectParameter; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use InvalidArgumentException; @@ -33,27 +34,27 @@ use InvalidArgumentException; * Class AttachmentType. * * @ORM\Entity(repositoryClass="App\Repository\Parts\DeviceRepository") - * @ORM\Table(name="`devices`") + * @ORM\Table(name="devices") */ -class Device extends AbstractPartsContainingDBElement +class Project extends AbstractStructuralDBElement { /** - * @ORM\OneToMany(targetEntity="Device", mappedBy="parent") + * @ORM\OneToMany(targetEntity="Project", mappedBy="parent") * @ORM\OrderBy({"name" = "ASC"}) * @var Collection */ protected $children; /** - * @ORM\ManyToOne(targetEntity="Device", inversedBy="children") + * @ORM\ManyToOne(targetEntity="Project", inversedBy="children") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") */ protected $parent; /** - * @ORM\OneToMany(targetEntity="DevicePart", mappedBy="device") + * @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="device") */ - protected $parts; + protected $bom_entries; /** * @ORM\Column(type="integer") @@ -64,15 +65,21 @@ class Device extends AbstractPartsContainingDBElement * @ORM\Column(type="boolean") */ protected bool $order_only_missing_parts = false; + /** - * @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + * @ORM\Column(type="text", nullable=false) + */ + protected string $description = ''; + + /** + * @var Collection + * @ORM\OneToMany(targetEntity="App\Entity\Attachments\ProjectAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"name" = "ASC"}) */ protected $attachments; - /** @var Collection - * @ORM\OneToMany(targetEntity="App\Entity\Parameters\DeviceParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) + /** @var Collection + * @ORM\OneToMany(targetEntity="App\Entity\Parameters\ProjectParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) * @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"}) */ protected $parameters; @@ -83,6 +90,12 @@ class Device extends AbstractPartsContainingDBElement * *********************************************************************************/ + public function __construct() + { + parent::__construct(); + $this->bom_entries = new ArrayCollection(); + } + /** * Get the order quantity of this device. * @@ -131,7 +144,7 @@ class Device extends AbstractPartsContainingDBElement * * @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute * - * @return Device + * @return Project */ public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self { @@ -139,4 +152,42 @@ class Device extends AbstractPartsContainingDBElement return $this; } + + /** + * @return mixed + */ + public function getBomEntries() + { + return $this->bom_entries; + } + + /** + * @param mixed $bom_entries + * @return Project + */ + public function setBomEntries($bom_entries) + { + $this->bom_entries = $bom_entries; + return $this; + } + + /** + * @return string + */ + public function getDescription(): string + { + return $this->description; + } + + /** + * @param string $description + * @return Project + */ + public function setDescription(string $description): Project + { + $this->description = $description; + return $this; + } + + } diff --git a/src/Entity/Devices/DevicePart.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php similarity index 58% rename from src/Entity/Devices/DevicePart.php rename to src/Entity/ProjectSystem/ProjectBOMEntry.php index ed627a4c..0b4104c6 100644 --- a/src/Entity/Devices/DevicePart.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -20,42 +20,60 @@ declare(strict_types=1); -namespace App\Entity\Devices; +namespace App\Entity\ProjectSystem; use App\Entity\Base\AbstractDBElement; +use App\Entity\Base\TimestampTrait; use App\Entity\Parts\Part; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints as Assert; /** - * Class DevicePart. + * The ProjectBOMEntry class represents a entry in a project's BOM. * - * @ORM\Table("`device_parts`") + * @ORM\Table("device_parts") * @ORM\Entity() */ -class DevicePart extends AbstractDBElement +class ProjectBOMEntry extends AbstractDBElement { - /** - * @var int - * @ORM\Column(type="integer", name="quantity") - */ - protected int $quantity; + use TimestampTrait; /** - * @var string + * @var int + * @ORM\Column(type="float", name="quantity") + * @Assert\PositiveOrZero() + */ + protected float $quantity; + + /** + * @var string A comma separated list of the names, where this parts should be placed * @ORM\Column(type="text", name="mountnames") */ protected string $mountnames; - /** - * @var Device - * @ORM\ManyToOne(targetEntity="Device", inversedBy="parts") - * @ORM\JoinColumn(name="id_device", referencedColumnName="id") - */ - protected ?Device $device = null; /** - * @var Part + * @var string An optional name describing this BOM entry (useful for non-part entries) + * @ORM\Column(type="text") + */ + protected string $name; + + /** + * @var string An optional comment for this BOM entry + * @ORM\Column(type="text") + */ + protected string $comment; + + /** + * @var Project + * @ORM\ManyToOne(targetEntity="Project", inversedBy="parts") + * @ORM\JoinColumn(name="id_device", referencedColumnName="id") + */ + protected ?Project $device = null; + + /** + * @var Part|null The part associated with this * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part") - * @ORM\JoinColumn(name="id_part", referencedColumnName="id") + * @ORM\JoinColumn(name="id_part", referencedColumnName="id", nullable=true) */ protected ?Part $part = null; } diff --git a/src/Form/AdminPages/ProjectAdminForm.php b/src/Form/AdminPages/ProjectAdminForm.php new file mode 100644 index 00000000..f382ae6e --- /dev/null +++ b/src/Form/AdminPages/ProjectAdminForm.php @@ -0,0 +1,42 @@ +. + */ + +namespace App\Form\AdminPages; + +use App\Entity\Base\AbstractNamedDBElement; +use App\Form\Type\RichTextEditorType; +use Symfony\Component\Form\FormBuilderInterface; + +class ProjectAdminForm extends BaseEntityAdminForm +{ + protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void + { + $builder->add('description', RichTextEditorType::class, [ + 'required' => false, + 'empty_data' => '', + 'label' => 'part.edit.description', + 'mode' => 'markdown-single_line', + 'attr' => [ + 'placeholder' => 'part.edit.description.placeholder', + 'rows' => 2, + ], + ]); + } +} \ No newline at end of file diff --git a/src/Form/Filters/AttachmentFilterType.php b/src/Form/Filters/AttachmentFilterType.php index eeea0fa9..6ef03220 100644 --- a/src/Form/Filters/AttachmentFilterType.php +++ b/src/Form/Filters/AttachmentFilterType.php @@ -25,7 +25,7 @@ use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CurrencyAttachment; -use App\Entity\Attachments\DeviceAttachment; +use App\Entity\Attachments\ProjectAttachment; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\GroupAttachment; use App\Entity\Attachments\LabelAttachment; @@ -80,7 +80,7 @@ class AttachmentFilterType extends AbstractType 'attachment_type.label' => AttachmentTypeAttachment::class, 'category.label' => CategoryAttachment::class, 'currency.label' => CurrencyAttachment::class, - 'device.label' => DeviceAttachment::class, + 'device.label' => ProjectAttachment::class, 'footprint.label' => FootprintAttachment::class, 'group.label' => GroupAttachment::class, 'label_profile.label' => LabelAttachment::class, diff --git a/src/Form/Filters/LogFilterType.php b/src/Form/Filters/LogFilterType.php index 39393917..e9cb7a53 100644 --- a/src/Form/Filters/LogFilterType.php +++ b/src/Form/Filters/LogFilterType.php @@ -23,8 +23,8 @@ namespace App\Form\Filters; use App\DataTables\Filters\LogFilter; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; -use App\Entity\Devices\Device; -use App\Entity\Devices\DevicePart; +use App\Entity\ProjectSystem\Project; +use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Entity\LabelSystem\LabelProfile; use App\Entity\LogSystem\AbstractLogEntry; use App\Entity\LogSystem\CollectionElementDeleted; @@ -135,8 +135,8 @@ class LogFilterType extends AbstractType 'attachment.label' => AbstractLogEntry::targetTypeClassToID(Attachment::class), 'attachment_type.label' => AbstractLogEntry::targetTypeClassToID(AttachmentType::class), 'category.label' => AbstractLogEntry::targetTypeClassToID(Category::class), - 'device.label' => AbstractLogEntry::targetTypeClassToID(Device::class), - 'device_part.label' => AbstractLogEntry::targetTypeClassToID(DevicePart::class), + 'device.label' => AbstractLogEntry::targetTypeClassToID(Project::class), + 'device_part.label' => AbstractLogEntry::targetTypeClassToID(ProjectBOMEntry::class), 'footprint.label' => AbstractLogEntry::targetTypeClassToID(Footprint::class), 'group.label' => AbstractLogEntry::targetTypeClassToID(Group::class), 'manufacturer.label' => AbstractLogEntry::targetTypeClassToID(Manufacturer::class), diff --git a/src/Form/ParameterType.php b/src/Form/ParameterType.php index ef993c40..09293b97 100644 --- a/src/Form/ParameterType.php +++ b/src/Form/ParameterType.php @@ -45,7 +45,7 @@ use App\Entity\Parameters\AbstractParameter; use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\CategoryParameter; use App\Entity\Parameters\CurrencyParameter; -use App\Entity\Parameters\DeviceParameter; +use App\Entity\Parameters\ProjectParameter; use App\Entity\Parameters\FootprintParameter; use App\Entity\Parameters\GroupParameter; use App\Entity\Parameters\ManufacturerParameter; @@ -158,7 +158,7 @@ class ParameterType extends AbstractType AttachmentTypeParameter::class => 'attachment_type', CategoryParameter::class => 'category', CurrencyParameter::class => 'currency', - DeviceParameter::class => 'device', + ProjectParameter::class => 'device', FootprintParameter::class => 'footprint', GroupParameter::class => 'group', ManufacturerParameter::class => 'manufacturer', diff --git a/src/Repository/Parts/DeviceRepository.php b/src/Repository/Parts/DeviceRepository.php index 013958c1..dc5d5acc 100644 --- a/src/Repository/Parts/DeviceRepository.php +++ b/src/Repository/Parts/DeviceRepository.php @@ -22,18 +22,19 @@ namespace App\Repository\Parts; use App\Entity\Base\AbstractPartsContainingDBElement; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Part; use App\Repository\AbstractPartsContainingRepository; +use App\Repository\StructuralDBElementRepository; use InvalidArgumentException; -class DeviceRepository extends AbstractPartsContainingRepository +class DeviceRepository extends StructuralDBElementRepository { public function getParts(object $element, array $order_by = ['name' => 'ASC']): array { - if (!$element instanceof Device) { + if (!$element instanceof Project) { throw new InvalidArgumentException('$element must be an Device!'); } @@ -44,7 +45,7 @@ class DeviceRepository extends AbstractPartsContainingRepository public function getPartsCount(object $element): int { - if (!$element instanceof Device) { + if (!$element instanceof Project) { throw new InvalidArgumentException('$element must be an Device!'); } diff --git a/src/Security/Voter/ParameterVoter.php b/src/Security/Voter/ParameterVoter.php index c09a8e04..713a14c9 100644 --- a/src/Security/Voter/ParameterVoter.php +++ b/src/Security/Voter/ParameterVoter.php @@ -24,7 +24,7 @@ use App\Entity\Parameters\AbstractParameter; use App\Entity\Parameters\AttachmentTypeParameter; use App\Entity\Parameters\CategoryParameter; use App\Entity\Parameters\CurrencyParameter; -use App\Entity\Parameters\DeviceParameter; +use App\Entity\Parameters\ProjectParameter; use App\Entity\Parameters\FootprintParameter; use App\Entity\Parameters\GroupParameter; use App\Entity\Parameters\ManufacturerParameter; @@ -95,7 +95,7 @@ class ParameterVoter extends ExtendedVoter $param = 'categories'; } elseif ($subject instanceof CurrencyParameter) { $param = 'currencies'; - } elseif ($subject instanceof DeviceParameter) { + } elseif ($subject instanceof ProjectParameter) { $param = 'devices'; } elseif ($subject instanceof FootprintParameter) { $param = 'footprints'; diff --git a/src/Security/Voter/StructureVoter.php b/src/Security/Voter/StructureVoter.php index 50f21fd1..6c7bb6a2 100644 --- a/src/Security/Voter/StructureVoter.php +++ b/src/Security/Voter/StructureVoter.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace App\Security\Voter; use App\Entity\Attachments\AttachmentType; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -40,7 +40,7 @@ class StructureVoter extends ExtendedVoter protected const OBJ_PERM_MAP = [ AttachmentType::class => 'attachment_types', Category::class => 'categories', - Device::class => 'devices', + Project::class => 'devices', Footprint::class => 'footprints', Manufacturer::class => 'manufacturers', Storelocation::class => 'storelocations', diff --git a/src/Services/Attachments/AttachmentSubmitHandler.php b/src/Services/Attachments/AttachmentSubmitHandler.php index 18ec6896..9640d4b0 100644 --- a/src/Services/Attachments/AttachmentSubmitHandler.php +++ b/src/Services/Attachments/AttachmentSubmitHandler.php @@ -28,7 +28,7 @@ use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CurrencyAttachment; -use App\Entity\Attachments\DeviceAttachment; +use App\Entity\Attachments\ProjectAttachment; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\GroupAttachment; use App\Entity\Attachments\ManufacturerAttachment; @@ -82,7 +82,7 @@ class AttachmentSubmitHandler AttachmentTypeAttachment::class => 'attachment_type', CategoryAttachment::class => 'category', CurrencyAttachment::class => 'currency', - DeviceAttachment::class => 'device', + ProjectAttachment::class => 'device', FootprintAttachment::class => 'footprint', GroupAttachment::class => 'group', ManufacturerAttachment::class => 'manufacturer', diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php index 3e456da7..fce1395c 100644 --- a/src/Services/ElementTypeNameGenerator.php +++ b/src/Services/ElementTypeNameGenerator.php @@ -25,7 +25,7 @@ namespace App\Services; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Contracts\NamedElementInterface; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\LabelSystem\LabelProfile; use App\Entity\Parameters\AbstractParameter; use App\Entity\Parts\Category; @@ -59,7 +59,7 @@ class ElementTypeNameGenerator Attachment::class => $this->translator->trans('attachment.label'), Category::class => $this->translator->trans('category.label'), AttachmentType::class => $this->translator->trans('attachment_type.label'), - Device::class => $this->translator->trans('device.label'), + Project::class => $this->translator->trans('device.label'), Footprint::class => $this->translator->trans('footprint.label'), Manufacturer::class => $this->translator->trans('manufacturer.label'), MeasurementUnit::class => $this->translator->trans('measurement_unit.label'), diff --git a/src/Services/EntityURLGenerator.php b/src/Services/EntityURLGenerator.php index 2d0afd88..81d87f00 100644 --- a/src/Services/EntityURLGenerator.php +++ b/src/Services/EntityURLGenerator.php @@ -26,7 +26,7 @@ use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\PartAttachment; use App\Entity\Base\AbstractDBElement; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\LabelSystem\LabelProfile; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; @@ -113,7 +113,7 @@ class EntityURLGenerator //As long we does not have own things for it use edit page AttachmentType::class => 'attachment_type_edit', Category::class => 'category_edit', - Device::class => 'device_edit', + Project::class => 'device_edit', Supplier::class => 'supplier_edit', Manufacturer::class => 'manufacturer_edit', Storelocation::class => 'store_location_edit', @@ -204,7 +204,7 @@ class EntityURLGenerator //As long we does not have own things for it use edit page AttachmentType::class => 'attachment_type_edit', Category::class => 'category_edit', - Device::class => 'device_edit', + Project::class => 'device_edit', Supplier::class => 'supplier_edit', Manufacturer::class => 'manufacturer_edit', Storelocation::class => 'store_location_edit', @@ -234,7 +234,7 @@ class EntityURLGenerator Part::class => 'part_edit', AttachmentType::class => 'attachment_type_edit', Category::class => 'category_edit', - Device::class => 'device_edit', + Project::class => 'device_edit', Supplier::class => 'supplier_edit', Manufacturer::class => 'manufacturer_edit', Storelocation::class => 'store_location_edit', @@ -264,7 +264,7 @@ class EntityURLGenerator Part::class => 'part_new', AttachmentType::class => 'attachment_type_new', Category::class => 'category_new', - Device::class => 'device_new', + Project::class => 'device_new', Supplier::class => 'supplier_new', Manufacturer::class => 'manufacturer_new', Storelocation::class => 'store_location_new', @@ -295,7 +295,7 @@ class EntityURLGenerator Part::class => 'part_clone', AttachmentType::class => 'attachment_type_clone', Category::class => 'category_clone', - Device::class => 'device_clone', + Project::class => 'device_clone', Supplier::class => 'supplier_clone', Manufacturer::class => 'manufacturer_clone', Storelocation::class => 'store_location_clone', @@ -338,7 +338,7 @@ class EntityURLGenerator Part::class => 'part_delete', AttachmentType::class => 'attachment_type_delete', Category::class => 'category_delete', - Device::class => 'device_delete', + Project::class => 'device_delete', Supplier::class => 'supplier_delete', Manufacturer::class => 'manufacturer_delete', Storelocation::class => 'store_location_delete', diff --git a/src/Services/Tools/StatisticsHelper.php b/src/Services/Tools/StatisticsHelper.php index 9f54db80..60ed568d 100644 --- a/src/Services/Tools/StatisticsHelper.php +++ b/src/Services/Tools/StatisticsHelper.php @@ -43,7 +43,7 @@ namespace App\Services\Tools; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -111,7 +111,7 @@ class StatisticsHelper $arr = [ 'attachment_type' => AttachmentType::class, 'category' => Category::class, - 'device' => Device::class, + 'device' => Project::class, 'footprint' => Footprint::class, 'manufacturer' => Manufacturer::class, 'measurement_unit' => MeasurementUnit::class, diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php index d94ccf20..48a8d660 100644 --- a/src/Services/Trees/ToolsTreeBuilder.php +++ b/src/Services/Trees/ToolsTreeBuilder.php @@ -24,7 +24,7 @@ namespace App\Services\Trees; use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\PartAttachment; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\LabelSystem\LabelProfile; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; @@ -156,7 +156,7 @@ class ToolsTreeBuilder $this->urlGenerator->generate('category_new') ))->setIcon('fa-fw fa-treeview fa-solid fa-tags'); } - if ($this->security->isGranted('read', new Device())) { + if ($this->security->isGranted('read', new Project())) { $nodes[] = (new TreeViewNode( $this->translator->trans('tree.tools.edit.devices'), $this->urlGenerator->generate('device_new') diff --git a/src/Services/Trees/TreeViewGenerator.php b/src/Services/Trees/TreeViewGenerator.php index 8a413cc2..00deded3 100644 --- a/src/Services/Trees/TreeViewGenerator.php +++ b/src/Services/Trees/TreeViewGenerator.php @@ -25,7 +25,7 @@ namespace App\Services\Trees; use App\Entity\Base\AbstractDBElement; use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Base\AbstractStructuralDBElement; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -161,7 +161,7 @@ class TreeViewGenerator return $this->translator->trans('manufacturer.labelp'); case Supplier::class: return $this->translator->trans('supplier.labelp'); - case Device::class: + case Project::class: return $this->translator->trans('device.labelp'); default: return $this->translator->trans('tree.root_node.text'); @@ -182,7 +182,7 @@ class TreeViewGenerator return $icon . 'fa-industry'; case Supplier::class: return $icon . 'fa-truck'; - case Device::class: + case Project::class: return $icon . 'fa-archive'; default: return null; diff --git a/src/Twig/EntityExtension.php b/src/Twig/EntityExtension.php index 5c0141ff..6d477d88 100644 --- a/src/Twig/EntityExtension.php +++ b/src/Twig/EntityExtension.php @@ -22,7 +22,7 @@ namespace App\Twig; use App\Entity\Attachments\Attachment; use App\Entity\Base\AbstractDBElement; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\LabelSystem\LabelProfile; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; @@ -99,7 +99,7 @@ final class EntityExtension extends AbstractExtension Storelocation::class => 'storelocation', Manufacturer::class => 'manufacturer', Category::class => 'category', - Device::class => 'device', + Project::class => 'device', Attachment::class => 'attachment', Supplier::class => 'supplier', User::class => 'user', diff --git a/src/Twig/FormatExtension.php b/src/Twig/FormatExtension.php index 08a4e85c..6d251267 100644 --- a/src/Twig/FormatExtension.php +++ b/src/Twig/FormatExtension.php @@ -24,7 +24,7 @@ namespace App\Twig; use App\Entity\Attachments\Attachment; use App\Entity\Base\AbstractDBElement; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\LabelSystem\LabelProfile; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; diff --git a/templates/AdminPages/DeviceAdmin.html.twig b/templates/AdminPages/DeviceAdmin.html.twig index 633d3bb2..b241f831 100644 --- a/templates/AdminPages/DeviceAdmin.html.twig +++ b/templates/AdminPages/DeviceAdmin.html.twig @@ -10,4 +10,8 @@ {% block new_title %} {% trans %}device.new{% endtrans %} +{% endblock %} + +{% block additional_controls %} + {{ form_row(form.description) }} {% endblock %} \ No newline at end of file diff --git a/tests/Controller/AdminPages/DeviceControllerTest.php b/tests/Controller/AdminPages/DeviceControllerTest.php index 122d24ab..be078ebf 100644 --- a/tests/Controller/AdminPages/DeviceControllerTest.php +++ b/tests/Controller/AdminPages/DeviceControllerTest.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace App\Tests\Controller\AdminPages; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; /** * @group slow @@ -32,5 +32,5 @@ use App\Entity\Devices\Device; class DeviceControllerTest extends AbstractAdminControllerTest { protected static $base_path = '/en'.'/device'; - protected static $entity_class = Device::class; + protected static $entity_class = Project::class; } diff --git a/tests/Entity/Attachments/AttachmentTest.php b/tests/Entity/Attachments/AttachmentTest.php index b6abfb7e..91a3cb53 100644 --- a/tests/Entity/Attachments/AttachmentTest.php +++ b/tests/Entity/Attachments/AttachmentTest.php @@ -27,7 +27,7 @@ use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CurrencyAttachment; -use App\Entity\Attachments\DeviceAttachment; +use App\Entity\Attachments\ProjectAttachment; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\GroupAttachment; use App\Entity\Attachments\ManufacturerAttachment; @@ -36,7 +36,7 @@ use App\Entity\Attachments\PartAttachment; use App\Entity\Attachments\StorelocationAttachment; use App\Entity\Attachments\SupplierAttachment; use App\Entity\Attachments\UserAttachment; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; use App\Entity\Parts\Manufacturer; @@ -78,7 +78,7 @@ class AttachmentTest extends TestCase [AttachmentTypeAttachment::class, AttachmentType::class], [CategoryAttachment::class, Category::class], [CurrencyAttachment::class, Currency::class], - [DeviceAttachment::class, Device::class], + [ProjectAttachment::class, Project::class], [FootprintAttachment::class, Footprint::class], [GroupAttachment::class, Group::class], [ManufacturerAttachment::class, Manufacturer::class], @@ -117,8 +117,8 @@ class AttachmentTest extends TestCase /** @var Attachment $attachment */ $attachment = new $attachment_class(); - if (Device::class !== $allowed_class) { - $element = new Device(); + if (Project::class !== $allowed_class) { + $element = new Project(); } else { $element = new Category(); } diff --git a/tests/Entity/LogSystem/AbstractLogEntryTest.php b/tests/Entity/LogSystem/AbstractLogEntryTest.php index e2632873..fe4cdb58 100644 --- a/tests/Entity/LogSystem/AbstractLogEntryTest.php +++ b/tests/Entity/LogSystem/AbstractLogEntryTest.php @@ -44,8 +44,8 @@ namespace App\Tests\Entity\LogSystem; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\PartAttachment; -use App\Entity\Devices\Device; -use App\Entity\Devices\DevicePart; +use App\Entity\ProjectSystem\Project; +use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Entity\LogSystem\AbstractLogEntry; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; @@ -82,8 +82,8 @@ class AbstractLogEntryTest extends TestCase [2, Attachment::class], [3, AttachmentType::class], [4, Category::class], - [5, Device::class], - [6, DevicePart::class], + [5, Project::class], + [6, ProjectBOMEntry::class], [7, Footprint::class], [8, Group::class], [9, Manufacturer::class], diff --git a/tests/Twig/EntityExtensionTest.php b/tests/Twig/EntityExtensionTest.php index b9124658..9e951ea6 100644 --- a/tests/Twig/EntityExtensionTest.php +++ b/tests/Twig/EntityExtensionTest.php @@ -22,7 +22,7 @@ namespace App\Tests\Twig; use App\Entity\Attachments\Attachment; use App\Entity\Attachments\PartAttachment; -use App\Entity\Devices\Device; +use App\Entity\ProjectSystem\Project; use App\Entity\LabelSystem\LabelProfile; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; @@ -58,7 +58,7 @@ class EntityExtensionTest extends WebTestCase $this->assertEquals('storelocation', $this->service->getEntityType(new Storelocation())); $this->assertEquals('manufacturer', $this->service->getEntityType(new Manufacturer())); $this->assertEquals('category', $this->service->getEntityType(new Category())); - $this->assertEquals('device', $this->service->getEntityType(new Device())); + $this->assertEquals('device', $this->service->getEntityType(new Project())); $this->assertEquals('attachment', $this->service->getEntityType(new PartAttachment())); $this->assertEquals('supplier', $this->service->getEntityType(new Supplier())); $this->assertEquals('user', $this->service->getEntityType(new User()));