mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-29 05:00:08 +02:00
Merge branch 'master' into log_detail_page
This commit is contained in:
commit
4c6ceab8e8
291 changed files with 1994 additions and 1621 deletions
|
@ -59,7 +59,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
/**
|
||||
* A list of file extensions, that browsers can show directly as image.
|
||||
* Based on: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
|
||||
* It will be used to determine if a attachment is a picture and therefore will be shown to user as preview.
|
||||
* It will be used to determine if an attachment is a picture and therefore will be shown to user as preview.
|
||||
*/
|
||||
public const PICTURE_EXTS = ['apng', 'bmp', 'gif', 'ico', 'cur', 'jpg', 'jpeg', 'jfif', 'pjpeg', 'pjp', 'png',
|
||||
'svg', 'webp', ];
|
||||
|
@ -70,7 +70,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
public const MODEL_EXTS = ['x3d'];
|
||||
|
||||
/**
|
||||
* When the path begins with one of this placeholders.
|
||||
* When the path begins with one of the placeholders.
|
||||
*/
|
||||
public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%'];
|
||||
|
||||
|
@ -105,7 +105,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
protected string $name = '';
|
||||
|
||||
/**
|
||||
* ORM mapping is done in sub classes (like PartAttachment).
|
||||
* ORM mapping is done in subclasses (like PartAttachment).
|
||||
*/
|
||||
protected ?AttachmentContainingDBElement $element = null;
|
||||
|
||||
|
@ -116,7 +116,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
protected bool $show_in_table = false;
|
||||
|
||||
/**
|
||||
* @var AttachmentType
|
||||
* @var AttachmentType|null
|
||||
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type")
|
||||
* @ORM\JoinColumn(name="type_id", referencedColumnName="id", nullable=false)
|
||||
* @Selectable()
|
||||
|
@ -153,7 +153,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
*/
|
||||
public function isPicture(): bool
|
||||
{
|
||||
//We can not check if a external link is a picture, so just assume this is false
|
||||
//We can not check if an external link is a picture, so just assume this is false
|
||||
if ($this->isExternal()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
* Checks if the attachment file is using a builtin file. (see BUILTIN_PLACEHOLDERS const for possible placeholders)
|
||||
* If a file is built in, the path is shown to user in url field (no sensitive infos are provided).
|
||||
*
|
||||
* @return bool true if the attachment is using an builtin file
|
||||
* @return bool true if the attachment is using a builtin file
|
||||
*/
|
||||
public function isBuiltIn(): bool
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* The URL to the external file, or the path to the built in file.
|
||||
* The URL to the external file, or the path to the built-in file.
|
||||
* Returns null, if the file is not external (and not builtin).
|
||||
*/
|
||||
public function getURL(): ?string
|
||||
|
@ -455,9 +455,9 @@ abstract class Attachment extends AbstractNamedDBElement
|
|||
* @param string $string The string which should be checked
|
||||
* @param bool $path_required If true, the string must contain a path to be valid. (e.g. foo.bar would be invalid, foo.bar/test.php would be valid).
|
||||
* @param bool $only_http Set this to true, if only HTTPS or HTTP schemata should be allowed.
|
||||
* *Caution: When this is set to false, a attacker could use the file:// schema, to get internal server files, like /etc/passwd.*
|
||||
* *Caution: When this is set to false, an attacker could use the file:// schema, to get internal server files, like /etc/passwd.*
|
||||
*
|
||||
* @return bool True if the string is a valid URL. False, if the string is not an URL or invalid.
|
||||
* @return bool True if the string is a valid URL. False, if the string is not a URL or invalid.
|
||||
*/
|
||||
public static function isValidURL(string $string, bool $path_required = true, bool $only_http = true): bool
|
||||
{
|
||||
|
|
|
@ -46,7 +46,7 @@ abstract class AttachmentContainingDBElement extends AbstractNamedDBElement impl
|
|||
* Mapping is done in sub classes like part
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -45,13 +45,13 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
* @ORM\OneToMany(targetEntity="AttachmentType", mappedBy="parent", cascade={"persist"})
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -65,14 +65,14 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, AttachmentTypeParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\AttachmentTypeParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Attachment>
|
||||
|
@ -99,7 +99,7 @@ class AttachmentType extends AbstractStructuralDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets an filter, which file types are allowed for attachment files.
|
||||
* Gets a filter, which file types are allowed for attachment files.
|
||||
* Must be in the format of <input type=file> accept attribute
|
||||
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
|
||||
*/
|
||||
|
|
|
@ -35,7 +35,7 @@ class AttachmentTypeAttachment extends Attachment
|
|||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
|
||||
/**
|
||||
* @var AttachmentType the element this attachment is associated with
|
||||
* @var AttachmentContainingDBElement|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a category element.
|
||||
* An attachment attached to a category element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
@ -36,7 +36,7 @@ class CategoryAttachment extends Attachment
|
|||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Category::class;
|
||||
/**
|
||||
* @var Category the element this attachment is associated with
|
||||
* @var AttachmentContainingDBElement|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@ class CurrencyAttachment extends Attachment
|
|||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Currency::class;
|
||||
/**
|
||||
* @var Currency the element this attachment is associated with
|
||||
* @var Currency|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a footprint element.
|
||||
* An attachment attached to a footprint element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
@ -36,7 +36,7 @@ class FootprintAttachment extends Attachment
|
|||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Footprint::class;
|
||||
/**
|
||||
* @var Footprint the element this attachment is associated with
|
||||
* @var Footprint|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a Group element.
|
||||
* An attachment attached to a Group element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
class GroupAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Group::class;
|
||||
|
||||
/**
|
||||
* @var Group the element this attachment is associated with
|
||||
* @var Group|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a manufacturer element.
|
||||
* An attachment attached to a manufacturer element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
class ManufacturerAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;
|
||||
|
||||
/**
|
||||
* @var Manufacturer the element this attachment is associated with
|
||||
* @var Manufacturer|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a measurement unit element.
|
||||
* An attachment attached to a measurement unit element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
@ -37,7 +37,7 @@ class MeasurementUnitAttachment extends Attachment
|
|||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
|
||||
/**
|
||||
* @var Manufacturer the element this attachment is associated with
|
||||
* @var Manufacturer|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@ class ProjectAttachment extends Attachment
|
|||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Project::class;
|
||||
/**
|
||||
* @var Project the element this attachment is associated with
|
||||
* @var Project|null 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").
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a measurement unit element.
|
||||
* An attachment attached to a measurement unit element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
class StorelocationAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
|
||||
|
||||
/**
|
||||
* @var Storelocation the element this attachment is associated with
|
||||
* @var Storelocation|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
class SupplierAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = Supplier::class;
|
||||
|
||||
/**
|
||||
* @var Supplier the element this attachment is associated with
|
||||
* @var Supplier|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a user element.
|
||||
* An attachment attached to a user element.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @UniqueEntity({"name", "attachment_type", "element"})
|
||||
|
@ -35,8 +35,9 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|||
class UserAttachment extends Attachment
|
||||
{
|
||||
public const ALLOWED_ELEMENT_CLASS = User::class;
|
||||
|
||||
/**
|
||||
* @var User the element this attachment is associated with
|
||||
* @var User|null the element this attachment is associated with
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="attachments")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
|
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
|
||||
|
@ -33,5 +34,5 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||
{
|
||||
/** @Groups({"full"}) */
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
}
|
||||
|
|
|
@ -81,22 +81,22 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
protected int $level = 0;
|
||||
|
||||
/**
|
||||
* We can not define the mapping here or we will get an exception. Unfortunately we have to do the mapping in the
|
||||
* We can not define the mapping here, or we will get an exception. Unfortunately we have to do the mapping in the
|
||||
* subclasses.
|
||||
*
|
||||
* @var AbstractStructuralDBElement[]|Collection
|
||||
* @Groups({"include_children"})
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @var AbstractStructuralDBElement
|
||||
* @NoneOfItsChildren()
|
||||
* @Groups({"include_parents", "import"})
|
||||
*/
|
||||
protected $parent = null;
|
||||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/** @var string[] all names of all parent elements as a array of strings,
|
||||
/** @var string[] all names of all parent elements as an array of strings,
|
||||
* the last array element is the name of the element itself
|
||||
*/
|
||||
private array $full_path_strings = [];
|
||||
|
@ -106,6 +106,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
parent::__construct();
|
||||
$this->children = new ArrayCollection();
|
||||
$this->parameters = new ArrayCollection();
|
||||
$this->parent = null;
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
|
@ -155,10 +156,8 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
if ($this->getParent() === $another_element) {
|
||||
return true;
|
||||
}
|
||||
} else { //If the IDs are defined, we can compare the IDs
|
||||
if ($this->getParent()->getID() === $another_element->getID()) {
|
||||
return true;
|
||||
}
|
||||
} elseif ($this->getParent()->getID() === $another_element->getID()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Otherwise, check recursively
|
||||
|
@ -168,7 +167,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* Checks if this element is an root element (has no parent).
|
||||
*
|
||||
* @return bool true if the this element is an root element
|
||||
* @return bool true if this element is a root element
|
||||
*/
|
||||
public function isRoot(): bool
|
||||
{
|
||||
|
|
|
@ -27,12 +27,12 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* A entity with this class has a master attachment, which is used as a preview image for this object.
|
||||
* An entity with this class has a master attachment, which is used as a preview image for this object.
|
||||
*/
|
||||
trait MasterAttachmentTrait
|
||||
{
|
||||
/**
|
||||
* @var Attachment
|
||||
* @var Attachment|null
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
|
||||
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true)
|
||||
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
|
||||
|
|
|
@ -27,9 +27,9 @@ use DateTime;
|
|||
interface TimeTravelInterface
|
||||
{
|
||||
/**
|
||||
* Checks if this entry has informations which data has changed.
|
||||
* Checks if this entry has information which data has changed.
|
||||
*
|
||||
* @return bool true if this entry has informations about the changed data
|
||||
* @return bool true if this entry has information about the changed data
|
||||
*/
|
||||
public function hasOldDataInformations(): bool;
|
||||
|
||||
|
@ -39,7 +39,7 @@ interface TimeTravelInterface
|
|||
public function getOldData(): array;
|
||||
|
||||
/**
|
||||
* Returns the the timestamp associated with this change.
|
||||
* Returns the timestamp associated with this change.
|
||||
*/
|
||||
public function getTimestamp(): DateTime;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class LabelProfile extends AttachmentContainingDBElement
|
|||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\LabelAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
* @var LabelOptions
|
||||
|
|
|
@ -48,7 +48,7 @@ use InvalidArgumentException;
|
|||
use Psr\Log\LogLevel;
|
||||
|
||||
/**
|
||||
* This entity describes a entry in the event log.
|
||||
* This entity describes an entry in the event log.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\LogEntryRepository")
|
||||
* @ORM\Table("log", indexes={
|
||||
|
@ -142,7 +142,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
self::TARGET_TYPE_LABEL_PROFILE => LabelProfile::class,
|
||||
];
|
||||
|
||||
/** @var User The user which has caused this log entry
|
||||
/** @var User|null The user which has caused this log entry
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", fetch="EAGER")
|
||||
* @ORM\JoinColumn(name="id_user", nullable=true, onDelete="SET NULL")
|
||||
*/
|
||||
|
@ -183,7 +183,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
/** @var array The extra data in raw (short form) saved in the DB
|
||||
* @ORM\Column(name="extra", type="json")
|
||||
*/
|
||||
protected $extra = [];
|
||||
protected array $extra = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -340,7 +340,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/**
|
||||
* 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 a log entry.
|
||||
*
|
||||
* @return string|null the class name of the target class
|
||||
*/
|
||||
|
@ -355,7 +355,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
|
||||
/**
|
||||
* Returns the ID 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 a log entry.
|
||||
*
|
||||
* @return int|null the ID of the associated element
|
||||
*/
|
||||
|
@ -451,7 +451,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts an target type id to an full qualified class name.
|
||||
* Converts a target type id to a full qualified class name.
|
||||
*
|
||||
* @param int $type_id The target type ID
|
||||
*/
|
||||
|
|
|
@ -81,13 +81,12 @@ use App\Entity\Parts\Supplier;
|
|||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Repository\Parts\ManufacturerRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @ORM\Entity()
|
||||
* This log entry is created when an element is deleted, that is used in a collection of an other entity.
|
||||
* This log entry is created when an element is deleted, that is used in a collection of another entity.
|
||||
* This is needed to signal time travel, that it has to undelete the deleted entity.
|
||||
*/
|
||||
class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventUndoInterface
|
||||
|
|
|
@ -43,7 +43,7 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
|||
*/
|
||||
public function isSuccessful(): bool
|
||||
{
|
||||
//We dont save unsuccessful updates now, so just assume it to save space.
|
||||
//We don't save unsuccessful updates now, so just assume it to save space.
|
||||
return $this->extra['s'] ?? true;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class LegacyInstockChangedLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the price that has to be payed for the change (in the base currency).
|
||||
* Returns the price that has to be paid for the change (in the base currency).
|
||||
*
|
||||
* @param bool $absolute Set this to true, if you want only get the absolute value of the price (without minus)
|
||||
*/
|
||||
|
@ -92,9 +92,9 @@ class LegacyInstockChangedLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if the Change was an withdrawal of parts.
|
||||
* Checks if the Change was a withdrawal of parts.
|
||||
*
|
||||
* @return bool true if the change was an withdrawal, false if not
|
||||
* @return bool true if the change was a withdrawal, false if not
|
||||
*/
|
||||
public function isWithdrawal(): bool
|
||||
{
|
||||
|
|
|
@ -117,7 +117,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
* Return the (anonymized) IP address used to log in the user.
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -125,9 +125,9 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
* Sets the IP address used to log in the user.
|
||||
*
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param string $ip the IP address used to log in the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -42,7 +42,7 @@ class UserLoginLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
* Return the (anonymized) IP address used to log in the user.
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -50,9 +50,9 @@ class UserLoginLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
* Sets the IP address used to log in the user.
|
||||
*
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param string $ip the IP address used to log in the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -40,7 +40,7 @@ class UserLogoutLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the (anonymized) IP address used to login the user.
|
||||
* Return the (anonymized) IP address used to log in the user.
|
||||
*/
|
||||
public function getIPAddress(): string
|
||||
{
|
||||
|
@ -48,9 +48,9 @@ class UserLogoutLogEntry extends AbstractLogEntry
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the IP address used to login the user.
|
||||
* Sets the IP address used to log in the user.
|
||||
*
|
||||
* @param string $ip the IP address used to login the user
|
||||
* @param string $ip the IP address used to log in the user
|
||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||
*
|
||||
* @return $this
|
||||
|
|
|
@ -139,11 +139,11 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
protected string $group = '';
|
||||
|
||||
/**
|
||||
* Mapping is done in sub classes.
|
||||
* Mapping is done in subclasses.
|
||||
*
|
||||
* @var AbstractDBElement|null the element to which this parameter belongs to
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
|
@ -57,5 +58,5 @@ class AttachmentTypeParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Category;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -57,5 +58,5 @@ class CategoryParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,12 +41,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* A attachment attached to a category element.
|
||||
* An attachment attached to a category element.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\ParameterRepository")
|
||||
* @UniqueEntity(fields={"name", "group", "element"})
|
||||
|
@ -60,5 +61,5 @@ class CurrencyParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -58,5 +59,5 @@ class FootprintParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -58,5 +59,5 @@ class GroupParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -58,5 +59,5 @@ class ManufacturerParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -58,5 +59,5 @@ class MeasurementUnitParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ trait ParametersTrait
|
|||
* @var Collection<int, AbstractParameter>
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
* Return all associated specifications.
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Part;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -58,5 +59,5 @@ class PartParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -58,5 +59,5 @@ class ProjectParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\ProjectSystem\Project", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -58,5 +59,5 @@ class StorelocationParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Entity\Parameters;
|
||||
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
@ -58,5 +59,5 @@ class SupplierParameter extends AbstractParameter
|
|||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="parameters")
|
||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||
*/
|
||||
protected $element;
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\CategoryParameter;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
@ -46,13 +47,13 @@ class Category extends AbstractPartsContainingDBElement
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @var Collection
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?AbstractStructuralDBElement $parent = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -109,6 +110,7 @@ class Category extends AbstractPartsContainingDBElement
|
|||
* @Groups({"full", "import"})
|
||||
*/
|
||||
protected string $default_comment = '';
|
||||
|
||||
/**
|
||||
* @var Collection<int, CategoryAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
|
@ -116,7 +118,7 @@ class Category extends AbstractPartsContainingDBElement
|
|||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, CategoryParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CategoryParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
|
@ -124,7 +126,7 @@ class Category extends AbstractPartsContainingDBElement
|
|||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
public function getPartnameHint(): string
|
||||
{
|
||||
|
|
|
@ -44,14 +44,14 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
* @ORM\ManyToOne(targetEntity="Footprint", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Footprint", mappedBy="parent")
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @var Collection
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @var Collection<int, FootprintAttachment>
|
||||
|
@ -59,7 +59,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
* @var FootprintAttachment|null
|
||||
|
@ -73,7 +73,7 @@ class Footprint extends AbstractPartsContainingDBElement
|
|||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/****************************************
|
||||
* Getters
|
||||
|
|
|
@ -44,14 +44,14 @@ class Manufacturer extends AbstractCompany
|
|||
* @ORM\ManyToOne(targetEntity="Manufacturer", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Manufacturer", mappedBy="parent")
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @var Collection
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @var Collection<int, ManufacturerAttachment>
|
||||
|
@ -59,12 +59,12 @@ class Manufacturer extends AbstractCompany
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, ManufacturerParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ManufacturerParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
}
|
||||
|
|
|
@ -75,13 +75,13 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @var Collection
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="MeasurementUnit", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?\App\Entity\Base\AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @var Collection<int, MeasurementUnitAttachment>
|
||||
|
@ -89,14 +89,14 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, MeasurementUnitParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\MeasurementUnitParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
|
|
|
@ -26,7 +26,6 @@ use App\Entity\Attachments\Attachment;
|
|||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Parts\PartTraits\ProjectTrait;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parameters\ParametersTrait;
|
||||
use App\Entity\Parameters\PartParameter;
|
||||
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
|
||||
|
@ -34,7 +33,6 @@ use App\Entity\Parts\PartTraits\BasicPropertyTrait;
|
|||
use App\Entity\Parts\PartTraits\InstockTrait;
|
||||
use App\Entity\Parts\PartTraits\ManufacturerTrait;
|
||||
use App\Entity\Parts\PartTraits\OrderTrait;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
use DateTime;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -48,7 +46,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
|||
* Part class.
|
||||
*
|
||||
* The class properties are split over various traits in directory PartTraits.
|
||||
* Otherwise this class would be too big, to be maintained.
|
||||
* Otherwise, this class would be too big, to be maintained.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\PartRepository")
|
||||
* @ORM\Table("`parts`", indexes={
|
||||
|
@ -75,7 +73,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime", name="datetime_added", options={"default":"CURRENT_TIMESTAMP"})
|
||||
|
@ -100,16 +98,16 @@ class Part extends AttachmentContainingDBElement
|
|||
* @Assert\Valid()
|
||||
* @Groups({"full"})
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
* @var DateTime the date when this element was modified the last time
|
||||
* @var DateTime|null the date when this element was modified the last time
|
||||
* @ORM\Column(type="datetime", name="last_modified", options={"default":"CURRENT_TIMESTAMP"})
|
||||
*/
|
||||
protected ?DateTime $lastModified = null;
|
||||
|
||||
/**
|
||||
* @var Attachment
|
||||
* @var Attachment|null
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
|
||||
* @ORM\JoinColumn(name="id_preview_attachment", referencedColumnName="id", onDelete="SET NULL", nullable=true)
|
||||
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
|
||||
|
|
|
@ -130,7 +130,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
|
||||
/**
|
||||
* Check if the current part lot is expired.
|
||||
* This is the case, if the expiration date is greater the the current date.
|
||||
* This is the case, if the expiration date is greater the current date.
|
||||
*
|
||||
* @return bool|null True, if the part lot is expired. Returns null, if no expiration date was set.
|
||||
*
|
||||
|
@ -195,7 +195,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the expiration date for the part lot. Set to null, if the part lot does not expires.
|
||||
* Sets the expiration date for the part lot. Set to null, if the part lot does not expire.
|
||||
*
|
||||
* @param DateTime|null $expiration_date
|
||||
*
|
||||
|
|
|
@ -55,7 +55,7 @@ trait AdvancedPropertyTrait
|
|||
protected ?float $mass = null;
|
||||
|
||||
/**
|
||||
* @var string The internal part number of the part
|
||||
* @var string|null The internal part number of the part
|
||||
* @ORM\Column(type="string", length=100, nullable=true, unique=true)
|
||||
* @Assert\Length(max="100")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
|
|
|
@ -46,7 +46,7 @@ trait BasicPropertyTrait
|
|||
protected string $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool Kept for compatibility (it is not used now, and I dont think it was used in old versions)
|
||||
* @var bool Kept for compatibility (it is not used now, and I don't think it was used in old versions)
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected bool $visible = true;
|
||||
|
@ -59,7 +59,7 @@ trait BasicPropertyTrait
|
|||
protected bool $favorite = false;
|
||||
|
||||
/**
|
||||
* @var Category The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping.
|
||||
* @var Category|null The category this part belongs too (e.g. Resistors). Use tags, for more complex grouping.
|
||||
* Every part must have a category.
|
||||
* @ORM\ManyToOne(targetEntity="Category")
|
||||
* @ORM\JoinColumn(name="id_category", referencedColumnName="id", nullable=false)
|
||||
|
@ -136,7 +136,7 @@ trait BasicPropertyTrait
|
|||
/**
|
||||
* Gets the Footprint of this part (e.g. DIP8).
|
||||
*
|
||||
* @return Footprint|null The footprint of this part. Null if this part should no have a footprint.
|
||||
* @return Footprint|null The footprint of this part. Null if this part should not have a footprint.
|
||||
*/
|
||||
public function getFootprint(): ?Footprint
|
||||
{
|
||||
|
|
|
@ -122,7 +122,7 @@ trait InstockTrait
|
|||
|
||||
/**
|
||||
* Get the count of parts which must be in stock at least.
|
||||
* If a integer-based part unit is selected, the value will be rounded to integers.
|
||||
* If an integer-based part unit is selected, the value will be rounded to integers.
|
||||
*
|
||||
* @return float count of parts which must be in stock at least
|
||||
*/
|
||||
|
@ -160,9 +160,25 @@ trait InstockTrait
|
|||
return $this->getAmountSum() < $this->getMinAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true, if at least one of the part lots has an unknown amount.
|
||||
* It is possible that other part lots have a known amount, then getAmountSum() will return sum of all known amounts.
|
||||
* @return bool True if at least one part lot has an unknown amount.
|
||||
*/
|
||||
public function isAmountUnknown(): bool
|
||||
{
|
||||
foreach ($this->getPartLots() as $lot) {
|
||||
if ($lot->isInstockUnknown()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the summed amount of this part (over all part lots)
|
||||
* Part Lots that have unknown value or are expired, are not used for this value.
|
||||
* Part Lots that have unknown value or are expired, are not used for this value (counted as 0).
|
||||
*
|
||||
* @return float The amount of parts given in partUnit
|
||||
*/
|
||||
|
@ -171,7 +187,7 @@ trait InstockTrait
|
|||
//TODO: Find a method to do this natively in SQL, the current method could be a bit slow
|
||||
$sum = 0;
|
||||
foreach ($this->getPartLots() as $lot) {
|
||||
//Dont use the instock value, if it is unkown
|
||||
//Don't use the in stock value, if it is unknown
|
||||
if ($lot->isInstockUnknown() || $lot->isExpired() ?? false) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ trait ManufacturerTrait
|
|||
protected string $manufacturer_product_number = '';
|
||||
|
||||
/**
|
||||
* @var string The production status of this part. Can be one of the specified ones.
|
||||
* @var string|null The production status of this part. Can be one of the specified ones.
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""})
|
||||
* @Groups({"extended", "full", "import"})
|
||||
|
|
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
|||
namespace App\Entity\Parts\PartTraits;
|
||||
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use function count;
|
||||
|
@ -57,7 +56,7 @@ trait OrderTrait
|
|||
protected bool $manual_order = false;
|
||||
|
||||
/**
|
||||
* @var Orderdetail
|
||||
* @var Orderdetail|null
|
||||
* @ORM\OneToOne(targetEntity="App\Entity\PriceInformations\Orderdetail")
|
||||
* @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id")
|
||||
*/
|
||||
|
|
|
@ -41,7 +41,7 @@ trait ProjectTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the project that this part represents the builds of, or null if it doesnt
|
||||
* Returns the project that this part represents the builds of, or null if it doesn't
|
||||
* @return Project|null
|
||||
*/
|
||||
public function getBuiltProject(): ?Project
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\StorelocationAttachment;
|
||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\StorelocationParameter;
|
||||
use App\Entity\UserSystem\User;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
@ -47,13 +48,13 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @var Collection
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here
|
||||
|
@ -67,7 +68,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -109,7 +110,7 @@ class Storelocation extends AbstractPartsContainingDBElement
|
|||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/********************************************************************************
|
||||
*
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace App\Entity\Parts;
|
|||
|
||||
use App\Entity\Attachments\SupplierAttachment;
|
||||
use App\Entity\Base\AbstractCompany;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\Parameters\SupplierParameter;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Validator\Constraints\BigDecimal\BigDecimalPositiveOrZero;
|
||||
|
@ -50,18 +51,18 @@ class Supplier extends AbstractCompany
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @var Collection
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Supplier", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="supplier")
|
||||
*/
|
||||
protected $orderdetails;
|
||||
protected Collection $orderdetails;
|
||||
|
||||
/**
|
||||
* @var Currency|null The currency that should be used by default for order informations with this supplier.
|
||||
|
@ -86,14 +87,14 @@ class Supplier extends AbstractCompany
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, SupplierParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\SupplierParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/**
|
||||
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
|
||||
|
|
|
@ -69,13 +69,13 @@ class Currency extends AbstractStructuralDBElement
|
|||
* @ORM\OneToMany(targetEntity="Currency", mappedBy="parent", cascade={"persist"})
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Currency", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @var Collection<int, CurrencyAttachment>
|
||||
|
@ -83,19 +83,19 @@ class Currency extends AbstractStructuralDBElement
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, CurrencyParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\CurrencyParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/** @var Collection<int, Pricedetail>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Pricedetail", mappedBy="currency")
|
||||
*/
|
||||
protected $pricedetails;
|
||||
protected Collection $pricedetails;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
* @ORM\OrderBy({"min_discount_quantity" = "ASC"})
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
protected $pricedetails;
|
||||
protected Collection $pricedetails;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
@ -82,7 +82,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
protected string $supplier_product_url = '';
|
||||
|
||||
/**
|
||||
* @var Part
|
||||
* @var Part|null
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails")
|
||||
* @ORM\JoinColumn(name="part_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
|
||||
* @Assert\NotNull()
|
||||
|
@ -90,7 +90,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N
|
|||
protected ?Part $part = null;
|
||||
|
||||
/**
|
||||
* @var Supplier
|
||||
* @var Supplier|null
|
||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails")
|
||||
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id")
|
||||
* @Assert\NotNull(message="validator.orderdetail.supplier_must_not_be_null")
|
||||
|
|
|
@ -266,9 +266,9 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*
|
||||
* @param BigDecimal $new_price the new price as a float number
|
||||
*
|
||||
* * This is the price for "price_related_quantity" parts!!
|
||||
* * Example: if "price_related_quantity" is '10',
|
||||
* you have to set here the price for 10 parts!
|
||||
* This is the price for "price_related_quantity" parts!!
|
||||
* Example: if "price_related_quantity" is 10,
|
||||
* you have to set here the price for 10 parts!
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
|
|
@ -47,20 +47,20 @@ class Project extends AbstractStructuralDBElement
|
|||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @var Collection
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Project", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="ProjectBOMEntry", mappedBy="project", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @Groups({"extended", "full"})
|
||||
*/
|
||||
protected $bom_entries;
|
||||
protected Collection $bom_entries;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
|
@ -68,7 +68,7 @@ class Project extends AbstractStructuralDBElement
|
|||
protected int $order_quantity = 0;
|
||||
|
||||
/**
|
||||
* @var string The current status of the project
|
||||
* @var string|null The current status of the project
|
||||
* @ORM\Column(type="string", length=64, nullable=true)
|
||||
* @Assert\Choice({"draft","planning","in_production","finished","archived"})
|
||||
* @Groups({"extended", "full"})
|
||||
|
@ -98,13 +98,13 @@ class Project extends AbstractStructuralDBElement
|
|||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ProjectAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var Collection<int, ProjectParameter>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Parameters\ProjectParameter", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
/********************************************************************************
|
||||
*
|
||||
|
@ -116,6 +116,7 @@ class Project extends AbstractStructuralDBElement
|
|||
{
|
||||
parent::__construct();
|
||||
$this->bom_entries = new ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
|
|
|
@ -61,7 +61,7 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
protected string $mountnames = '';
|
||||
|
||||
/**
|
||||
* @var string An optional name describing this BOM entry (useful for non-part entries)
|
||||
* @var string|null An optional name describing this BOM entry (useful for non-part entries)
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
* @Assert\Expression(
|
||||
* "this.getPart() !== null or this.getName() !== null",
|
||||
|
@ -77,7 +77,7 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
protected string $comment;
|
||||
|
||||
/**
|
||||
* @var Project
|
||||
* @var Project|null
|
||||
* @ORM\ManyToOne(targetEntity="Project", inversedBy="bom_entries")
|
||||
* @ORM\JoinColumn(name="id_device", referencedColumnName="id")
|
||||
*/
|
||||
|
@ -91,7 +91,7 @@ class ProjectBOMEntry extends AbstractDBElement
|
|||
protected ?Part $part = null;
|
||||
|
||||
/**
|
||||
* @var BigDecimal The price of this non-part BOM entry
|
||||
* @var BigDecimal|null The price of this non-part BOM entry
|
||||
* @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true)
|
||||
* @Assert\AtLeastOneOf({
|
||||
* @BigDecimalPositive(),
|
||||
|
|
|
@ -34,7 +34,7 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
|||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* This entity represents an user group.
|
||||
* This entity represents a user group.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table("`groups`", indexes={
|
||||
|
@ -47,35 +47,35 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
/**
|
||||
* @ORM\OneToMany(targetEntity="Group", mappedBy="parent")
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @var Collection
|
||||
* @var Collection<int, self>
|
||||
*/
|
||||
protected $children;
|
||||
protected Collection $children;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $parent;
|
||||
protected ?AbstractStructuralDBElement $parent;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="User", mappedBy="group")
|
||||
* @var Collection<User>
|
||||
* @var Collection<int, User>
|
||||
*/
|
||||
protected $users;
|
||||
protected Collection $users;
|
||||
|
||||
/**
|
||||
* @var bool If true all users associated with this group must have enabled some kind of 2 factor authentication
|
||||
* @var bool If true all users associated with this group must have enabled some kind of two-factor authentication
|
||||
* @ORM\Column(type="boolean", name="enforce_2fa")
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
protected $enforce2FA = false;
|
||||
protected bool $enforce2FA = false;
|
||||
/**
|
||||
* @var Collection<int, GroupAttachment>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\GroupAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/**
|
||||
* @var PermissionData|null
|
||||
|
@ -90,13 +90,14 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
|||
* @ORM\OrderBy({"group" = "ASC" ,"name" = "ASC"})
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
protected $parameters;
|
||||
protected Collection $parameters;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->permissions = new PermissionData();
|
||||
$this->users = new ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,7 @@ final class PermissionData implements \JsonSerializable
|
|||
public const CURRENT_SCHEMA_VERSION = 2;
|
||||
|
||||
/**
|
||||
* @var array This array contains the permission values for each permission
|
||||
* @var array|null This array contains the permission values for each permission
|
||||
* This array contains the permission values for each permission, in the form of:
|
||||
* permission => [
|
||||
* operation => value,
|
||||
|
@ -57,7 +57,7 @@ final class PermissionData implements \JsonSerializable
|
|||
|
||||
/**
|
||||
* Creates a new Permission Data Instance using the given data.
|
||||
* By default, a empty array is used, meaning
|
||||
* By default, an empty array is used, meaning
|
||||
*/
|
||||
public function __construct(array $data = [])
|
||||
{
|
||||
|
@ -203,9 +203,9 @@ final class PermissionData implements \JsonSerializable
|
|||
|
||||
/**
|
||||
* Returns an JSON encodable representation of this object.
|
||||
* @return array|mixed
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
public function jsonSerialize(): array
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
|
@ -216,7 +216,7 @@ final class PermissionData implements \JsonSerializable
|
|||
continue;
|
||||
}
|
||||
|
||||
$ret[$permission] = array_filter($operations, function ($value) {
|
||||
$ret[$permission] = array_filter($operations, static function ($value) {
|
||||
return $value !== null;
|
||||
});
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ use Jbtronics\TFAWebauthn\Model\TwoFactorInterface as WebauthnTwoFactorInterface
|
|||
|
||||
/**
|
||||
* This entity represents a user, which can log in and have permissions.
|
||||
* Also this entity is able to save some informations about the user, like the names, email-address and other info.
|
||||
* Also, this entity is able to save some information about the user, like the names, email-address and other info.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
|
||||
* @ORM\Table("`users`", indexes={
|
||||
|
@ -130,7 +130,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* @var Group|null the group this user belongs to
|
||||
* DO NOT PUT A fetch eager here! Otherwise you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions.
|
||||
* DO NOT PUT A fetch eager here! Otherwise, you can not unset the group of a user! This seems to be some kind of bug in doctrine. Maybe this is fixed in future versions.
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="users")
|
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="id")
|
||||
* @Selectable()
|
||||
|
@ -139,7 +139,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected ?Group $group = null;
|
||||
|
||||
/**
|
||||
* @var string|null The secret used for google authenticator
|
||||
* @var string|null The secret used for Google authenticator
|
||||
* @ORM\Column(name="google_authenticator_secret", type="string", nullable=true)
|
||||
*/
|
||||
protected ?string $googleAuthenticatorSecret = null;
|
||||
|
@ -216,7 +216,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected string $name = '';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var array|null
|
||||
* @ORM\Column(type="json")
|
||||
*/
|
||||
protected ?array $settings = [];
|
||||
|
@ -226,7 +226,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\UserAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ORM\OrderBy({"name" = "ASC"})
|
||||
*/
|
||||
protected $attachments;
|
||||
protected Collection $attachments;
|
||||
|
||||
/** @var DateTime|null The time when the backup codes were generated
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
|
@ -237,13 +237,13 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/** @var Collection<int, LegacyU2FKeyInterface>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\U2FKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $u2fKeys;
|
||||
protected Collection $u2fKeys;
|
||||
|
||||
/**
|
||||
* @var Collection<int, WebauthnKey>
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\UserSystem\WebauthnKey", mappedBy="user", cascade={"REMOVE"}, orphanRemoval=true)
|
||||
*/
|
||||
protected $webauthn_keys;
|
||||
protected Collection $webauthn_keys;
|
||||
|
||||
/**
|
||||
* @var Currency|null The currency the user wants to see prices in.
|
||||
|
@ -255,10 +255,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
* @Selectable()
|
||||
* @Groups({"extended", "full", "import"})
|
||||
*/
|
||||
protected $currency;
|
||||
protected ?Currency $currency;
|
||||
|
||||
/**
|
||||
* @var PermissionData
|
||||
* @var PermissionData|null
|
||||
* @ValidPermission()
|
||||
* @ORM\Embedded(class="PermissionData", columnPrefix="permissions_")
|
||||
* @Groups({"simple", "extended", "full", "import"})
|
||||
|
@ -266,10 +266,10 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
protected ?PermissionData $permissions = null;
|
||||
|
||||
/**
|
||||
* @var DateTime the time until the password reset token is valid
|
||||
* @var DateTime|null the time until the password reset token is valid
|
||||
* @ORM\Column(type="datetime", nullable=true, options={"default": null})
|
||||
*/
|
||||
protected $pw_reset_expires;
|
||||
protected ?DateTime $pw_reset_expires;
|
||||
|
||||
/**
|
||||
* @var bool True if the user was created by a SAML provider (and therefore cannot change its password)
|
||||
|
@ -409,7 +409,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if this user is disabled (user cannot login any more).
|
||||
* Checks if this user is disabled (user cannot log in any more).
|
||||
*
|
||||
* @return bool true, if the user is disabled
|
||||
*/
|
||||
|
@ -516,7 +516,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
public function getFullName(bool $including_username = false): string
|
||||
{
|
||||
$tmp = $this->getFirstName();
|
||||
//Dont add a space, if the name has only one part (it would look strange)
|
||||
//Don't add a space, if the name has only one part (it would look strange)
|
||||
if (!empty($this->getFirstName()) && !empty($this->getLastName())) {
|
||||
$tmp .= ' ';
|
||||
}
|
||||
|
@ -683,9 +683,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
|
||||
/**
|
||||
* Gets the language the user prefers (as 2 letter ISO code).
|
||||
* Gets the language the user prefers (as 2-letter ISO code).
|
||||
*
|
||||
* @return string|null The 2 letter ISO code of the preferred language (e.g. 'en' or 'de').
|
||||
* @return string|null The 2-letter ISO code of the preferred language (e.g. 'en' or 'de').
|
||||
* If null is returned, the user has not specified a language and the server wide language should be used.
|
||||
*/
|
||||
public function getLanguage(): ?string
|
||||
|
@ -696,8 +696,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the language the user prefers.
|
||||
*
|
||||
* @param string|null $language The new language as 2 letter ISO code (e.g. 'en' or 'de').
|
||||
* Set to null, to use the system wide language.
|
||||
* @param string|null $language The new language as 2-letter ISO code (e.g. 'en' or 'de').
|
||||
* Set to null, to use the system-wide language.
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
|
@ -744,8 +744,8 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Change the theme the user wants to see.
|
||||
*
|
||||
* @param string|null $theme The name of the theme (See See self::AVAILABLE_THEMES for valid values). Set to null
|
||||
* if the system wide theme should be used.
|
||||
* @param string|null $theme The name of the theme (See self::AVAILABLE_THEMES for valid values). Set to null
|
||||
* if the system-wide theme should be used.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -789,7 +789,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the user name that should be shown in Google Authenticator.
|
||||
* Return the username that should be shown in Google Authenticator.
|
||||
*/
|
||||
public function getGoogleAuthenticatorUsername(): string
|
||||
{
|
||||
|
@ -893,7 +893,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
|
||||
/**
|
||||
* Invalidate all trusted device tokens at once, by incrementing the token version.
|
||||
* You have to flush the changes to database afterwards.
|
||||
* You have to flush the changes to database afterward.
|
||||
*/
|
||||
public function invalidateTrustedDeviceTokens(): void
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue