mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 11:24:31 +02:00
Extracted some entity methods into contract interfaces.
This commit is contained in:
parent
594c694ee0
commit
6369ee2e61
7 changed files with 108 additions and 5 deletions
|
@ -28,6 +28,7 @@ use App\Entity\Attachments\Attachment;
|
|||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
|
@ -113,14 +114,14 @@ class ElementTypeNameGenerator
|
|||
* For example this could be something like: "Part: BC547".
|
||||
* It uses getLocalizedLabel to determine the type.
|
||||
*
|
||||
* @param AbstractNamedDBElement $entity the entity for which the string should be generated
|
||||
* @param NamedElementInterface $entity the entity for which the string should be generated
|
||||
* @param bool $use_html If set to true, a html string is returned, where the type is set italic
|
||||
*
|
||||
* @return string The localized string
|
||||
*
|
||||
* @throws EntityNotSupportedException when the passed entity is not supported
|
||||
*/
|
||||
public function getTypeNameCombination(AbstractNamedDBElement $entity, bool $use_html = false): string
|
||||
public function getTypeNameCombination(NamedElementInterface $entity, bool $use_html = false): string
|
||||
{
|
||||
$type = $this->getLocalizedTypeLabel($entity);
|
||||
if ($use_html) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue