mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-27 20:28:54 +02:00
Renamed the base DBElement classes to AbstractDBElement to comply with symfony recommendations.
This commit is contained in:
parent
da72f5b3ec
commit
594c694ee0
62 changed files with 203 additions and 203 deletions
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use function in_array;
|
||||
|
@ -48,7 +48,7 @@ use LogicException;
|
|||
* })
|
||||
* @ORM\EntityListeners({"App\EntityListeners\AttachmentDeleteListener"})
|
||||
*/
|
||||
abstract class Attachment extends NamedDBElement
|
||||
abstract class Attachment extends AbstractNamedDBElement
|
||||
{
|
||||
/**
|
||||
* A list of file extensions, that browsers can show directly as image.
|
||||
|
|
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Attachments;
|
||||
|
||||
use App\Entity\Base\MasterAttachmentTrait;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -32,7 +32,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
/**
|
||||
* @ORM\MappedSuperclass()
|
||||
*/
|
||||
abstract class AttachmentContainingDBElement extends NamedDBElement
|
||||
abstract class AttachmentContainingDBElement extends AbstractNamedDBElement
|
||||
{
|
||||
use MasterAttachmentTrait;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Validator\Constraints\ValidFileFilter;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -35,7 +35,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table(name="`attachment_types`")
|
||||
*/
|
||||
class AttachmentType extends StructuralDBElement
|
||||
class AttachmentType extends AbstractStructuralDBElement
|
||||
{
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="AttachmentType", mappedBy="parent", cascade={"persist"})
|
||||
|
|
|
@ -52,7 +52,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
*
|
||||
* @ORM\MappedSuperclass()
|
||||
*/
|
||||
abstract class Company extends PartsContainingDBElement
|
||||
abstract class AbstractCompany extends AbstractPartsContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @var string The address of the company
|
|
@ -56,7 +56,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
* "user" = "App\Entity\User"
|
||||
* })
|
||||
*/
|
||||
abstract class DBElement
|
||||
abstract class AbstractDBElement
|
||||
{
|
||||
/** @var int|null The Identification number for this part. This value is unique for the element in this table.
|
||||
* Null if the element is not saved to DB yet.
|
|
@ -33,7 +33,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\UserRepository")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
abstract class NamedDBElement extends DBElement
|
||||
abstract class AbstractNamedDBElement extends AbstractDBElement
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
|
@ -33,7 +33,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
*
|
||||
* @ORM\MappedSuperclass()
|
||||
*/
|
||||
abstract class PartsContainingDBElement extends StructuralDBElement
|
||||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
{
|
||||
/**
|
||||
* @var Part[]|Collection
|
|
@ -49,7 +49,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
*
|
||||
* @UniqueEntity(fields={"name", "parent"}, ignoreNull=false, message="structural.entity.unique_name")
|
||||
*/
|
||||
abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||
abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||
{
|
||||
public const ID_ROOT_ELEMENT = 0;
|
||||
|
||||
|
@ -81,13 +81,13 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
* We can not define the mapping here or we will get an exception. Unfortunately we have to do the mapping in the
|
||||
* subclasses.
|
||||
*
|
||||
* @var StructuralDBElement[]|Collection
|
||||
* @var AbstractStructuralDBElement[]|Collection
|
||||
* @Groups({"include_children"})
|
||||
*/
|
||||
protected $children;
|
||||
|
||||
/**
|
||||
* @var StructuralDBElement
|
||||
* @var AbstractStructuralDBElement
|
||||
* @NoneOfItsChildren()
|
||||
* @Groups({"include_parents"})
|
||||
*/
|
||||
|
@ -111,7 +111,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* Check if this element is a child of another element (recursive).
|
||||
*
|
||||
* @param StructuralDBElement $another_element the object to compare
|
||||
* @param AbstractStructuralDBElement $another_element the object to compare
|
||||
* IMPORTANT: both objects to compare must be from the same class (for example two "Device" objects)!
|
||||
*
|
||||
* @return bool True, if this element is child of $another_element.
|
||||
|
@ -156,7 +156,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* Get the parent of this element.
|
||||
*
|
||||
* @return StructuralDBElement|null The parent element. Null if this element, does not have a parent.
|
||||
* @return AbstractStructuralDBElement|null The parent element. Null if this element, does not have a parent.
|
||||
*/
|
||||
public function getParent(): ?self
|
||||
{
|
||||
|
@ -190,7 +190,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
if (0 === $this->level && null !== $this->parent) {
|
||||
$element = $this->parent;
|
||||
while (null !== $element) {
|
||||
/** @var StructuralDBElement $element */
|
||||
/** @var AbstractStructuralDBElement $element */
|
||||
$element = $element->parent;
|
||||
++$this->level;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
*
|
||||
* @param self $new_parent The new parent object
|
||||
*
|
||||
* @return StructuralDBElement
|
||||
* @return AbstractStructuralDBElement
|
||||
*/
|
||||
public function setParent(?self $new_parent): self
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
*
|
||||
* @param string $new_comment the new comment
|
||||
*
|
||||
* @return StructuralDBElement
|
||||
* @return AbstractStructuralDBElement
|
||||
*/
|
||||
public function setComment(?string $new_comment): self
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @return StructuralDBElement
|
||||
* @return AbstractStructuralDBElement
|
||||
*/
|
||||
public function setNotSelectable(bool $not_selectable): self
|
||||
{
|
|
@ -52,7 +52,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Devices;
|
||||
|
||||
use App\Entity\Attachments\DeviceAttachment;
|
||||
use App\Entity\Base\PartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use InvalidArgumentException;
|
||||
|
@ -63,7 +63,7 @@ use InvalidArgumentException;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table(name="`devices`")
|
||||
*/
|
||||
class Device extends PartsContainingDBElement
|
||||
class Device extends AbstractPartsContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Device", mappedBy="parent")
|
||||
|
|
|
@ -51,7 +51,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Devices;
|
||||
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Part;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
@ -61,7 +61,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
* @ORM\Table("`device_parts`")
|
||||
* @ORM\Entity()
|
||||
*/
|
||||
class DevicePart extends DBElement
|
||||
class DevicePart extends AbstractDBElement
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace App\Entity\LogSystem;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\Devices\DevicePart;
|
||||
use App\Entity\Parts\Category;
|
||||
|
@ -61,7 +61,7 @@ use Psr\Log\LogLevel;
|
|||
* 10 = "DatabaseUpdatedLogEntry"
|
||||
* })
|
||||
*/
|
||||
abstract class AbstractLogEntry extends DBElement
|
||||
abstract class AbstractLogEntry extends AbstractDBElement
|
||||
{
|
||||
public const LEVEL_EMERGENCY = 0;
|
||||
public const LEVEL_ALERT = 1;
|
||||
|
@ -311,11 +311,11 @@ abstract class AbstractLogEntry extends DBElement
|
|||
/**
|
||||
* Sets the target element associated with this element.
|
||||
*
|
||||
* @param DBElement $element The element that should be associated with this element.
|
||||
* @param AbstractDBElement $element The element that should be associated with this element.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTargetElement(?DBElement $element): self
|
||||
public function setTargetElement(?AbstractDBElement $element): self
|
||||
{
|
||||
if (null === $element) {
|
||||
$this->target_id = 0;
|
||||
|
|
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Base\PartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
@ -34,7 +34,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table(name="`categories`")
|
||||
*/
|
||||
class Category extends PartsContainingDBElement
|
||||
class Category extends AbstractPartsContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
|
||||
|
|
|
@ -52,7 +52,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Base\PartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
@ -62,7 +62,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table("`footprints`")
|
||||
*/
|
||||
class Footprint extends PartsContainingDBElement
|
||||
class Footprint extends AbstractPartsContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Footprint", inversedBy="children")
|
||||
|
|
|
@ -52,7 +52,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Attachments\ManufacturerAttachment;
|
||||
use App\Entity\Base\Company;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
@ -62,7 +62,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table("`manufacturers`")
|
||||
*/
|
||||
class Manufacturer extends Company
|
||||
class Manufacturer extends AbstractCompany
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Manufacturer", inversedBy="children")
|
||||
|
|
|
@ -25,7 +25,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Attachments\MeasurementUnitAttachment;
|
||||
use App\Entity\Base\PartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -39,7 +39,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\Table(name="`measurement_units`")
|
||||
* @UniqueEntity("unit")
|
||||
*/
|
||||
class MeasurementUnit extends PartsContainingDBElement
|
||||
class MeasurementUnit extends AbstractPartsContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @var string The unit symbol that should be used for the Unit. This could be something like "", g (for grams)
|
||||
|
|
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Parts\PartTraits\InstockTrait;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
|
@ -43,7 +43,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\HasLifecycleCallbacks()
|
||||
* @ValidPartLot()
|
||||
*/
|
||||
class PartLot extends DBElement
|
||||
class PartLot extends AbstractDBElement
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Attachments\StorelocationAttachment;
|
||||
use App\Entity\Base\PartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
@ -62,7 +62,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table("`storelocations`")
|
||||
*/
|
||||
class Storelocation extends PartsContainingDBElement
|
||||
class Storelocation extends AbstractPartsContainingDBElement
|
||||
{
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Storelocation", mappedBy="parent")
|
||||
|
|
|
@ -52,7 +52,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parts;
|
||||
|
||||
use App\Entity\Attachments\SupplierAttachment;
|
||||
use App\Entity\Base\Company;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -65,7 +65,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table("`suppliers`")
|
||||
*/
|
||||
class Supplier extends Company
|
||||
class Supplier extends AbstractCompany
|
||||
{
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Supplier", mappedBy="parent")
|
||||
|
|
|
@ -25,7 +25,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\PriceInformations;
|
||||
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -38,7 +38,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\Entity()
|
||||
* @ORM\Table(name="currencies")
|
||||
*/
|
||||
class Currency extends StructuralDBElement
|
||||
class Currency extends AbstractStructuralDBElement
|
||||
{
|
||||
public const PRICE_SCALE = 5;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\PriceInformations;
|
||||
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Supplier;
|
||||
|
@ -67,7 +67,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\Entity()
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class Orderdetail extends DBElement
|
||||
class Orderdetail extends AbstractDBElement
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\PriceInformations;
|
||||
|
||||
use App\Entity\Base\DBElement;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\TimestampTrait;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -66,7 +66,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
* @ORM\HasLifecycleCallbacks()
|
||||
* @UniqueEntity(fields={"orderdetail", "min_discount_quantity"})
|
||||
*/
|
||||
class Pricedetail extends DBElement
|
||||
class Pricedetail extends AbstractDBElement
|
||||
{
|
||||
use TimestampTrait;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\UserSystem;
|
||||
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Security\Interfaces\HasPermissionsInterface;
|
||||
use App\Validator\Constraints\ValidPermission;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -37,7 +37,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
* @ORM\Entity()
|
||||
* @ORM\Table("`groups`")
|
||||
*/
|
||||
class Group extends StructuralDBElement implements HasPermissionsInterface
|
||||
class Group extends AbstractStructuralDBElement implements HasPermissionsInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Group", mappedBy="parent")
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace App\Entity\UserSystem;
|
|||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Attachments\UserAttachment;
|
||||
use App\Entity\Base\MasterAttachmentTrait;
|
||||
use App\Entity\Base\NamedDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Security\Interfaces\HasPermissionsInterface;
|
||||
use App\Validator\Constraints\Selectable;
|
||||
|
@ -521,7 +521,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName(string $new_name): NamedDBElement
|
||||
public function setName(string $new_name): AbstractNamedDBElement
|
||||
{
|
||||
// Anonymous user is not allowed to change its username
|
||||
if (! $this->isAnonymousUser()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue