mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 02:09:03 +02:00
Removed unnecessary getIDString() function in AbstractDBElement.
This commit is contained in:
parent
a3af55d4e2
commit
8b6fe757a0
26 changed files with 3 additions and 219 deletions
|
@ -154,7 +154,7 @@ class ConvertBBCodeCommand extends Command
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
/** @var AbstractNamedDBElement $result */
|
/** @var AbstractNamedDBElement $result */
|
||||||
$io->writeln(
|
$io->writeln(
|
||||||
'Convert entity: '.$result->getName().' ('.$result->getIDString().')',
|
'Convert entity: '.$result->getName().' (' . get_class($result) . ': ' . $result->getID() . ')',
|
||||||
OutputInterface::VERBOSITY_VERBOSE
|
OutputInterface::VERBOSITY_VERBOSE
|
||||||
);
|
);
|
||||||
foreach ($properties as $property) {
|
foreach ($properties as $property) {
|
||||||
|
|
|
@ -337,16 +337,6 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
return $this->attachment_type;
|
return $this->attachment_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'A'.sprintf('%09d', $this->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************************************
|
/*****************************************************************************************************
|
||||||
* Setters
|
* Setters
|
||||||
|
|
|
@ -118,14 +118,4 @@ class AttachmentType extends AbstractStructuralDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'AT'.sprintf('%09d', $this->getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,14 +87,6 @@ abstract class AbstractDBElement implements \JsonSerializable
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
abstract public function getIDString(): string;
|
|
||||||
|
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return ['@id' => $this->getID()];
|
return ['@id' => $this->getID()];
|
||||||
|
|
|
@ -168,15 +168,4 @@ class Device extends AbstractPartsContainingDBElement
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'D'.sprintf('%09d', $this->getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,15 +86,4 @@ class DevicePart extends AbstractDBElement
|
||||||
* @ORM\JoinColumn(name="id_part", referencedColumnName="id")
|
* @ORM\JoinColumn(name="id_part", referencedColumnName="id")
|
||||||
*/
|
*/
|
||||||
protected $part;
|
protected $part;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'DP'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,9 +120,4 @@ class LabelProfile extends AttachmentContainingDBElement
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'LP'.sprintf('%09d', $this->getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,11 +306,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
return $this->typeString;
|
return $this->typeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'LOG'.$this->getID();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the class name of the target element associated with this log entry.
|
* Returns the class name of the target element associated with this log entry.
|
||||||
* Returns null, if this log entry is not associated with an log entry.
|
* Returns null, if this log entry is not associated with an log entry.
|
||||||
|
|
|
@ -387,11 +387,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'PM'.sprintf('%09d', $this->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a string representation and (if possible) with its unit.
|
* Return a string representation and (if possible) with its unit.
|
||||||
*
|
*
|
||||||
|
|
|
@ -116,16 +116,6 @@ class Category extends AbstractPartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'C'.sprintf('%09d', $this->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPartnameHint(): string
|
public function getPartnameHint(): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,16 +103,6 @@ class Footprint extends AbstractPartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'F'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
* Getters
|
* Getters
|
||||||
|
|
|
@ -95,15 +95,4 @@ class Manufacturer extends AbstractCompany
|
||||||
* @Assert\Valid()
|
* @Assert\Valid()
|
||||||
*/
|
*/
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'M'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,16 +113,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'MU'.$this->getID();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -176,16 +176,6 @@ class Part extends AttachmentContainingDBElement
|
||||||
parent::__clone();
|
parent::__clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'P'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all devices which uses this part.
|
* Get all devices which uses this part.
|
||||||
|
|
|
@ -128,16 +128,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
parent::__clone();
|
parent::__clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'PL'.$this->getID();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the current part lot is expired.
|
* Check if the current part lot is expired.
|
||||||
|
|
|
@ -224,15 +224,4 @@ class Storelocation extends AbstractPartsContainingDBElement
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'L'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,15 +172,4 @@ class Supplier extends AbstractCompany
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'L'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,15 +162,4 @@ class Currency extends AbstractStructuralDBElement
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'C'.$this->getID();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,17 +134,6 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
||||||
parent::__clone();
|
parent::__clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'O'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
*
|
*
|
||||||
* Getters
|
* Getters
|
||||||
|
|
|
@ -330,15 +330,4 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'PD'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,17 +132,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'G'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPermissions(): PermissionsEmbed
|
public function getPermissions(): PermissionsEmbed
|
||||||
{
|
{
|
||||||
return $this->permissions;
|
return $this->permissions;
|
||||||
|
|
|
@ -410,16 +410,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ID as an string, defined by the element class.
|
|
||||||
* This should have a form like P000014, for a part with ID 14.
|
|
||||||
*
|
|
||||||
* @return string The ID as a string;
|
|
||||||
*/
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'U'.sprintf('%06d', $this->getID());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPermissions(): PermissionsEmbed
|
public function getPermissions(): PermissionsEmbed
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
<tr> {# ID #}
|
<tr> {# ID #}
|
||||||
<td>{% trans %}id.label{% endtrans %}</td>
|
<td>{% trans %}id.label{% endtrans %}</td>
|
||||||
<td>{{ part.iD }} ({{ part.iDString}})</td>
|
<td>{{ part.iD }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr> {# Favorite status #}
|
<tr> {# Favorite status #}
|
||||||
|
|
|
@ -83,10 +83,6 @@ class ElementTypeNameGeneratorTest extends WebTestCase
|
||||||
//Test exception for unknpwn type
|
//Test exception for unknpwn type
|
||||||
$this->expectException(EntityNotSupportedException::class);
|
$this->expectException(EntityNotSupportedException::class);
|
||||||
$this->service->getLocalizedTypeLabel(new class() extends AbstractDBElement {
|
$this->service->getLocalizedTypeLabel(new class() extends AbstractDBElement {
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'Stub';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,12 +65,7 @@ class LabelGeneratorTest extends WebTestCase
|
||||||
$this->assertTrue($this->service->supports($options, new $class()));
|
$this->assertTrue($this->service->supports($options, new $class()));
|
||||||
|
|
||||||
//Ensure that another class is not supported
|
//Ensure that another class is not supported
|
||||||
$not_supported = new class() extends AbstractDBElement {
|
$not_supported = new class() extends AbstractDBElement {};
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'not_important';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$this->assertFalse($this->service->supports($options, $not_supported));
|
$this->assertFalse($this->service->supports($options, $not_supported));
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,11 +42,6 @@ class AbstractElementProviderTest extends WebTestCase
|
||||||
$this->service = self::$container->get(AbstractDBElementProvider::class);
|
$this->service = self::$container->get(AbstractDBElementProvider::class);
|
||||||
$this->target = new class() extends AbstractDBElement {
|
$this->target = new class() extends AbstractDBElement {
|
||||||
protected $id = 123;
|
protected $id = 123;
|
||||||
|
|
||||||
public function getIDString(): string
|
|
||||||
{
|
|
||||||
return 'ignore';
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue