Added an PHP CS fixer config file and applied it to files.

We now use the same the same style as the symfony project, and it allows us to simply fix the style by executing php_cs_fixer fix in the project root.
This commit is contained in:
Jan Böhmer 2019-11-09 00:47:20 +01:00
parent 89258bc102
commit e557bdedd5
210 changed files with 2099 additions and 2742 deletions

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,7 +17,6 @@
* 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
*
*/
declare(strict_types=1);
@ -65,7 +64,6 @@ use Doctrine\ORM\Mapping as ORM;
* "Supplier" = "SupplierAttachment", "User" = "UserAttachment"
* })
* @ORM\EntityListeners({"App\EntityListeners\AttachmentDeleteListener"})
*
*/
abstract class Attachment extends NamedDBElement
{
@ -75,7 +73,7 @@ abstract class Attachment extends NamedDBElement
* It will be used to determine if a attachment is a picture and therefore will be shown to user as preview.
*/
public const PICTURE_EXTS = ['apng', 'bmp', 'gif', 'ico', 'cur', 'jpg', 'jpeg', 'jfif', 'pjpeg', 'pjp', 'png',
'svg', 'webp'];
'svg', 'webp', ];
/**
* A list of extensions that will be treated as a 3D Model that can be shown to user directly in Part-DB.
@ -83,7 +81,7 @@ abstract class Attachment extends NamedDBElement
public const MODEL_EXTS = ['x3d'];
/**
* When the path begins with one of this placeholders
* When the path begins with one of this placeholders.
*/
public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%'];
@ -109,7 +107,7 @@ abstract class Attachment extends NamedDBElement
protected $original_filename;
/**
* ORM mapping is done in sub classes (like PartAttachment)
* ORM mapping is done in sub classes (like PartAttachment).
*/
protected $element;
@ -129,7 +127,7 @@ abstract class Attachment extends NamedDBElement
public function __construct()
{
//parent::__construct();
if (static::ALLOWED_ELEMENT_CLASS === '') {
if ('' === static::ALLOWED_ELEMENT_CLASS) {
throw new \LogicException('An *Attachment class must override the ALLOWED_ELEMENT_CLASS const!');
}
}
@ -154,15 +152,16 @@ abstract class Attachment extends NamedDBElement
$extension = pathinfo($this->getPath(), PATHINFO_EXTENSION);
return in_array(strtolower($extension), static::PICTURE_EXTS, true);
return \in_array(strtolower($extension), static::PICTURE_EXTS, true);
}
/**
* Check if this attachment is a 3D model and therfore can be directly shown to user.
* If the attachment is external, false is returned (3D Models must be internal).
*
* @return bool
*/
public function is3DModel() : bool
public function is3DModel(): bool
{
//We just assume that 3D Models are internally saved, otherwise we get problems loading them.
if ($this->isExternal()) {
@ -171,14 +170,15 @@ abstract class Attachment extends NamedDBElement
$extension = pathinfo($this->getPath(), PATHINFO_EXTENSION);
return in_array(strtolower($extension), static::MODEL_EXTS, true);
return \in_array(strtolower($extension), static::MODEL_EXTS, true);
}
/**
* Checks if the attachment file is externally saved (the database saves an URL)
* Checks if the attachment file is externally saved (the database saves an URL).
*
* @return bool true, if the file is saved externally
*/
public function isExternal() : bool
public function isExternal(): bool
{
//When path is empty, this attachment can not be external
if (empty($this->path)) {
@ -186,38 +186,40 @@ abstract class Attachment extends NamedDBElement
}
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placholder via explode
$tmp = explode("/", $this->path);
$tmp = explode('/', $this->path);
if (empty($tmp)) {
return true;
}
return !in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
return !\in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
}
/**
* Check if this attachment is saved in a secure place.
* This means that it can not be accessed directly via a web request, but must be viewed via a controller.
*
* @return bool True, if the file is secure.
*/
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
$tmp = explode("/", $this->path);
$tmp = explode('/', $this->path);
if (empty($tmp)) {
return false;
}
return $tmp[0] === '%SECURE%';
return '%SECURE%' === $tmp[0];
}
/**
* 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.
*/
public function isBuiltIn() : bool
public function isBuiltIn(): bool
{
return static::checkIfBuiltin($this->path);
}
@ -232,9 +234,10 @@ abstract class Attachment extends NamedDBElement
* Returns the extension of the file referenced via the attachment.
* For a path like %BASE/path/foo.bar, bar will be returned.
* If this attachment is external null is returned.
*
* @return string|null The file extension in lower case.
*/
public function getExtension() : ?string
public function getExtension(): ?string
{
if ($this->isExternal()) {
return null;
@ -260,6 +263,7 @@ abstract class Attachment extends NamedDBElement
/**
* The URL to the external file, or the path to the built in file.
* Returns null, if the file is not external (and not builtin).
*
* @return string|null
*/
public function getURL(): ?string
@ -274,6 +278,7 @@ abstract class Attachment extends NamedDBElement
/**
* Returns the hostname where the external file is stored.
* Returns null, if the file is not external.
*
* @return string|null
*/
public function getHost(): ?string
@ -319,16 +324,19 @@ abstract class Attachment extends NamedDBElement
/**
* Sets the filename that is shown for this attachment. Useful when the internal path is some generated value.
*
* @param string|null $new_filename The filename that should be shown.
* Set to null to generate the filename from path.
* Set to null to generate the filename from path.
*
* @return Attachment
*/
public function setFilename(?string $new_filename): Attachment
public function setFilename(?string $new_filename): self
{
if ($new_filename === "") {
if ('' === $new_filename) {
$new_filename = null;
}
$this->original_filename = $new_filename;
return $this;
}
@ -347,7 +355,6 @@ abstract class Attachment extends NamedDBElement
* Get the type of this attachement.
*
* @return AttachmentType the type of this attachement
*
*/
public function getAttachmentType(): ?AttachmentType
{
@ -370,8 +377,6 @@ abstract class Attachment extends NamedDBElement
****************************************************************************************************/
/**
* @param bool $show_in_table
*
* @return self
*/
public function setShowInTable(bool $show_in_table): self
@ -381,51 +386,48 @@ abstract class Attachment extends NamedDBElement
return $this;
}
public function setElement(AttachmentContainingDBElement $element) : Attachment
public function setElement(AttachmentContainingDBElement $element): self
{
if (!is_a($element,static::ALLOWED_ELEMENT_CLASS)) {
throw new \InvalidArgumentException(sprintf(
'The element associated with a %s must be a %s!',
get_class($this),
static::ALLOWED_ELEMENT_CLASS
));
if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
throw new \InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', \get_class($this), static::ALLOWED_ELEMENT_CLASS));
}
$this->element = $element;
return $this;
}
/**
* @param string $path
* @return Attachment
*/
public function setPath(string $path): Attachment
public function setPath(string $path): self
{
$this->path = $path;
return $this;
}
/**
* @param AttachmentType $attachement_type
* @return Attachment
*/
public function setAttachmentType(AttachmentType $attachement_type): Attachment
public function setAttachmentType(AttachmentType $attachement_type): self
{
$this->attachment_type = $attachement_type;
return $this;
}
/**
* 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) : Attachment
public function setURL(?string $url): self
{
//Only set if the URL is not empty
if (!empty($url)) {
if (strpos($url, '%BASE%') !== false || strpos($url, '%MEDIA%') !== false) {
if (false !== strpos($url, '%BASE%') || false !== strpos($url, '%MEDIA%')) {
throw new \InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
}
@ -437,17 +439,18 @@ abstract class Attachment extends NamedDBElement
return $this;
}
/*****************************************************************************************************
* Static functions
*****************************************************************************************************/
/**
* Checks if the given path is a path to a builtin ressource.
*
* @param string $path The path that should be checked
*
* @return bool True if the path is pointing to a builtin ressource.
*/
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
$tmp = explode('/', $path);
@ -455,22 +458,25 @@ abstract class Attachment extends NamedDBElement
if (empty($tmp)) {
return false;
}
return in_array($tmp[0], static::BUILTIN_PLACEHOLDER, false);
return \in_array($tmp[0], static::BUILTIN_PLACEHOLDER, false);
}
/**
* Check if a string is a URL and is valid.
*
* @param $string string The string which should be checked.
* @param bool $path_required If true, the string must contain a path to be valid. (e.g. foo.bar would be invalid, foo.bar/test.php would be valid).
* @param $only_http bool Set this to true, if only HTTPS or HTTP schemata should be allowed.
* *Caution: When this is set to false, a attacker could use the file:// schema, to get internal server files, like /etc/passwd.*
*
* @return bool True if the string is a valid URL. False, if the string is not an URL or invalid.
*/
public static function isURL(string $string, bool $path_required = true, bool $only_http = true) : bool
public static function isURL(string $string, bool $path_required = true, bool $only_http = true): bool
{
if ($only_http) { //Check if scheme is HTTPS or HTTP
$scheme = parse_url($string, PHP_URL_SCHEME);
if ($scheme !== 'http' && $scheme !== 'https') {
if ('http' !== $scheme && 'https' !== $scheme) {
return false; //All other schemes are not valid.
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,7 +17,6 @@
* 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
*
*/
declare(strict_types=1);
@ -48,7 +47,6 @@ use App\Entity\Base\NamedDBElement;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\MappedSuperclass()
@ -59,8 +57,8 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
/**
* @var Attachment[]
* //TODO
* //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element")
* //TODO
* //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element")
*
* Mapping is done in sub classes like part
*/
@ -79,34 +77,39 @@ abstract class AttachmentContainingDBElement extends NamedDBElement
/**
* Gets all attachments associated with this element.
*
* @return Attachment[]|Collection
*/
public function getAttachments() : Collection
public function getAttachments(): Collection
{
return $this->attachments;
}
/**
* Adds an attachment to this element
* Adds an attachment to this element.
*
* @param Attachment $attachment Attachment
*
* @return $this
*/
public function addAttachment(Attachment $attachment) : self
public function addAttachment(Attachment $attachment): self
{
//Attachment must be associated with this element
$attachment->setElement($this);
$this->attachments->add($attachment);
return $this;
}
/**
* Removes the given attachment from this element
* @param Attachment $attachment
* Removes the given attachment from this element.
*
* @return $this
*/
public function removeAttachment(Attachment $attachment) : self
public function removeAttachment(Attachment $attachment): self
{
$this->attachments->removeElement($attachment);
return $this;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,7 +17,6 @@
* 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
*
*/
declare(strict_types=1);
@ -44,10 +43,10 @@ declare(strict_types=1);
namespace App\Entity\Attachments;
use App\Entity\Base\StructuralDBElement;
use App\Validator\Constraints\ValidFileFilter;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Validator\Constraints\ValidFileFilter;
/**
* Class AttachmentType.
@ -85,7 +84,7 @@ class AttachmentType extends StructuralDBElement
* @ORM\Column(type="text")
* @ValidFileFilter
*/
protected $filetype_filter = "";
protected $filetype_filter = '';
public function __construct()
{
@ -97,7 +96,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
* (sorted by their names)
* (sorted by their names)
*/
public function getAttachmentsForType(): Collection
{
@ -108,6 +107,7 @@ class AttachmentType extends StructuralDBElement
* Gets an filter, which file types are allowed for attachment files.
* Must be in the format of <input type=file> accept attribute
* (See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers).
*
* @return string
*/
public function getFiletypeFilter(): string
@ -116,12 +116,12 @@ class AttachmentType extends StructuralDBElement
}
/**
* @param string $filetype_filter
* @return AttachmentType
*/
public function setFiletypeFilter(string $filetype_filter): AttachmentType
public function setFiletypeFilter(string $filetype_filter): self
{
$this->filetype_filter = $filetype_filter;
return $this;
}
@ -133,6 +133,6 @@ class AttachmentType extends StructuralDBElement
*/
public function getIDString(): string
{
return 'AT' . sprintf('%09d', $this->getID());
return 'AT'.sprintf('%09d', $this->getID());
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,22 +17,19 @@
* 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;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to an attachmentType element.
* @package App\Entity
*
* @ORM\Entity()
*/
class AttachmentTypeAttachment extends Attachment
{
/**
* @var AttachmentType The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\AttachmentType", inversedBy="attachments")
@ -40,5 +37,5 @@ class AttachmentTypeAttachment extends Attachment
*/
protected $element;
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
}
public const ALLOWED_ELEMENT_CLASS = AttachmentType::class;
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,24 +17,20 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Category;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a category element.
* @package App\Entity
*
* @ORM\Entity()
*/
class CategoryAttachment extends Attachment
{
/**
* @var Category The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Category", inversedBy="attachments")
@ -43,4 +39,4 @@ class CategoryAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = Category::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,28 +17,20 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a currency element.
* @package App\Entity
*
* @ORM\Entity()
*/
class CurrencyAttachment extends Attachment
{
/**
* @var Currency The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", inversedBy="attachments")
@ -47,4 +39,4 @@ class CurrencyAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = Currency::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,18 +17,16 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a device element.
* @package App\Entity
*
* @ORM\Entity()
*/
class DeviceAttachment extends Attachment
@ -41,4 +39,4 @@ class DeviceAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = Device::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,24 +17,20 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a footprint element.
* @package App\Entity
*
* @ORM\Entity()
*/
class FootprintAttachment extends Attachment
{
/**
* @var Footprint The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Footprint", inversedBy="attachments")
@ -43,4 +39,4 @@ class FootprintAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = Footprint::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,30 +17,20 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\Group;
use App\Entity\UserSystem\User;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a Group element.
* @package App\Entity
*
* @ORM\Entity()
*/
class GroupAttachment extends Attachment
{
/**
* @var Group The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\Group", inversedBy="attachments")

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,24 +17,20 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a manufacturer element.
* @package App\Entity
*
* @ORM\Entity()
*/
class ManufacturerAttachment extends Attachment
{
/**
* @var Manufacturer The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Manufacturer", inversedBy="attachments")
@ -43,4 +39,4 @@ class ManufacturerAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = Manufacturer::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,25 +17,21 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a measurement unit element.
* @package App\Entity
*
* @ORM\Entity()
*/
class MeasurementUnitAttachment extends Attachment
{
/**
* @var Manufacturer The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\MeasurementUnit", inversedBy="attachments")
@ -44,4 +40,4 @@ class MeasurementUnitAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = MeasurementUnit::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,7 +17,6 @@
* 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;
@ -27,12 +26,11 @@ use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a part element.
* @package App\Entity
*
* @ORM\Entity()
*/
class PartAttachment extends Attachment
{
/**
* @var Part The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments")
@ -41,4 +39,4 @@ class PartAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = Part::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,27 +17,20 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpKernel\HttpCache\Store;
/**
* A attachment attached to a measurement unit element.
* @package App\Entity
*
* @ORM\Entity()
*/
class StorelocationAttachment extends Attachment
{
/**
* @var Storelocation The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Storelocation", inversedBy="attachments")
@ -46,4 +39,4 @@ class StorelocationAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = Storelocation::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,27 +17,20 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Supplier;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a supplier element.
* @package App\Entity
*
* @ORM\Entity()
*/
class SupplierAttachment extends Attachment
{
/**
* @var Supplier The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="attachments")
@ -46,4 +39,4 @@ class SupplierAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = Supplier::class;
}
}

View file

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony)
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
*
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
*
@ -17,29 +17,20 @@
* 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;
use App\Entity\Devices\Device;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Supplier;
use App\Entity\PriceInformations\Currency;
use App\Entity\UserSystem\User;
use Doctrine\ORM\Mapping as ORM;
/**
* A attachment attached to a user element.
* @package App\Entity
*
* @ORM\Entity()
*/
class UserAttachment extends Attachment
{
/**
* @var User The element this attachment is associated with.
* @ORM\ManyToOne(targetEntity="App\Entity\UserSystem\User", inversedBy="attachments")
@ -48,4 +39,4 @@ class UserAttachment extends Attachment
protected $element;
public const ALLOWED_ELEMENT_CLASS = User::class;
}
}