mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
782e2b7fdf
commit
0f3ba9b6a8
19 changed files with 109 additions and 139 deletions
|
@ -53,6 +53,6 @@ class DebugController extends AbstractController
|
|||
|
||||
$this->addFlash('testkjfd', 'Blabla. This message type should be not know to template!');
|
||||
|
||||
return $this->render("base.html.twig");
|
||||
return $this->render('base.html.twig');
|
||||
}
|
||||
}
|
|
@ -34,14 +34,7 @@
|
|||
namespace App\Controller;
|
||||
|
||||
|
||||
use App\Entity\Attachment;
|
||||
use App\Entity\AttachmentType;
|
||||
use App\Entity\Category;
|
||||
use App\Entity\Part;
|
||||
use App\Entity\StructuralDBElement;
|
||||
use Shivas\VersioningBundle\Service\VersionManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class HomepageController extends AbstractController
|
||||
|
|
|
@ -37,10 +37,7 @@ use App\Entity\Category;
|
|||
use App\Entity\Part;
|
||||
use App\Form\PartType;
|
||||
use App\Services\AttachmentFilenameService;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
@ -61,8 +58,8 @@ class PartController extends AbstractController
|
|||
|
||||
return $this->render('Parts/show_part_info.html.twig',
|
||||
[
|
||||
"part" => $part,
|
||||
"main_image" => $attachmentFilenameService->attachmentPathToAbsolutePath($filename)
|
||||
'part' => $part,
|
||||
'main_image' => $attachmentFilenameService->attachmentPathToAbsolutePath($filename)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -88,8 +85,8 @@ class PartController extends AbstractController
|
|||
|
||||
return $this->render('Parts/edit_part_info.html.twig',
|
||||
[
|
||||
"part" => $part,
|
||||
"form" => $form->createView(),
|
||||
'part' => $part,
|
||||
'form' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -123,8 +120,8 @@ class PartController extends AbstractController
|
|||
|
||||
return $this->render('Parts/new_part.html.twig',
|
||||
[
|
||||
"part" => $new_part,
|
||||
"form" => $form->createView()
|
||||
'part' => $new_part,
|
||||
'form' => $form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -136,7 +133,7 @@ class PartController extends AbstractController
|
|||
{
|
||||
|
||||
/** @var Part $new_part */
|
||||
$new_part = clone($part);
|
||||
$new_part = clone $part;
|
||||
|
||||
$this->denyAccessUnlessGranted('create', $new_part);
|
||||
|
||||
|
@ -154,8 +151,8 @@ class PartController extends AbstractController
|
|||
|
||||
return $this->render('Parts/new_part.html.twig',
|
||||
[
|
||||
"part" => $new_part,
|
||||
"form" => $form->createView()
|
||||
'part' => $new_part,
|
||||
'form' => $form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,14 +33,7 @@ namespace App\Controller;
|
|||
|
||||
|
||||
use App\DataTables\PartsDataTable;
|
||||
use App\Entity\Part;
|
||||
use Omines\DataTablesBundle\Adapter\ArrayAdapter;
|
||||
use Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter;
|
||||
use Omines\DataTablesBundle\Column\TextColumn;
|
||||
use Omines\DataTablesBundle\Controller\DataTablesTrait;
|
||||
use Omines\DataTablesBundle\DataTable;
|
||||
use Omines\DataTablesBundle\DataTableFactory;
|
||||
use Omines\DataTablesBundle\DataTableRendererInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
|
|
@ -56,17 +56,17 @@ class UserController extends AbstractController
|
|||
public function userInfo(?User $user, Packages $packages)
|
||||
{
|
||||
//If no user id was passed, then we show info about the current user
|
||||
if($user == null) {
|
||||
if($user === null) {
|
||||
$user = $this->getUser();
|
||||
} else {
|
||||
//Else we must check, if the current user is allowed to access $user
|
||||
$this->denyAccessUnlessGranted('read', $user);
|
||||
}
|
||||
|
||||
if($this->getParameter("use_gravatar")) {
|
||||
if($this->getParameter('use_gravatar')) {
|
||||
$avatar = $this->getGravatar($user->getEmail(), 200, 'identicon');
|
||||
} else {
|
||||
$avatar = $packages->getUrl("/img/default_avatar.png");
|
||||
$avatar = $packages->getUrl('/img/default_avatar.png');
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,7 +140,7 @@ class UserController extends AbstractController
|
|||
*****************************/
|
||||
|
||||
return $this->render('Users/user_settings.html.twig', [
|
||||
"settings_form" => $form->createView(),
|
||||
'settings_form' => $form->createView(),
|
||||
'pw_form' => $pw_form->createView()
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -21,9 +21,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace App\Entity;;
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
|
||||
/**
|
||||
* Class Attachment
|
||||
|
@ -137,6 +138,8 @@ class Attachment extends NamedDBElement
|
|||
public function getType() : AttachmentType
|
||||
{
|
||||
//TODO
|
||||
|
||||
throw new NotImplementedException("Not implemented yet!");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -78,14 +78,14 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
|
|||
|
||||
foreach ($attachements as $key => $attachement) {
|
||||
if (($only_table_attachements && (! $attachement->getShowInTable()))
|
||||
|| ($type_id && ($attachement->getType()->getID() != $type_id))) {
|
||||
|| ($type_id && ($attachement->getType()->getID() !== $type_id))) {
|
||||
unset($attachements[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $attachements;
|
||||
} else {
|
||||
return $this->attachments;
|
||||
}
|
||||
|
||||
return $this->attachments;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class AttachmentType extends StructuralDBElement
|
|||
* @var ArrayCollection
|
||||
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="attachement_type")
|
||||
*/
|
||||
protected $attachments = null;
|
||||
protected $attachments;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ class AttachmentType extends StructuralDBElement
|
|||
public function getAttachementsForType() : ArrayCollection
|
||||
{
|
||||
// the attribute $this->attachements is used from class "AttachementsContainingDBELement"
|
||||
if ($this->attachments == null) {
|
||||
if ($this->attachments === null) {
|
||||
$this->attachments = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class AttachmentType extends StructuralDBElement
|
|||
*/
|
||||
public function getIDString(): string
|
||||
{
|
||||
return "";
|
||||
return '';
|
||||
//return 'AT' . sprintf('%09d', $this->getID());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ class Device extends PartsContainingDBElement
|
|||
{
|
||||
if($new_order_quantity < 0)
|
||||
{
|
||||
throw new \InvalidArgumentException("The new order quantity must not be negative!");
|
||||
throw new \InvalidArgumentException('The new order quantity must not be negative!');
|
||||
}
|
||||
$this->order_quantity = $new_order_quantity;
|
||||
return $this;
|
||||
|
|
|
@ -108,13 +108,13 @@ class Footprint extends PartsContainingDBElement
|
|||
*/
|
||||
public function get3dFilename(bool $absolute = true) : string
|
||||
{
|
||||
if ($absolute == true) {
|
||||
if ($absolute === true) {
|
||||
//TODO
|
||||
throw new \Exception("Not Implemented yet...");
|
||||
throw new \Exception('Not Implemented yet...');
|
||||
//return str_replace('%BASE%', BASE, $this->db_data['filename_3d']);
|
||||
} else {
|
||||
return $this->filename_3d;
|
||||
}
|
||||
|
||||
return $this->filename_3d;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,7 +155,7 @@ class Footprint extends PartsContainingDBElement
|
|||
}
|
||||
|
||||
//Check if file is X3D-Model (these has .x3d extension)
|
||||
if (strpos($this->get3dFilename(), '.x3d') == false) {
|
||||
if (strpos($this->get3dFilename(), '.x3d') === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ abstract class NamedDBElement extends DBElement
|
|||
* @Assert\NotBlank()
|
||||
*
|
||||
*/
|
||||
protected $name = "";
|
||||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @var \DateTime The date when this element was modified the last time.
|
||||
|
|
|
@ -154,11 +154,11 @@ class Orderdetail extends DBElement
|
|||
*/
|
||||
public function getSupplierProductUrl(bool $no_automatic_url = false) : string
|
||||
{
|
||||
if ($no_automatic_url || $this->supplierpartnr != '') {
|
||||
if ($no_automatic_url || $this->supplierpartnr !== '') {
|
||||
return $this->supplierpartnr;
|
||||
} else {
|
||||
return $this->getSupplier()->getAutoProductUrl($this->supplierpartnr);
|
||||
} // maybe an automatic url is available...
|
||||
}
|
||||
|
||||
return $this->getSupplier()->getAutoProductUrl($this->supplierpartnr); // maybe an automatic url is available...
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -235,7 +235,7 @@ class Orderdetail extends DBElement
|
|||
return $correct_pricedetails->getPrice($as_money_string, $multiplier);
|
||||
* */
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet...");
|
||||
throw new \Exception('Not implemented yet...');
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
|
@ -252,7 +252,7 @@ class Orderdetail extends DBElement
|
|||
*/
|
||||
public function setSupplierId(int $new_supplier_id) : self
|
||||
{
|
||||
throw new \Exception("Not implemented yet!");
|
||||
throw new \Exception('Not implemented yet!');
|
||||
//TODO;
|
||||
|
||||
return $this;
|
||||
|
|
|
@ -49,7 +49,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
*/
|
||||
class Part extends AttachmentContainingDBElement
|
||||
{
|
||||
const INSTOCK_UNKNOWN = -2;
|
||||
public const INSTOCK_UNKNOWN = -2;
|
||||
|
||||
/**
|
||||
* @var Category
|
||||
|
@ -146,7 +146,7 @@ class Part extends AttachmentContainingDBElement
|
|||
*
|
||||
* @ColumnSecurity(prefix="description")
|
||||
*/
|
||||
protected $description = "";
|
||||
protected $description = '';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
|
@ -171,7 +171,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @ORM\Column(type="string")
|
||||
* @ColumnSecurity(prefix="comment")
|
||||
*/
|
||||
protected $comment = "";
|
||||
protected $comment = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -205,7 +205,7 @@ class Part extends AttachmentContainingDBElement
|
|||
* @ORM\Column(type="string")
|
||||
*@ColumnSecurity(prefix="manufacturer", type="string", placeholder="")
|
||||
*/
|
||||
protected $manufacturer_product_url = "";
|
||||
protected $manufacturer_product_url = '';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -287,7 +287,7 @@ class Part extends AttachmentContainingDBElement
|
|||
{
|
||||
$all_orderdetails = $this->getOrderdetails();
|
||||
|
||||
if (count($all_orderdetails) == 0) {
|
||||
if (count($all_orderdetails) === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ class Part extends AttachmentContainingDBElement
|
|||
public function getMinOrderQuantity(bool $with_devices = true) : int
|
||||
{
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet...");
|
||||
throw new \Exception('Not implemented yet...');
|
||||
|
||||
/**
|
||||
if ($with_devices) {
|
||||
|
@ -423,15 +423,15 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
public function getManufacturerProductUrl() : string
|
||||
{
|
||||
if ($this->manufacturer_product_url != '') {
|
||||
if ($this->manufacturer_product_url !== '') {
|
||||
return $this->manufacturer_product_url;
|
||||
}
|
||||
|
||||
if ($this->getManufacturer() !== null) {
|
||||
return $this->getManufacturer()->getAutoProductUrl($this->name);
|
||||
} else {
|
||||
return '';
|
||||
} // no url is available
|
||||
}
|
||||
|
||||
return ''; // no url is available
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -752,7 +752,7 @@ class Part extends AttachmentContainingDBElement
|
|||
public function getProperties(bool $use_description = true, bool $use_comment = true, bool $use_name = true, bool $force_output = false) : array
|
||||
{
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet!");
|
||||
throw new \Exception('Not implemented yet!');
|
||||
/*
|
||||
global $config;
|
||||
|
||||
|
@ -790,7 +790,7 @@ class Part extends AttachmentContainingDBElement
|
|||
public function getPropertiesLoop(bool $use_description = true, bool $use_comment = true, bool $use_name = true) : array
|
||||
{
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet!");
|
||||
throw new \Exception('Not implemented yet!');
|
||||
$arr = array();
|
||||
foreach ($this->getProperties($use_description, $use_comment, $use_name) as $property) {
|
||||
/* @var PartProperty $property */
|
||||
|
@ -805,17 +805,6 @@ class Part extends AttachmentContainingDBElement
|
|||
return self::isValidName($this->getName(), $this->getCategory());
|
||||
} */
|
||||
|
||||
|
||||
public function getAttachmentTypes() : array
|
||||
{
|
||||
return parent::getAttachmentTypes();
|
||||
}
|
||||
|
||||
public function getAttachments($type_id = null, bool $only_table_attachements = false) : array
|
||||
{
|
||||
return parent::getAttachments($type_id, $only_table_attachements);
|
||||
}
|
||||
|
||||
/********************************************************************************
|
||||
*
|
||||
* Setters
|
||||
|
@ -846,7 +835,7 @@ class Part extends AttachmentContainingDBElement
|
|||
{
|
||||
//Assert::natural($new_instock, 'New instock must be positive. Got: %s');
|
||||
|
||||
$old_instock = (int) $this->getInstock();
|
||||
$old_instock = $this->getInstock();
|
||||
$this->instock = $new_instock;
|
||||
//TODO
|
||||
/*
|
||||
|
@ -873,15 +862,14 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
public function setInstockUnknown(bool $new_unknown) : self
|
||||
{
|
||||
if($new_unknown == true) {
|
||||
if($new_unknown === true) {
|
||||
$this->instock = self::INSTOCK_UNKNOWN;
|
||||
} else {
|
||||
//Change only if instock is currently unknown.
|
||||
if ($this->isInstockUnknown()) {
|
||||
$this->setInstock(0);
|
||||
}
|
||||
} else if ($this->isInstockUnknown()) {
|
||||
$this->setInstock(0);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1016,7 +1004,7 @@ class Part extends AttachmentContainingDBElement
|
|||
public function setOrderOrderdetailsID($new_order_orderdetails_id) : self
|
||||
{
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet...");
|
||||
throw new \Exception('Not implemented yet...');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@ -1137,7 +1125,7 @@ class Part extends AttachmentContainingDBElement
|
|||
public function setMasterPictureAttachementID($new_master_picture_attachement_id) : self
|
||||
{
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet!");
|
||||
throw new \Exception('Not implemented yet!');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,35 +55,35 @@ class PermissionsEmbed
|
|||
* Permission strings
|
||||
*/
|
||||
|
||||
const STORELOCATIONS = 'storelocations';
|
||||
const FOOTRPINTS = 'footprints';
|
||||
const CATEGORIES = 'categories';
|
||||
const SUPPLIERS = 'suppliers';
|
||||
const MANUFACTURERS = 'manufacturers';
|
||||
const DEVICES = 'devices';
|
||||
const ATTACHMENT_TYPES = 'attachment_types';
|
||||
const TOOLS = 'tools';
|
||||
const PARTS = 'parts';
|
||||
const PARTS_NAME = 'parts_name';
|
||||
const PARTS_DESCRIPTION = 'parts_description';
|
||||
const PARTS_INSTOCK = 'parts_instock';
|
||||
const PARTS_MININSTOCK = 'parts_mininstock';
|
||||
const PARTS_FOOTPRINT = 'parts_footprint';
|
||||
const PARTS_COMMENT = 'parts_comment';
|
||||
const PARTS_STORELOCATION = 'parts_storelocation';
|
||||
const PARTS_MANUFACTURER = 'parts_manufacturer';
|
||||
const PARTS_ORDERDETAILS = 'parts_orderdetails';
|
||||
const PARTS_PRICES = 'parts_prices';
|
||||
const PARTS_ATTACHMENTS = 'parts_attachments';
|
||||
const PARTS_ORDER = 'parts_order';
|
||||
const GROUPS = 'groups';
|
||||
const USERS = 'users';
|
||||
const DATABASE = 'system_database';
|
||||
const CONFIG = 'system_config';
|
||||
const SYSTEM = 'system';
|
||||
const DEVICE_PARTS = 'devices_parts';
|
||||
const SELF = 'self';
|
||||
const LABELS = 'labels';
|
||||
public const STORELOCATIONS = 'storelocations';
|
||||
public const FOOTRPINTS = 'footprints';
|
||||
public const CATEGORIES = 'categories';
|
||||
public const SUPPLIERS = 'suppliers';
|
||||
public const MANUFACTURERS = 'manufacturers';
|
||||
public const DEVICES = 'devices';
|
||||
public const ATTACHMENT_TYPES = 'attachment_types';
|
||||
public const TOOLS = 'tools';
|
||||
public const PARTS = 'parts';
|
||||
public const PARTS_NAME = 'parts_name';
|
||||
public const PARTS_DESCRIPTION = 'parts_description';
|
||||
public const PARTS_INSTOCK = 'parts_instock';
|
||||
public const PARTS_MININSTOCK = 'parts_mininstock';
|
||||
public const PARTS_FOOTPRINT = 'parts_footprint';
|
||||
public const PARTS_COMMENT = 'parts_comment';
|
||||
public const PARTS_STORELOCATION = 'parts_storelocation';
|
||||
public const PARTS_MANUFACTURER = 'parts_manufacturer';
|
||||
public const PARTS_ORDERDETAILS = 'parts_orderdetails';
|
||||
public const PARTS_PRICES = 'parts_prices';
|
||||
public const PARTS_ATTACHMENTS = 'parts_attachments';
|
||||
public const PARTS_ORDER = 'parts_order';
|
||||
public const GROUPS = 'groups';
|
||||
public const USERS = 'users';
|
||||
public const DATABASE = 'system_database';
|
||||
public const CONFIG = 'system_config';
|
||||
public const SYSTEM = 'system';
|
||||
public const DEVICE_PARTS = 'devices_parts';
|
||||
public const SELF = 'self';
|
||||
public const LABELS = 'labels';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
|
@ -283,9 +283,11 @@ class PermissionsEmbed
|
|||
public function getPermissionValue(string $permission_name, int $bit_n) : ?bool
|
||||
{
|
||||
$value = $this->getBitValue($permission_name, $bit_n);
|
||||
if($value == self::ALLOW) {
|
||||
if ($value == self::ALLOW) {
|
||||
return true;
|
||||
} elseif($value == self::DISALLOW) {
|
||||
}
|
||||
|
||||
if($value == self::DISALLOW) {
|
||||
return false;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -121,11 +121,11 @@ class Pricedetail extends DBElement
|
|||
$price = ($this->price * $multiplier) / $this->price_related_quantity;
|
||||
|
||||
if ($as_money_string) {
|
||||
throw new \Exception("Not implemented yet...");
|
||||
throw new \Exception('Not implemented yet...');
|
||||
//return floatToMoneyString($price);
|
||||
} else {
|
||||
return $price;
|
||||
}
|
||||
|
||||
return $price;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,6 @@ namespace App\Entity;
|
|||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Symfony\Bundle\MakerBundle\Str;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -78,7 +77,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
|
||||
/** @var string[] all names of all parent elements as a array of strings,
|
||||
* the last array element is the name of the element itself */
|
||||
private $full_path_strings = null;
|
||||
private $full_path_strings;
|
||||
|
||||
/******************************************************************************
|
||||
* StructuralDBElement constructor.
|
||||
|
@ -105,11 +104,11 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
|
||||
if ($this->getID() == null) { // this is the root node
|
||||
return false;
|
||||
} else {
|
||||
//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
|
||||
}
|
||||
|
||||
//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
|
||||
}
|
||||
|
||||
|
||||
|
@ -149,10 +148,6 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
public function getComment(bool $parse_bbcode = true) : string
|
||||
{
|
||||
$val = htmlspecialchars($this->comment ?? '');
|
||||
if ($parse_bbcode) {
|
||||
//$bbcode = new BBCodeParser();
|
||||
//$val = $bbcode->parse($val);
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
@ -219,7 +214,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
|
|||
public function getSubelements(bool $recursive) : PersistentCollection
|
||||
{
|
||||
if ($this->children == null) {
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
||||
if (! $recursive) {
|
||||
|
|
|
@ -88,7 +88,7 @@ class Supplier extends Company
|
|||
|
||||
|
||||
//TODO
|
||||
throw new \Exception("Not implemented yet!");
|
||||
throw new \Exception('Not implemented yet!');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
class User extends NamedDBElement implements UserInterface, HasPermissionsInterface
|
||||
{
|
||||
/** The User id of the anonymous user */
|
||||
const ID_ANONYMOUS = 1;
|
||||
public const ID_ANONYMOUS = 1;
|
||||
|
||||
/**
|
||||
* @ORM\Id()
|
||||
|
@ -84,19 +84,19 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
|||
* @var string|null The first name of the User
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $first_name = "";
|
||||
protected $first_name = '';
|
||||
|
||||
/**
|
||||
* @var string|null The last name of the User
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $last_name = "";
|
||||
protected $last_name = '';
|
||||
|
||||
/**
|
||||
* @var string|null The department the user is working
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $department = "";
|
||||
protected $department = '';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -104,25 +104,25 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
|||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
* @Assert\Email()
|
||||
*/
|
||||
protected $email = "";
|
||||
protected $email = '';
|
||||
|
||||
/**
|
||||
* @var string|null The language/locale the user prefers
|
||||
* @ORM\Column(type="string", name="config_language", nullable=true)
|
||||
*/
|
||||
protected $language = "";
|
||||
protected $language = '';
|
||||
|
||||
/**
|
||||
* @var string|null The timezone the user prefers
|
||||
* @ORM\Column(type="string", name="config_timezone", nullable=true)
|
||||
*/
|
||||
protected $timezone = "";
|
||||
protected $timezone = '';
|
||||
|
||||
/**
|
||||
* @var string|null The theme
|
||||
* @ORM\Column(type="string", name="config_theme", nullable=true)
|
||||
*/
|
||||
protected $theme = "";
|
||||
protected $theme = '';
|
||||
|
||||
/**
|
||||
* @var Group|null The group this user belongs to.
|
||||
|
@ -240,7 +240,7 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
|||
* @param bool $including_username Include the username in the full name.
|
||||
* @return string A string with the full name of this user.
|
||||
*/
|
||||
public function getFullName(bool $including_username = false)
|
||||
public function getFullName(bool $including_username = false) : string
|
||||
{
|
||||
$str = $this->getFirstName() . ' ' . $this->getLastName();
|
||||
if ($including_username) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue