mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
3438f15274
commit
6ddc937ec5
32 changed files with 111 additions and 208 deletions
|
@ -205,7 +205,6 @@ abstract class BaseAdminController extends AbstractController
|
|||
|
||||
//Show errors to user:
|
||||
foreach ($errors as $error) {
|
||||
dump($error);
|
||||
$this->addFlash('error', $error['entity']->getFullPath().':'.$error['violations']);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ class AttachmentFileController extends AbstractController
|
|||
*
|
||||
* @return BinaryFileResponse
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function download(Attachment $attachment, AttachmentManager $helper)
|
||||
{
|
||||
|
|
|
@ -151,7 +151,9 @@ class PartController extends AbstractController
|
|||
$cid = $request->get('cid', 1);
|
||||
|
||||
$category = $em->find(Category::class, $cid);
|
||||
if($category !== null) {
|
||||
$new_part->setCategory($category);
|
||||
}
|
||||
|
||||
$form = $this->createForm(PartBaseType::class, $new_part);
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class RedirectController extends AbstractController
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if mod_rewrite is availabe (URL rewriting is possible).
|
||||
* Check if mod_rewrite is available (URL rewriting is possible).
|
||||
* If this is true, we can redirect to /en, otherwise we have to redirect to index.php/en.
|
||||
* When the PHP is not used via Apache SAPI, we just assume that URL rewriting is available.
|
||||
*
|
||||
|
|
|
@ -39,9 +39,9 @@ use Symfony\Component\Serializer\Serializer;
|
|||
class TypeaheadController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/builtInRessources/search/{query}", name="typeahead_builtInRessources", requirements={"query"= ".+"})
|
||||
* @Route("/builtInResources/search/{query}", name="typeahead_builtInRessources", requirements={"query"= ".+"})
|
||||
*/
|
||||
public function builtInRessources(Request $request, string $query, BuiltinAttachmentsFinder $finder)
|
||||
public function builtInResources(Request $request, string $query, BuiltinAttachmentsFinder $finder)
|
||||
{
|
||||
$array = $finder->find($query);
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ class UserController extends AdminPages\BaseAdminController
|
|||
*/
|
||||
public function delete(Request $request, User $entity, StructuralElementRecursionHelper $recursionHelper)
|
||||
{
|
||||
if (User::ID_ANONYMOUS == $entity->getID()) {
|
||||
if (User::ID_ANONYMOUS === $entity->getID()) {
|
||||
throw new \InvalidArgumentException('You can not delete the anonymous user! It is needed for permission checking without a logged in user');
|
||||
}
|
||||
|
||||
|
@ -120,6 +120,7 @@ class UserController extends AdminPages\BaseAdminController
|
|||
//If no user id was passed, then we show info about the current user
|
||||
if (null === $user) {
|
||||
$user = $this->getUser();
|
||||
|
||||
} else {
|
||||
//Else we must check, if the current user is allowed to access $user
|
||||
$this->denyAccessUnlessGranted('read', $user);
|
||||
|
|
|
@ -20,25 +20,6 @@
|
|||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Part-DB Version 0.4+ "nextgen"
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
|
@ -101,7 +82,7 @@ abstract class Attachment extends NamedDBElement
|
|||
protected $path = '';
|
||||
|
||||
/**
|
||||
* @var string The original filenamethe file had, when the user uploaded it.
|
||||
* @var string The original filename the file had, when the user uploaded it.
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $original_filename;
|
||||
|
@ -120,7 +101,7 @@ abstract class Attachment extends NamedDBElement
|
|||
protected $attachment_type;
|
||||
|
||||
/**
|
||||
* @var string The class of the element that can be passed to this attachment. Must be overriden in subclasses.
|
||||
* @var string The class of the element that can be passed to this attachment. Must be overridden in subclasses.
|
||||
*/
|
||||
public const ALLOWED_ELEMENT_CLASS = '';
|
||||
|
||||
|
@ -137,7 +118,7 @@ abstract class Attachment extends NamedDBElement
|
|||
***********************************************************/
|
||||
|
||||
/**
|
||||
* Check if this attachement is a picture (analyse the file's extension).
|
||||
* Check if this attachment is a picture (analyse the file's extension).
|
||||
* If the link is external, it is assumed that this is true.
|
||||
*
|
||||
* @return bool * true if the file extension is a picture extension
|
||||
|
@ -156,7 +137,7 @@ abstract class Attachment extends NamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if this attachment is a 3D model and therfore can be directly shown to user.
|
||||
* Check if this attachment is a 3D model and therefore can be directly shown to user.
|
||||
* If the attachment is external, false is returned (3D Models must be internal).
|
||||
*
|
||||
* @return bool
|
||||
|
@ -185,7 +166,7 @@ abstract class Attachment extends NamedDBElement
|
|||
return false;
|
||||
}
|
||||
|
||||
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placholder via explode
|
||||
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placeholder via explode
|
||||
$tmp = explode('/', $this->path);
|
||||
|
||||
if (empty($tmp)) {
|
||||
|
@ -203,7 +184,7 @@ abstract class Attachment extends NamedDBElement
|
|||
*/
|
||||
public function isSecure(): bool
|
||||
{
|
||||
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placholder via explode
|
||||
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placeholder via explode
|
||||
$tmp = explode('/', $this->path);
|
||||
|
||||
if (empty($tmp)) {
|
||||
|
@ -217,7 +198,7 @@ abstract class Attachment extends NamedDBElement
|
|||
* 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 uning an builtin file.
|
||||
* @return bool True if the attachment is using an builtin file.
|
||||
*/
|
||||
public function isBuiltIn(): bool
|
||||
{
|
||||
|
@ -251,7 +232,7 @@ abstract class Attachment extends NamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the element, associated with this Attachement (for example a "Part" object).
|
||||
* Get the element, associated with this Attachment (for example a "Part" object).
|
||||
*
|
||||
* @return AttachmentContainingDBElement The associated Element.
|
||||
*/
|
||||
|
@ -343,8 +324,8 @@ abstract class Attachment extends NamedDBElement
|
|||
/**
|
||||
* Get the show_in_table attribute.
|
||||
*
|
||||
* @return bool true means, this attachement will be listed in the "Attachements" column of the HTML tables
|
||||
* false means, this attachement won't be listed in the "Attachements" column of the HTML tables
|
||||
* @return bool true means, this attachment will be listed in the "Attachments" column of the HTML tables
|
||||
* false means, this attachment won't be listed in the "Attachments" column of the HTML tables
|
||||
*/
|
||||
public function getShowInTable(): bool
|
||||
{
|
||||
|
@ -377,6 +358,7 @@ abstract class Attachment extends NamedDBElement
|
|||
****************************************************************************************************/
|
||||
|
||||
/**
|
||||
* @param bool $show_in_table
|
||||
* @return self
|
||||
*/
|
||||
public function setShowInTable(bool $show_in_table): self
|
||||
|
@ -386,6 +368,11 @@ abstract class Attachment extends NamedDBElement
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the element that is associated with this attachment.
|
||||
* @param AttachmentContainingDBElement $element
|
||||
* @return $this
|
||||
*/
|
||||
public function setElement(AttachmentContainingDBElement $element): self
|
||||
{
|
||||
if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
||||
|
@ -398,6 +385,8 @@ abstract class Attachment extends NamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the filepath (with relative placeholder) for this attachment
|
||||
* @param string $path The new filepath of the attachment.
|
||||
* @return Attachment
|
||||
*/
|
||||
public function setPath(string $path): self
|
||||
|
@ -408,7 +397,8 @@ abstract class Attachment extends NamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @return Attachment
|
||||
* @param AttachmentType $attachement_type
|
||||
* @return $this
|
||||
*/
|
||||
public function setAttachmentType(AttachmentType $attachement_type): self
|
||||
{
|
||||
|
@ -421,6 +411,7 @@ abstract class Attachment extends NamedDBElement
|
|||
* Sets the url associated with this attachment.
|
||||
* If the url is empty nothing is changed, to not override the file path.
|
||||
*
|
||||
* @param string|null $url
|
||||
* @return Attachment
|
||||
*/
|
||||
public function setURL(?string $url): self
|
||||
|
@ -444,15 +435,15 @@ abstract class Attachment extends NamedDBElement
|
|||
*****************************************************************************************************/
|
||||
|
||||
/**
|
||||
* Checks if the given path is a path to a builtin ressource.
|
||||
* Checks if the given path is a path to a builtin resource.
|
||||
*
|
||||
* @param string $path The path that should be checked
|
||||
*
|
||||
* @return bool True if the path is pointing to a builtin ressource.
|
||||
* @return bool True if the path is pointing to a builtin resource.
|
||||
*/
|
||||
public static function checkIfBuiltin(string $path): bool
|
||||
{
|
||||
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placholder via explode
|
||||
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placeholder via explode
|
||||
$tmp = explode('/', $path);
|
||||
//Builtins must have a %PLACEHOLDER% construction
|
||||
if (empty($tmp)) {
|
||||
|
|
|
@ -20,25 +20,6 @@
|
|||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Part-DB Version 0.4+ "nextgen"
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
|
@ -104,6 +85,7 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
|
|||
/**
|
||||
* Removes the given attachment from this element.
|
||||
*
|
||||
* @param Attachment $attachment
|
||||
* @return $this
|
||||
*/
|
||||
public function removeAttachment(Attachment $attachment): self
|
||||
|
|
|
@ -20,25 +20,6 @@
|
|||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Part-DB Version 0.4+ "nextgen"
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Attachments;
|
||||
|
||||
|
@ -95,7 +76,7 @@ class AttachmentType extends StructuralDBElement
|
|||
/**
|
||||
* Get all attachments ("Attachment" objects) with this type.
|
||||
*
|
||||
* @return Collection|Attachment[] all attachements with this type, as a one-dimensional array of Attachements
|
||||
* @return Collection|Attachment[] all attachments with this type, as a one-dimensional array of Attachments
|
||||
* (sorted by their names)
|
||||
*/
|
||||
public function getAttachmentsForType(): Collection
|
||||
|
@ -116,7 +97,9 @@ class AttachmentType extends StructuralDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @return AttachmentType
|
||||
* Sets the filetype filter pattern.
|
||||
* @param string $filetype_filter The new filetype filter
|
||||
* @return $this
|
||||
*/
|
||||
public function setFiletypeFilter(string $filetype_filter): self
|
||||
{
|
||||
|
|
|
@ -20,25 +20,6 @@
|
|||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Part-DB Version 0.4+ "nextgen"
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
|
@ -86,7 +67,7 @@ abstract class DBElement
|
|||
protected $id;
|
||||
|
||||
/**
|
||||
* Get the ID. The ID can be zero, or even negative (for virtual elements). If an elemenent is virtual, can be
|
||||
* Get the ID. The ID can be zero, or even negative (for virtual elements). If an element is virtual, can be
|
||||
* checked with isVirtualElement().
|
||||
*
|
||||
* Returns null, if the element is not saved to the DB yet.
|
||||
|
|
|
@ -42,7 +42,7 @@ trait MasterAttachmentTrait
|
|||
* Get the master picture "Attachment"-object of this part (if there is one).
|
||||
* The master picture should be used as a visual description/representation of this part.
|
||||
*
|
||||
* @return Attachment the master picture Attachement of this part (if there is one)
|
||||
* @return Attachment the master picture Attachment of this part (if there is one)
|
||||
*/
|
||||
public function getMasterPictureAttachment(): ?Attachment
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ trait MasterAttachmentTrait
|
|||
/**
|
||||
* Sets the new master picture for this part.
|
||||
*
|
||||
* @param Attachment|null $new_master_attachment
|
||||
* @return Part
|
||||
*/
|
||||
public function setMasterPictureAttachment(?Attachment $new_master_attachment): self
|
||||
|
|
|
@ -20,25 +20,6 @@
|
|||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Part-DB Version 0.4+ "nextgen"
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
|
|
|
@ -20,25 +20,6 @@
|
|||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Part-DB Version 0.4+ "nextgen"
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
|
|
|
@ -20,25 +20,6 @@
|
|||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Part-DB Version 0.4+ "nextgen"
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Base;
|
||||
|
||||
|
@ -71,7 +52,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
//This is a not standard character, so build a const, so a dev can easily use it
|
||||
public const PATH_DELIMITER_ARROW = ' → ';
|
||||
|
||||
// We can not define the mapping here or we will get an exception. Unfortunatly 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 StructuralDBElement[]
|
||||
|
@ -145,7 +126,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
|
||||
//If this' parents element, is $another_element, then we are finished
|
||||
return ($this->parent->getID() === $another_element->getID())
|
||||
|| $this->parent->isChildOf($another_element); //Otherwise, check recursivley
|
||||
|| $this->parent->isChildOf($another_element); //Otherwise, check recursively
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,7 +172,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
* The level of the root node is -1.
|
||||
*
|
||||
* @return int the level of this element (zero means a most top element
|
||||
* [a subelement of the root node])
|
||||
* [a sub element of the root node])
|
||||
*/
|
||||
public function getLevel(): int
|
||||
{
|
||||
|
@ -213,11 +194,11 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
/**
|
||||
* Get the full path.
|
||||
*
|
||||
* @param string $delimeter the delimeter of the returned string
|
||||
* @param string $delimiter the delimiter of the returned string
|
||||
*
|
||||
* @return string the full path (incl. the name of this element), delimeted by $delimeter
|
||||
* @return string the full path (incl. the name of this element), delimited by $delimiter
|
||||
*/
|
||||
public function getFullPath(string $delimeter = self::PATH_DELIMITER_ARROW): string
|
||||
public function getFullPath(string $delimiter = self::PATH_DELIMITER_ARROW): string
|
||||
{
|
||||
if (!\is_array($this->full_path_strings)) {
|
||||
$this->full_path_strings = [];
|
||||
|
@ -236,13 +217,13 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
$this->full_path_strings = array_reverse($this->full_path_strings);
|
||||
}
|
||||
|
||||
return implode($delimeter, $this->full_path_strings);
|
||||
return implode($delimiter, $this->full_path_strings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the path to this element (including the element itself).
|
||||
*
|
||||
* @return self[] An array with all (recursivily) parent elements (including this one),
|
||||
* @return self[] An array with all (recursively) parent elements (including this one),
|
||||
* ordered from the lowest levels (root node) first to the highest level (the element itself)
|
||||
*/
|
||||
public function getPathArray(): array
|
||||
|
@ -259,7 +240,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all subelements of this element.
|
||||
* Get all sub elements of this element.
|
||||
*
|
||||
* @param bool $recursive if true, the search is recursive
|
||||
*
|
||||
|
|
|
@ -149,6 +149,7 @@ class Device extends PartsContainingDBElement
|
|||
* Set the "order_only_missing_parts" attribute.
|
||||
*
|
||||
* @param bool $new_order_only_missing_parts the new "order_only_missing_parts" attribute
|
||||
* @return Device
|
||||
*/
|
||||
public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self
|
||||
{
|
||||
|
|
|
@ -20,25 +20,6 @@
|
|||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Part-DB Version 0.4+ "nextgen"
|
||||
* Copyright (C) 2016 - 2019 Jan Böhmer
|
||||
* https://github.com/jbtronics.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
namespace App\Entity\Parts;
|
||||
|
||||
|
@ -145,6 +126,7 @@ class Category extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $partname_hint
|
||||
* @return Category
|
||||
*/
|
||||
public function setPartnameHint(string $partname_hint): self
|
||||
|
@ -163,6 +145,7 @@ class Category extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $partname_regex
|
||||
* @return Category
|
||||
*/
|
||||
public function setPartnameRegex(string $partname_regex): self
|
||||
|
@ -181,6 +164,7 @@ class Category extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_footprints
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableFootprints(bool $disable_footprints): self
|
||||
|
@ -199,6 +183,7 @@ class Category extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_manufacturers
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableManufacturers(bool $disable_manufacturers): self
|
||||
|
@ -217,6 +202,7 @@ class Category extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_autodatasheets
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableAutodatasheets(bool $disable_autodatasheets): self
|
||||
|
@ -235,6 +221,7 @@ class Category extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $disable_properties
|
||||
* @return Category
|
||||
*/
|
||||
public function setDisableProperties(bool $disable_properties): self
|
||||
|
@ -253,6 +240,7 @@ class Category extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $default_description
|
||||
* @return Category
|
||||
*/
|
||||
public function setDefaultDescription(string $default_description): self
|
||||
|
@ -271,6 +259,7 @@ class Category extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $default_comment
|
||||
* @return Category
|
||||
*/
|
||||
public function setDefaultComment(string $default_comment): self
|
||||
|
|
|
@ -127,6 +127,7 @@ class Footprint extends PartsContainingDBElement
|
|||
/**
|
||||
* Sets the 3D Model associated with this footprint.
|
||||
*
|
||||
* @param FootprintAttachment|null $new_attachment The new 3D Model
|
||||
* @return Footprint
|
||||
*/
|
||||
public function setFootprint3d(?FootprintAttachment $new_attachment): self
|
||||
|
|
|
@ -30,7 +30,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
|
||||
/**
|
||||
* This unit represents the unit in which the amount of parts in stock are measured.
|
||||
* This could be something like N, gramms, meters, etc...
|
||||
* This could be something like N, grams, meters, etc...
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table(name="`measurement_units`")
|
||||
|
@ -45,7 +45,7 @@ class MeasurementUnit extends PartsContainingDBElement
|
|||
protected $attachments;
|
||||
|
||||
/**
|
||||
* @var string The unit symbol that should be used for the Unit. This could be something like "", g (for gramms)
|
||||
* @var string The unit symbol that should be used for the Unit. This could be something like "", g (for grams)
|
||||
* or m (for meters).
|
||||
* @ORM\Column(type="string", name="unit", nullable=true)
|
||||
* @Assert\Length(max=10)
|
||||
|
@ -54,7 +54,7 @@ class MeasurementUnit extends PartsContainingDBElement
|
|||
|
||||
/**
|
||||
* @var bool Determines if the amount value associated with this unit should be treated as integer.
|
||||
* Set to false, to measure continuous sizes likes masses or lengthes.
|
||||
* Set to false, to measure continuous sizes likes masses or lengths.
|
||||
* @ORM\Column(type="boolean", name="is_integer")
|
||||
*/
|
||||
protected $is_integer = false;
|
||||
|
@ -122,6 +122,7 @@ class MeasurementUnit extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $isInteger
|
||||
* @return MeasurementUnit
|
||||
*/
|
||||
public function setIsInteger(bool $isInteger): self
|
||||
|
@ -140,6 +141,7 @@ class MeasurementUnit extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $usesSIPrefixes
|
||||
* @return MeasurementUnit
|
||||
*/
|
||||
public function setUseSIPrefix(bool $usesSIPrefixes): self
|
||||
|
|
|
@ -100,7 +100,7 @@ class Part extends AttachmentContainingDBElement
|
|||
protected $lastModified;
|
||||
|
||||
/***************************************************************
|
||||
* Overriden properties
|
||||
* Overridden properties
|
||||
* (They are defined here and not in a trait, to avoid conflicts)
|
||||
****************************************************************/
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class PartLot extends DBElement
|
|||
|
||||
/**
|
||||
* @var ?\DateTime Set a time until when the lot must be used.
|
||||
* Set to null, if the lot can be used indefinitley.
|
||||
* Set to null, if the lot can be used indefinitely.
|
||||
* @ORM\Column(type="datetime", name="expiration_date", nullable=true)
|
||||
*/
|
||||
protected $expiration_date;
|
||||
|
@ -84,7 +84,7 @@ class PartLot extends DBElement
|
|||
protected $instock_unknown = false;
|
||||
|
||||
/**
|
||||
* @var float For continuos sizes (length, volume, etc.) the instock is saved here.
|
||||
* @var float For continuous sizes (length, volume, etc.) the instock is saved here.
|
||||
* @ORM\Column(type="float")
|
||||
* @Assert\PositiveOrZero()
|
||||
*/
|
||||
|
@ -136,6 +136,7 @@ class PartLot extends DBElement
|
|||
/**
|
||||
* Sets the description of the part lot.
|
||||
*
|
||||
* @param string $description
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setDescription(string $description): self
|
||||
|
@ -158,6 +159,7 @@ class PartLot extends DBElement
|
|||
/**
|
||||
* Sets the comment for this part lot.
|
||||
*
|
||||
* @param string $comment
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setComment(string $comment): self
|
||||
|
@ -192,7 +194,7 @@ class PartLot extends DBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the storage locatiion, where this part lot is stored.
|
||||
* Gets the storage location, where this part lot is stored.
|
||||
*
|
||||
* @return Storelocation|null The store location where this part is stored
|
||||
*/
|
||||
|
@ -204,6 +206,7 @@ class PartLot extends DBElement
|
|||
/**
|
||||
* Sets the storage location, where this part lot is stored.
|
||||
*
|
||||
* @param Storelocation|null $storage_location
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setStorageLocation(?Storelocation $storage_location): self
|
||||
|
@ -250,6 +253,7 @@ class PartLot extends DBElement
|
|||
/**
|
||||
* Set the unknown instock status of this part lot.
|
||||
*
|
||||
* @param bool $instock_unknown
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setInstockUnknown(bool $instock_unknown): self
|
||||
|
@ -287,6 +291,7 @@ class PartLot extends DBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $needs_refill
|
||||
* @return PartLot
|
||||
*/
|
||||
public function setNeedsRefill(bool $needs_refill): self
|
||||
|
|
|
@ -37,14 +37,14 @@ trait AdvancedPropertyTrait
|
|||
protected $needs_review = false;
|
||||
|
||||
/**
|
||||
* @var string A comma seperated list of tags, assocciated with the part.
|
||||
* @var string A comma separated list of tags, associated with the part.
|
||||
* @ORM\Column(type="text")
|
||||
* @ColumnSecurity(type="string", prefix="tags", placeholder="")
|
||||
*/
|
||||
protected $tags = '';
|
||||
|
||||
/**
|
||||
* @var float|null How much a single part unit weighs in gramms.
|
||||
* @var float|null How much a single part unit weighs in grams.
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
* @ColumnSecurity(type="float", placeholder=null)
|
||||
* @Assert\PositiveOrZero()
|
||||
|
@ -63,7 +63,7 @@ trait AdvancedPropertyTrait
|
|||
|
||||
/**
|
||||
* Sets the "needs review" status of this part.
|
||||
*
|
||||
* @param bool $needs_review The new status
|
||||
* @return Part|self
|
||||
*/
|
||||
public function setNeedsReview(bool $needs_review): self
|
||||
|
@ -86,6 +86,7 @@ trait AdvancedPropertyTrait
|
|||
/**
|
||||
* Sets a comma separated list of tags, that are assigned to this part.
|
||||
*
|
||||
* @param string $tags The new tags
|
||||
* @return self
|
||||
*/
|
||||
public function setTags(string $tags): self
|
||||
|
@ -110,6 +111,7 @@ trait AdvancedPropertyTrait
|
|||
* Sets the mass of a single part unit.
|
||||
* Sett to null, if the mass is unknown.
|
||||
*
|
||||
* @param float|null $mass The new mass.
|
||||
* @return self
|
||||
*/
|
||||
public function setMass(?float $mass): self
|
||||
|
|
|
@ -70,6 +70,7 @@ trait InstockTrait
|
|||
* Adds the given part lot, to the list of part lots.
|
||||
* The part lot is assigned to this part.
|
||||
*
|
||||
* @param PartLot $lot
|
||||
* @return self
|
||||
*/
|
||||
public function addPartLot(PartLot $lot): self
|
||||
|
@ -109,6 +110,7 @@ trait InstockTrait
|
|||
* Sets the measurement unit in which the part's amount should be measured.
|
||||
* Set to null, if the part should be measured in quantities.
|
||||
*
|
||||
* @param MeasurementUnit|null $partUnit
|
||||
* @return self
|
||||
*/
|
||||
public function setPartUnit(?MeasurementUnit $partUnit): self
|
||||
|
|
|
@ -99,7 +99,7 @@ trait ManufacturerTrait
|
|||
* (Similar to https://designspark.zendesk.com/hc/en-us/articles/213584805-What-are-the-Lifecycle-Status-definitions-)
|
||||
* * "": Status unknown
|
||||
* * "announced": Part has been announced, but is not in production yet
|
||||
* * "active": Part is in production and will be for the forseeable future
|
||||
* * "active": Part is in production and will be for the foreseeable future
|
||||
* * "nrfnd": Not recommended for new designs.
|
||||
* * "eol": Part will become discontinued soon
|
||||
* * "discontinued": Part is obsolete/discontinued by the manufacturer.
|
||||
|
@ -115,6 +115,7 @@ trait ManufacturerTrait
|
|||
* Sets the manufacturing status for this part
|
||||
* See getManufacturingStatus() for valid values.
|
||||
*
|
||||
* @param string $manufacturing_status
|
||||
* @return Part
|
||||
*/
|
||||
public function setManufacturingStatus(string $manufacturing_status): self
|
||||
|
@ -147,6 +148,7 @@ trait ManufacturerTrait
|
|||
/**
|
||||
* Sets the manufacturer product number (MPN) for this part.
|
||||
*
|
||||
* @param string $manufacturer_product_number
|
||||
* @return Part
|
||||
*/
|
||||
public function setManufacturerProductNumber(string $manufacturer_product_number): self
|
||||
|
|
|
@ -32,7 +32,7 @@ use Doctrine\Common\Collections\Collection;
|
|||
trait OrderTrait
|
||||
{
|
||||
/**
|
||||
* @var Orderdetail[] The details about how and where you can order this part.
|
||||
* @var Orderdetail[]|Collection The details about how and where you can order this part.
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ColumnSecurity(prefix="orderdetails", type="collection")
|
||||
|
@ -137,6 +137,7 @@ trait OrderTrait
|
|||
/**
|
||||
* Removes the given orderdetail from the list of orderdetails.
|
||||
*
|
||||
* @param Orderdetail $orderdetail
|
||||
* @return OrderTrait
|
||||
*/
|
||||
public function removeOrderdetail(Orderdetail $orderdetail): self
|
||||
|
|
|
@ -57,7 +57,7 @@ use Doctrine\Common\Collections\Collection;
|
|||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Class Storelocation.
|
||||
* Class Store location.
|
||||
*
|
||||
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
* @ORM\Table("`storelocations`")
|
||||
|
@ -126,8 +126,8 @@ class Storelocation extends PartsContainingDBElement
|
|||
*
|
||||
* When this attribute is set, it is not possible to add additional parts or increase the instock of existing parts.
|
||||
*
|
||||
* @return bool * true if the storelocation is full
|
||||
* * false if the storelocation isn't full
|
||||
* @return bool * true if the store location is full
|
||||
* * false if the store location isn't full
|
||||
*/
|
||||
public function isFull(): bool
|
||||
{
|
||||
|
@ -145,6 +145,7 @@ class Storelocation extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $only_single_part
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setOnlySinglePart(bool $only_single_part): self
|
||||
|
@ -165,6 +166,7 @@ class Storelocation extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param bool $limit_to_existing_parts
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setLimitToExistingParts(bool $limit_to_existing_parts): self
|
||||
|
@ -183,6 +185,7 @@ class Storelocation extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* @param MeasurementUnit|null $storage_type
|
||||
* @return Storelocation
|
||||
*/
|
||||
public function setStorageType(?MeasurementUnit $storage_type): self
|
||||
|
@ -199,7 +202,7 @@ class Storelocation extends PartsContainingDBElement
|
|||
*********************************************************************************/
|
||||
|
||||
/**
|
||||
* Change the "is full" attribute of this storelocation.
|
||||
* Change the "is full" attribute of this store location.
|
||||
*
|
||||
* "is_full" = true means that there is no more space in this storelocation.
|
||||
* This attribute is only for information, it has no effect.
|
||||
|
|
|
@ -117,7 +117,7 @@ class Supplier extends Company
|
|||
/**
|
||||
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
|
||||
*
|
||||
* @return ?Currency
|
||||
* @return Currency|null
|
||||
*/
|
||||
public function getDefaultCurrency(): ?Currency
|
||||
{
|
||||
|
@ -127,7 +127,8 @@ class Supplier extends Company
|
|||
/**
|
||||
* Sets the default currency.
|
||||
*
|
||||
* @param ?Currency $default_currency
|
||||
* @param Currency|null $default_currency
|
||||
* @return Supplier
|
||||
*/
|
||||
public function setDefaultCurrency(?Currency $default_currency): self
|
||||
{
|
||||
|
@ -150,6 +151,7 @@ class Supplier extends Company
|
|||
* Sets the shipping costs for an order with this supplier.
|
||||
*
|
||||
* @param string|null $shipping_costs a bcmath string with the shipping costs
|
||||
* @return Supplier
|
||||
*/
|
||||
public function setShippingCosts(?string $shipping_costs): self
|
||||
{
|
||||
|
|
|
@ -121,6 +121,9 @@ class Currency extends StructuralDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the exchange rate of the currency.
|
||||
* @param string|null $exchange_rate The new exchange rate of the currency.
|
||||
* Set to null, if the exchange rate is unknown.
|
||||
* @return Currency
|
||||
*/
|
||||
public function setExchangeRate(?string $exchange_rate): self
|
||||
|
|
|
@ -228,6 +228,7 @@ class Orderdetail extends DBElement
|
|||
/**
|
||||
* Removes an pricedetail from this orderdetail.
|
||||
*
|
||||
* @param Pricedetail $pricedetail
|
||||
* @return Orderdetail
|
||||
*/
|
||||
public function removePricedetail(Pricedetail $pricedetail): self
|
||||
|
@ -255,7 +256,7 @@ class Orderdetail extends DBElement
|
|||
|
||||
$correct_pricedetail = null;
|
||||
foreach ($all_pricedetails as $pricedetail) {
|
||||
// choose the correct pricedetails for the choosed quantity ($quantity)
|
||||
// choose the correct pricedetails for the chosen quantity ($quantity)
|
||||
if ($quantity < $pricedetail->getMinDiscountQuantity()) {
|
||||
break;
|
||||
}
|
||||
|
@ -275,6 +276,7 @@ class Orderdetail extends DBElement
|
|||
/**
|
||||
* Sets a new part with which this orderdetail is associated.
|
||||
*
|
||||
* @param Part $part
|
||||
* @return Orderdetail
|
||||
*/
|
||||
public function setPart(Part $part): self
|
||||
|
@ -287,6 +289,7 @@ class Orderdetail extends DBElement
|
|||
/**
|
||||
* Sets the new supplier associated with this orderdetail.
|
||||
*
|
||||
* @param Supplier $new_supplier
|
||||
* @return Orderdetail
|
||||
*/
|
||||
public function setSupplier(Supplier $new_supplier): self
|
||||
|
|
|
@ -232,6 +232,7 @@ class Pricedetail extends DBElement
|
|||
/**
|
||||
* Sets the orderdetail to which this pricedetail belongs to.
|
||||
*
|
||||
* @param Orderdetail $orderdetail
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrderdetail(Orderdetail $orderdetail): self
|
||||
|
@ -245,6 +246,7 @@ class Pricedetail extends DBElement
|
|||
* Sets the currency associated with the price informations.
|
||||
* Set to null, to use the global base currency.
|
||||
*
|
||||
* @param Currency|null $currency
|
||||
* @return Pricedetail
|
||||
*/
|
||||
public function setCurrency(?Currency $currency): self
|
||||
|
|
|
@ -412,7 +412,7 @@ class PermissionsEmbed
|
|||
* Sets the given permission to the value.
|
||||
*
|
||||
* @param string $permission_name the name of the permission to that should be set
|
||||
* @param int $value The new value of the permsission
|
||||
* @param int $value The new value of the permissions
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
@ -487,7 +487,7 @@ class PermissionsEmbed
|
|||
throw new \InvalidArgumentException('$n must be dividable by 2, because we address bit pairs here!');
|
||||
}
|
||||
|
||||
$mask = 0b11 << $n; //Mask all bits that should be writen
|
||||
$mask = 0b11 << $n; //Mask all bits that should be written
|
||||
$newval = $new << $n; //The new value.
|
||||
$data = ($data & ~$mask) | ($newval & $mask);
|
||||
|
||||
|
|
|
@ -281,6 +281,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Sets the password hash for this user.
|
||||
*
|
||||
* @param string $password
|
||||
* @return User
|
||||
*/
|
||||
public function setPassword(string $password): self
|
||||
|
@ -320,6 +321,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Sets the currency the users prefers to see prices in.
|
||||
*
|
||||
* @param Currency|null $currency
|
||||
* @return User
|
||||
*/
|
||||
public function setCurrency(?Currency $currency): self
|
||||
|
@ -382,6 +384,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
|||
/**
|
||||
* Set the status, if the user needs a password change.
|
||||
*
|
||||
* @param bool $need_pw_change
|
||||
* @return User
|
||||
*/
|
||||
public function setNeedPwChange(bool $need_pw_change): self
|
||||
|
|
|
@ -37,7 +37,7 @@ class StructuralDBElementRepository extends EntityRepository
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a flattened hierachical tree. Useful for generating option lists.
|
||||
* Gets a flattened hierarchical tree. Useful for generating option lists.
|
||||
*
|
||||
* @param StructuralDBElement|null $parent This entity will be used as root element. Set to null, to use global root
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue