Fixed some inspection issues.

This commit is contained in:
Jan Böhmer 2019-11-10 14:00:56 +01:00
parent 3438f15274
commit 6ddc937ec5
32 changed files with 111 additions and 208 deletions

View file

@ -205,7 +205,6 @@ abstract class BaseAdminController extends AbstractController
//Show errors to user: //Show errors to user:
foreach ($errors as $error) { foreach ($errors as $error) {
dump($error);
$this->addFlash('error', $error['entity']->getFullPath().':'.$error['violations']); $this->addFlash('error', $error['entity']->getFullPath().':'.$error['violations']);
} }

View file

@ -41,7 +41,6 @@ class AttachmentFileController extends AbstractController
* *
* @return BinaryFileResponse * @return BinaryFileResponse
* *
* @throws \Exception
*/ */
public function download(Attachment $attachment, AttachmentManager $helper) public function download(Attachment $attachment, AttachmentManager $helper)
{ {

View file

@ -151,7 +151,9 @@ class PartController extends AbstractController
$cid = $request->get('cid', 1); $cid = $request->get('cid', 1);
$category = $em->find(Category::class, $cid); $category = $em->find(Category::class, $cid);
$new_part->setCategory($category); if($category !== null) {
$new_part->setCategory($category);
}
$form = $this->createForm(PartBaseType::class, $new_part); $form = $this->createForm(PartBaseType::class, $new_part);

View file

@ -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. * 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. * When the PHP is not used via Apache SAPI, we just assume that URL rewriting is available.
* *

View file

@ -39,9 +39,9 @@ use Symfony\Component\Serializer\Serializer;
class TypeaheadController extends AbstractController 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); $array = $finder->find($query);

View file

@ -80,7 +80,7 @@ class UserController extends AdminPages\BaseAdminController
*/ */
public function delete(Request $request, User $entity, StructuralElementRecursionHelper $recursionHelper) 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'); 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 no user id was passed, then we show info about the current user
if (null === $user) { if (null === $user) {
$user = $this->getUser(); $user = $this->getUser();
} else { } else {
//Else we must check, if the current user is allowed to access $user //Else we must check, if the current user is allowed to access $user
$this->denyAccessUnlessGranted('read', $user); $this->denyAccessUnlessGranted('read', $user);

View file

@ -20,25 +20,6 @@
*/ */
declare(strict_types=1); 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; namespace App\Entity\Attachments;
@ -101,7 +82,7 @@ abstract class Attachment extends NamedDBElement
protected $path = ''; 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) * @ORM\Column(type="string", nullable=true)
*/ */
protected $original_filename; protected $original_filename;
@ -120,7 +101,7 @@ abstract class Attachment extends NamedDBElement
protected $attachment_type; 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 = ''; 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. * If the link is external, it is assumed that this is true.
* *
* @return bool * true if the file extension is a picture extension * @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). * If the attachment is external, false is returned (3D Models must be internal).
* *
* @return bool * @return bool
@ -185,7 +166,7 @@ abstract class Attachment extends NamedDBElement
return false; 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); $tmp = explode('/', $this->path);
if (empty($tmp)) { if (empty($tmp)) {
@ -203,7 +184,7 @@ abstract class Attachment extends NamedDBElement
*/ */
public function isSecure(): bool 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); $tmp = explode('/', $this->path);
if (empty($tmp)) { 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) * 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). * 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 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. * @return AttachmentContainingDBElement The associated Element.
*/ */
@ -343,8 +324,8 @@ abstract class Attachment extends NamedDBElement
/** /**
* Get the show_in_table attribute. * Get the show_in_table attribute.
* *
* @return bool true means, this attachement will 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 attachement won't be listed in the "Attachements" 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 public function getShowInTable(): bool
{ {
@ -377,6 +358,7 @@ abstract class Attachment extends NamedDBElement
****************************************************************************************************/ ****************************************************************************************************/
/** /**
* @param bool $show_in_table
* @return self * @return self
*/ */
public function setShowInTable(bool $show_in_table): self public function setShowInTable(bool $show_in_table): self
@ -386,6 +368,11 @@ abstract class Attachment extends NamedDBElement
return $this; return $this;
} }
/**
* Sets the element that is associated with this attachment.
* @param AttachmentContainingDBElement $element
* @return $this
*/
public function setElement(AttachmentContainingDBElement $element): self public function setElement(AttachmentContainingDBElement $element): self
{ {
if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) { 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 * @return Attachment
*/ */
public function setPath(string $path): self 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 public function setAttachmentType(AttachmentType $attachement_type): self
{ {
@ -421,6 +411,7 @@ abstract class Attachment extends NamedDBElement
* Sets the url associated with this attachment. * Sets the url associated with this attachment.
* If the url is empty nothing is changed, to not override the file path. * If the url is empty nothing is changed, to not override the file path.
* *
* @param string|null $url
* @return Attachment * @return Attachment
*/ */
public function setURL(?string $url): self 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 * @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 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); $tmp = explode('/', $path);
//Builtins must have a %PLACEHOLDER% construction //Builtins must have a %PLACEHOLDER% construction
if (empty($tmp)) { if (empty($tmp)) {

View file

@ -20,25 +20,6 @@
*/ */
declare(strict_types=1); 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; namespace App\Entity\Attachments;
@ -104,6 +85,7 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
/** /**
* Removes the given attachment from this element. * Removes the given attachment from this element.
* *
* @param Attachment $attachment
* @return $this * @return $this
*/ */
public function removeAttachment(Attachment $attachment): self public function removeAttachment(Attachment $attachment): self

View file

@ -20,25 +20,6 @@
*/ */
declare(strict_types=1); 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; namespace App\Entity\Attachments;
@ -95,7 +76,7 @@ class AttachmentType extends StructuralDBElement
/** /**
* Get all attachments ("Attachment" objects) with this type. * 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) * (sorted by their names)
*/ */
public function getAttachmentsForType(): Collection 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 public function setFiletypeFilter(string $filetype_filter): self
{ {

View file

@ -20,25 +20,6 @@
*/ */
declare(strict_types=1); 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; namespace App\Entity\Base;
@ -86,7 +67,7 @@ abstract class DBElement
protected $id; 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(). * checked with isVirtualElement().
* *
* Returns null, if the element is not saved to the DB yet. * Returns null, if the element is not saved to the DB yet.

View file

@ -42,7 +42,7 @@ trait MasterAttachmentTrait
* Get the master picture "Attachment"-object of this part (if there is one). * 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. * 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 public function getMasterPictureAttachment(): ?Attachment
{ {
@ -52,6 +52,7 @@ trait MasterAttachmentTrait
/** /**
* Sets the new master picture for this part. * Sets the new master picture for this part.
* *
* @param Attachment|null $new_master_attachment
* @return Part * @return Part
*/ */
public function setMasterPictureAttachment(?Attachment $new_master_attachment): self public function setMasterPictureAttachment(?Attachment $new_master_attachment): self

View file

@ -20,25 +20,6 @@
*/ */
declare(strict_types=1); 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; namespace App\Entity\Base;

View file

@ -20,25 +20,6 @@
*/ */
declare(strict_types=1); 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; namespace App\Entity\Base;

View file

@ -20,25 +20,6 @@
*/ */
declare(strict_types=1); 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; 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 //This is a not standard character, so build a const, so a dev can easily use it
public const PATH_DELIMITER_ARROW = ' → '; 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 // subclasses
/** /**
* @var StructuralDBElement[] * @var StructuralDBElement[]
@ -145,7 +126,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
//If this' parents element, is $another_element, then we are finished //If this' parents element, is $another_element, then we are finished
return ($this->parent->getID() === $another_element->getID()) 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. * The level of the root node is -1.
* *
* @return int the level of this element (zero means a most top element * @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 public function getLevel(): int
{ {
@ -213,11 +194,11 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
/** /**
* Get the full path. * 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)) { if (!\is_array($this->full_path_strings)) {
$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); $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). * 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) * ordered from the lowest levels (root node) first to the highest level (the element itself)
*/ */
public function getPathArray(): array 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 * @param bool $recursive if true, the search is recursive
* *

View file

@ -149,6 +149,7 @@ class Device extends PartsContainingDBElement
* Set the "order_only_missing_parts" attribute. * Set the "order_only_missing_parts" attribute.
* *
* @param bool $new_order_only_missing_parts the new "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 public function setOrderOnlyMissingParts(bool $new_order_only_missing_parts): self
{ {

View file

@ -20,25 +20,6 @@
*/ */
declare(strict_types=1); 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; namespace App\Entity\Parts;
@ -145,6 +126,7 @@ class Category extends PartsContainingDBElement
} }
/** /**
* @param string $partname_hint
* @return Category * @return Category
*/ */
public function setPartnameHint(string $partname_hint): self public function setPartnameHint(string $partname_hint): self
@ -163,6 +145,7 @@ class Category extends PartsContainingDBElement
} }
/** /**
* @param string $partname_regex
* @return Category * @return Category
*/ */
public function setPartnameRegex(string $partname_regex): self public function setPartnameRegex(string $partname_regex): self
@ -181,6 +164,7 @@ class Category extends PartsContainingDBElement
} }
/** /**
* @param bool $disable_footprints
* @return Category * @return Category
*/ */
public function setDisableFootprints(bool $disable_footprints): self public function setDisableFootprints(bool $disable_footprints): self
@ -199,6 +183,7 @@ class Category extends PartsContainingDBElement
} }
/** /**
* @param bool $disable_manufacturers
* @return Category * @return Category
*/ */
public function setDisableManufacturers(bool $disable_manufacturers): self public function setDisableManufacturers(bool $disable_manufacturers): self
@ -217,6 +202,7 @@ class Category extends PartsContainingDBElement
} }
/** /**
* @param bool $disable_autodatasheets
* @return Category * @return Category
*/ */
public function setDisableAutodatasheets(bool $disable_autodatasheets): self public function setDisableAutodatasheets(bool $disable_autodatasheets): self
@ -235,6 +221,7 @@ class Category extends PartsContainingDBElement
} }
/** /**
* @param bool $disable_properties
* @return Category * @return Category
*/ */
public function setDisableProperties(bool $disable_properties): self public function setDisableProperties(bool $disable_properties): self
@ -253,6 +240,7 @@ class Category extends PartsContainingDBElement
} }
/** /**
* @param string $default_description
* @return Category * @return Category
*/ */
public function setDefaultDescription(string $default_description): self public function setDefaultDescription(string $default_description): self
@ -271,6 +259,7 @@ class Category extends PartsContainingDBElement
} }
/** /**
* @param string $default_comment
* @return Category * @return Category
*/ */
public function setDefaultComment(string $default_comment): self public function setDefaultComment(string $default_comment): self

View file

@ -127,6 +127,7 @@ class Footprint extends PartsContainingDBElement
/** /**
* Sets the 3D Model associated with this footprint. * Sets the 3D Model associated with this footprint.
* *
* @param FootprintAttachment|null $new_attachment The new 3D Model
* @return Footprint * @return Footprint
*/ */
public function setFootprint3d(?FootprintAttachment $new_attachment): self public function setFootprint3d(?FootprintAttachment $new_attachment): self

View file

@ -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 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\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
* @ORM\Table(name="`measurement_units`") * @ORM\Table(name="`measurement_units`")
@ -45,7 +45,7 @@ class MeasurementUnit extends PartsContainingDBElement
protected $attachments; 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). * or m (for meters).
* @ORM\Column(type="string", name="unit", nullable=true) * @ORM\Column(type="string", name="unit", nullable=true)
* @Assert\Length(max=10) * @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. * @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") * @ORM\Column(type="boolean", name="is_integer")
*/ */
protected $is_integer = false; protected $is_integer = false;
@ -122,6 +122,7 @@ class MeasurementUnit extends PartsContainingDBElement
} }
/** /**
* @param bool $isInteger
* @return MeasurementUnit * @return MeasurementUnit
*/ */
public function setIsInteger(bool $isInteger): self public function setIsInteger(bool $isInteger): self
@ -140,6 +141,7 @@ class MeasurementUnit extends PartsContainingDBElement
} }
/** /**
* @param bool $usesSIPrefixes
* @return MeasurementUnit * @return MeasurementUnit
*/ */
public function setUseSIPrefix(bool $usesSIPrefixes): self public function setUseSIPrefix(bool $usesSIPrefixes): self

View file

@ -100,7 +100,7 @@ class Part extends AttachmentContainingDBElement
protected $lastModified; protected $lastModified;
/*************************************************************** /***************************************************************
* Overriden properties * Overridden properties
* (They are defined here and not in a trait, to avoid conflicts) * (They are defined here and not in a trait, to avoid conflicts)
****************************************************************/ ****************************************************************/

View file

@ -56,7 +56,7 @@ class PartLot extends DBElement
/** /**
* @var ?\DateTime Set a time until when the lot must be used. * @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) * @ORM\Column(type="datetime", name="expiration_date", nullable=true)
*/ */
protected $expiration_date; protected $expiration_date;
@ -84,7 +84,7 @@ class PartLot extends DBElement
protected $instock_unknown = false; 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") * @ORM\Column(type="float")
* @Assert\PositiveOrZero() * @Assert\PositiveOrZero()
*/ */
@ -136,6 +136,7 @@ class PartLot extends DBElement
/** /**
* Sets the description of the part lot. * Sets the description of the part lot.
* *
* @param string $description
* @return PartLot * @return PartLot
*/ */
public function setDescription(string $description): self public function setDescription(string $description): self
@ -158,6 +159,7 @@ class PartLot extends DBElement
/** /**
* Sets the comment for this part lot. * Sets the comment for this part lot.
* *
* @param string $comment
* @return PartLot * @return PartLot
*/ */
public function setComment(string $comment): self 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 * @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. * Sets the storage location, where this part lot is stored.
* *
* @param Storelocation|null $storage_location
* @return PartLot * @return PartLot
*/ */
public function setStorageLocation(?Storelocation $storage_location): self public function setStorageLocation(?Storelocation $storage_location): self
@ -250,6 +253,7 @@ class PartLot extends DBElement
/** /**
* Set the unknown instock status of this part lot. * Set the unknown instock status of this part lot.
* *
* @param bool $instock_unknown
* @return PartLot * @return PartLot
*/ */
public function setInstockUnknown(bool $instock_unknown): self public function setInstockUnknown(bool $instock_unknown): self
@ -287,6 +291,7 @@ class PartLot extends DBElement
} }
/** /**
* @param bool $needs_refill
* @return PartLot * @return PartLot
*/ */
public function setNeedsRefill(bool $needs_refill): self public function setNeedsRefill(bool $needs_refill): self

View file

@ -37,14 +37,14 @@ trait AdvancedPropertyTrait
protected $needs_review = false; 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") * @ORM\Column(type="text")
* @ColumnSecurity(type="string", prefix="tags", placeholder="") * @ColumnSecurity(type="string", prefix="tags", placeholder="")
*/ */
protected $tags = ''; 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) * @ORM\Column(type="float", nullable=true)
* @ColumnSecurity(type="float", placeholder=null) * @ColumnSecurity(type="float", placeholder=null)
* @Assert\PositiveOrZero() * @Assert\PositiveOrZero()
@ -63,7 +63,7 @@ trait AdvancedPropertyTrait
/** /**
* Sets the "needs review" status of this part. * Sets the "needs review" status of this part.
* * @param bool $needs_review The new status
* @return Part|self * @return Part|self
*/ */
public function setNeedsReview(bool $needs_review): 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. * Sets a comma separated list of tags, that are assigned to this part.
* *
* @param string $tags The new tags
* @return self * @return self
*/ */
public function setTags(string $tags): self public function setTags(string $tags): self
@ -110,6 +111,7 @@ trait AdvancedPropertyTrait
* Sets the mass of a single part unit. * Sets the mass of a single part unit.
* Sett to null, if the mass is unknown. * Sett to null, if the mass is unknown.
* *
* @param float|null $mass The new mass.
* @return self * @return self
*/ */
public function setMass(?float $mass): self public function setMass(?float $mass): self

View file

@ -70,6 +70,7 @@ trait InstockTrait
* Adds the given part lot, to the list of part lots. * Adds the given part lot, to the list of part lots.
* The part lot is assigned to this part. * The part lot is assigned to this part.
* *
* @param PartLot $lot
* @return self * @return self
*/ */
public function addPartLot(PartLot $lot): 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. * Sets the measurement unit in which the part's amount should be measured.
* Set to null, if the part should be measured in quantities. * Set to null, if the part should be measured in quantities.
* *
* @param MeasurementUnit|null $partUnit
* @return self * @return self
*/ */
public function setPartUnit(?MeasurementUnit $partUnit): self public function setPartUnit(?MeasurementUnit $partUnit): self

View file

@ -99,7 +99,7 @@ trait ManufacturerTrait
* (Similar to https://designspark.zendesk.com/hc/en-us/articles/213584805-What-are-the-Lifecycle-Status-definitions-) * (Similar to https://designspark.zendesk.com/hc/en-us/articles/213584805-What-are-the-Lifecycle-Status-definitions-)
* * "": Status unknown * * "": Status unknown
* * "announced": Part has been announced, but is not in production yet * * "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. * * "nrfnd": Not recommended for new designs.
* * "eol": Part will become discontinued soon * * "eol": Part will become discontinued soon
* * "discontinued": Part is obsolete/discontinued by the manufacturer. * * "discontinued": Part is obsolete/discontinued by the manufacturer.
@ -115,6 +115,7 @@ trait ManufacturerTrait
* Sets the manufacturing status for this part * Sets the manufacturing status for this part
* See getManufacturingStatus() for valid values. * See getManufacturingStatus() for valid values.
* *
* @param string $manufacturing_status
* @return Part * @return Part
*/ */
public function setManufacturingStatus(string $manufacturing_status): self public function setManufacturingStatus(string $manufacturing_status): self
@ -147,6 +148,7 @@ trait ManufacturerTrait
/** /**
* Sets the manufacturer product number (MPN) for this part. * Sets the manufacturer product number (MPN) for this part.
* *
* @param string $manufacturer_product_number
* @return Part * @return Part
*/ */
public function setManufacturerProductNumber(string $manufacturer_product_number): self public function setManufacturerProductNumber(string $manufacturer_product_number): self

View file

@ -32,7 +32,7 @@ use Doctrine\Common\Collections\Collection;
trait OrderTrait 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) * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid() * @Assert\Valid()
* @ColumnSecurity(prefix="orderdetails", type="collection") * @ColumnSecurity(prefix="orderdetails", type="collection")
@ -137,6 +137,7 @@ trait OrderTrait
/** /**
* Removes the given orderdetail from the list of orderdetails. * Removes the given orderdetail from the list of orderdetails.
* *
* @param Orderdetail $orderdetail
* @return OrderTrait * @return OrderTrait
*/ */
public function removeOrderdetail(Orderdetail $orderdetail): self public function removeOrderdetail(Orderdetail $orderdetail): self

View file

@ -57,7 +57,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Class Storelocation. * Class Store location.
* *
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository") * @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
* @ORM\Table("`storelocations`") * @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. * 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 * @return bool * true if the store location is full
* * false if the storelocation isn't full * * false if the store location isn't full
*/ */
public function isFull(): bool public function isFull(): bool
{ {
@ -145,6 +145,7 @@ class Storelocation extends PartsContainingDBElement
} }
/** /**
* @param bool $only_single_part
* @return Storelocation * @return Storelocation
*/ */
public function setOnlySinglePart(bool $only_single_part): self public function setOnlySinglePart(bool $only_single_part): self
@ -165,6 +166,7 @@ class Storelocation extends PartsContainingDBElement
} }
/** /**
* @param bool $limit_to_existing_parts
* @return Storelocation * @return Storelocation
*/ */
public function setLimitToExistingParts(bool $limit_to_existing_parts): self public function setLimitToExistingParts(bool $limit_to_existing_parts): self
@ -183,6 +185,7 @@ class Storelocation extends PartsContainingDBElement
} }
/** /**
* @param MeasurementUnit|null $storage_type
* @return Storelocation * @return Storelocation
*/ */
public function setStorageType(?MeasurementUnit $storage_type): self 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. * "is_full" = true means that there is no more space in this storelocation.
* This attribute is only for information, it has no effect. * This attribute is only for information, it has no effect.

View file

@ -117,7 +117,7 @@ class Supplier extends Company
/** /**
* Gets the currency that should be used by default, when creating a orderdetail with this supplier. * 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 public function getDefaultCurrency(): ?Currency
{ {
@ -127,7 +127,8 @@ class Supplier extends Company
/** /**
* Sets the default currency. * Sets the default currency.
* *
* @param ?Currency $default_currency * @param Currency|null $default_currency
* @return Supplier
*/ */
public function setDefaultCurrency(?Currency $default_currency): self 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. * Sets the shipping costs for an order with this supplier.
* *
* @param string|null $shipping_costs a bcmath string with the shipping costs * @param string|null $shipping_costs a bcmath string with the shipping costs
* @return Supplier
*/ */
public function setShippingCosts(?string $shipping_costs): self public function setShippingCosts(?string $shipping_costs): self
{ {

View file

@ -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 * @return Currency
*/ */
public function setExchangeRate(?string $exchange_rate): self public function setExchangeRate(?string $exchange_rate): self

View file

@ -228,6 +228,7 @@ class Orderdetail extends DBElement
/** /**
* Removes an pricedetail from this orderdetail. * Removes an pricedetail from this orderdetail.
* *
* @param Pricedetail $pricedetail
* @return Orderdetail * @return Orderdetail
*/ */
public function removePricedetail(Pricedetail $pricedetail): self public function removePricedetail(Pricedetail $pricedetail): self
@ -255,7 +256,7 @@ class Orderdetail extends DBElement
$correct_pricedetail = null; $correct_pricedetail = null;
foreach ($all_pricedetails as $pricedetail) { 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()) { if ($quantity < $pricedetail->getMinDiscountQuantity()) {
break; break;
} }
@ -275,6 +276,7 @@ class Orderdetail extends DBElement
/** /**
* Sets a new part with which this orderdetail is associated. * Sets a new part with which this orderdetail is associated.
* *
* @param Part $part
* @return Orderdetail * @return Orderdetail
*/ */
public function setPart(Part $part): self public function setPart(Part $part): self
@ -287,6 +289,7 @@ class Orderdetail extends DBElement
/** /**
* Sets the new supplier associated with this orderdetail. * Sets the new supplier associated with this orderdetail.
* *
* @param Supplier $new_supplier
* @return Orderdetail * @return Orderdetail
*/ */
public function setSupplier(Supplier $new_supplier): self public function setSupplier(Supplier $new_supplier): self

View file

@ -232,6 +232,7 @@ class Pricedetail extends DBElement
/** /**
* Sets the orderdetail to which this pricedetail belongs to. * Sets the orderdetail to which this pricedetail belongs to.
* *
* @param Orderdetail $orderdetail
* @return $this * @return $this
*/ */
public function setOrderdetail(Orderdetail $orderdetail): self public function setOrderdetail(Orderdetail $orderdetail): self
@ -245,6 +246,7 @@ class Pricedetail extends DBElement
* Sets the currency associated with the price informations. * Sets the currency associated with the price informations.
* Set to null, to use the global base currency. * Set to null, to use the global base currency.
* *
* @param Currency|null $currency
* @return Pricedetail * @return Pricedetail
*/ */
public function setCurrency(?Currency $currency): self public function setCurrency(?Currency $currency): self

View file

@ -412,7 +412,7 @@ class PermissionsEmbed
* Sets the given permission to the value. * Sets the given permission to the value.
* *
* @param string $permission_name the name of the permission to that should be set * @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 * @return $this
*/ */
@ -487,7 +487,7 @@ class PermissionsEmbed
throw new \InvalidArgumentException('$n must be dividable by 2, because we address bit pairs here!'); 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. $newval = $new << $n; //The new value.
$data = ($data & ~$mask) | ($newval & $mask); $data = ($data & ~$mask) | ($newval & $mask);

View file

@ -281,6 +281,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/** /**
* Sets the password hash for this user. * Sets the password hash for this user.
* *
* @param string $password
* @return User * @return User
*/ */
public function setPassword(string $password): self 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. * Sets the currency the users prefers to see prices in.
* *
* @param Currency|null $currency
* @return User * @return User
*/ */
public function setCurrency(?Currency $currency): self 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. * Set the status, if the user needs a password change.
* *
* @param bool $need_pw_change
* @return User * @return User
*/ */
public function setNeedPwChange(bool $need_pw_change): self public function setNeedPwChange(bool $need_pw_change): self

View file

@ -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 * @param StructuralDBElement|null $parent This entity will be used as root element. Set to null, to use global root
* *