Extracted some entity methods into contract interfaces.

This commit is contained in:
Jan Böhmer 2020-02-02 13:03:45 +01:00
parent 594c694ee0
commit 6369ee2e61
7 changed files with 108 additions and 5 deletions

View file

@ -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) {