mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Changed DB structure the way, many more elements can have attachments
Also every Element has now a preview attachment field. For the user this will be used as profile picture.
This commit is contained in:
parent
5061c29872
commit
ccc345cd1b
28 changed files with 985 additions and 28 deletions
|
@ -34,7 +34,15 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
* @ORM\Table(name="`attachments`")
|
* @ORM\Table(name="`attachments`")
|
||||||
* @ORM\InheritanceType("SINGLE_TABLE")
|
* @ORM\InheritanceType("SINGLE_TABLE")
|
||||||
* @ORM\DiscriminatorColumn(name="class_name", type="string")
|
* @ORM\DiscriminatorColumn(name="class_name", type="string")
|
||||||
* @ORM\DiscriminatorMap({"PartDB\Part" = "PartAttachment", "Part" = "PartAttachment"})
|
* @ORM\DiscriminatorMap({
|
||||||
|
* "PartDB\Part" = "PartAttachment", "Part" = "PartAttachment",
|
||||||
|
* "PartDB\Device" = "DeviceAttachment", "Device" = "DeviceAttachment",
|
||||||
|
* "AttachmentType" = "AttachmentTypeAttachment", "Category" = "CategoryAttachment",
|
||||||
|
* "Footprint" = "FootprintAttachment", "Manufacturer" = "ManufacturerAttachment",
|
||||||
|
* "Currency" = "CurrencyAttachment", "Group" = "GroupAttachment",
|
||||||
|
* "MeasurementUnit" = "MeasurementUnitAttachment", "Storelocation" = "StorelocationAttachment",
|
||||||
|
* "Supplier" = "SupplierAttachment", "User" = "UserAttachment"
|
||||||
|
* })
|
||||||
* @ORM\EntityListeners({"App\EntityListeners\AttachmentDeleteListener"})
|
* @ORM\EntityListeners({"App\EntityListeners\AttachmentDeleteListener"})
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -56,11 +64,17 @@ abstract class Attachment extends NamedDBElement
|
||||||
protected $show_in_table = false;
|
protected $show_in_table = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string The filename using the %BASE% variable
|
* @var string The path to the file relative to a placeholder path like %MEDIA%
|
||||||
* @ORM\Column(type="string", name="filename")
|
* @ORM\Column(type="string", name="path")
|
||||||
*/
|
*/
|
||||||
protected $path = '';
|
protected $path = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string The original filenamethe file had, when the user uploaded it.
|
||||||
|
* @ORM\Column(type="string", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $original_filename;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ORM mapping is done in sub classes (like PartAttachment)
|
* ORM mapping is done in sub classes (like PartAttachment)
|
||||||
*/
|
*/
|
||||||
|
@ -68,7 +82,7 @@ abstract class Attachment extends NamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var AttachmentType
|
* @var AttachmentType
|
||||||
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments")
|
* @ORM\ManyToOne(targetEntity="AttachmentType", inversedBy="attachments_with_type")
|
||||||
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
|
* @ORM\JoinColumn(name="type_id", referencedColumnName="id")
|
||||||
* @Selectable()
|
* @Selectable()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -52,16 +52,20 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Attachments;
|
namespace App\Entity\Attachments;
|
||||||
|
|
||||||
|
use App\Entity\Base\MasterAttachmentTrait;
|
||||||
use App\Entity\Base\NamedDBElement;
|
use App\Entity\Base\NamedDBElement;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\MappedSuperclass()
|
* @ORM\MappedSuperclass()
|
||||||
*/
|
*/
|
||||||
abstract class AttachmentContainingDBElement extends NamedDBElement
|
abstract class AttachmentContainingDBElement extends NamedDBElement
|
||||||
{
|
{
|
||||||
|
use MasterAttachmentTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Attachment[]
|
* @var Attachment[]
|
||||||
* //TODO
|
* //TODO
|
||||||
|
|
|
@ -66,11 +66,17 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
class AttachmentType extends StructuralDBElement
|
class AttachmentType extends StructuralDBElement
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var ArrayCollection
|
* @var Collection|AttachmentTypeAttachment[]
|
||||||
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="attachment_type")
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\AttachmentTypeAttachment", mappedBy="element")
|
||||||
*/
|
*/
|
||||||
protected $attachments;
|
protected $attachments;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|Attachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="attachment_type")
|
||||||
|
*/
|
||||||
|
protected $attachments_with_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="AttachmentType", mappedBy="parent", cascade={"persist"})
|
* @ORM\OneToMany(targetEntity="AttachmentType", mappedBy="parent", cascade={"persist"})
|
||||||
*/
|
*/
|
||||||
|
|
61
src/Entity/Attachments/AttachmentTypeAttachment.php
Normal file
61
src/Entity/Attachments/AttachmentTypeAttachment.php
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof AttachmentType) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a AttachmentTypeAttachment must be an AttachmentType!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
63
src/Entity/Attachments/CategoryAttachment.php
Normal file
63
src/Entity/Attachments/CategoryAttachment.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof Category) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a CategoryAttachment must be a Category!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
67
src/Entity/Attachments/CurrencyAttachment.php
Normal file
67
src/Entity/Attachments/CurrencyAttachment.php
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof Currency) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a CurrencyAttachment must be a Currency!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
62
src/Entity/Attachments/DeviceAttachment.php
Normal file
62
src/Entity/Attachments/DeviceAttachment.php
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Device The element this attachment is associated with.
|
||||||
|
* @ORM\ManyToOne(targetEntity="App\Entity\Devices\Device", inversedBy="attachments")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof Device) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a PartAttachment must be a Device!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
63
src/Entity/Attachments/FootprintAttachment.php
Normal file
63
src/Entity/Attachments/FootprintAttachment.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof Footprint) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a FootprintAttachment must be a Footprint!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
69
src/Entity/Attachments/GroupAttachment.php
Normal file
69
src/Entity/Attachments/GroupAttachment.php
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof Group) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a UserAttachment must be a User!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
63
src/Entity/Attachments/ManufacturerAttachment.php
Normal file
63
src/Entity/Attachments/ManufacturerAttachment.php
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof Manufacturer) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a ManufacturerAttachment must be a Manufacturer!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
64
src/Entity/Attachments/MeasurementUnitAttachment.php
Normal file
64
src/Entity/Attachments/MeasurementUnitAttachment.php
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof MeasurementUnit) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a MeasurementUnitAttachmentAttachment must be a MeasurementUnit!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,7 +35,7 @@ use App\Entity\Parts\Part;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PartAttachment
|
* A attachment attached to a part element.
|
||||||
* @package App\Entity
|
* @package App\Entity
|
||||||
* @ORM\Entity()
|
* @ORM\Entity()
|
||||||
*/
|
*/
|
||||||
|
@ -43,7 +43,7 @@ class PartAttachment extends Attachment
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @var Part The element this attachment is associated with.
|
||||||
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments")
|
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments")
|
||||||
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
*/
|
*/
|
||||||
|
@ -56,7 +56,6 @@ class PartAttachment extends Attachment
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->element = $element;
|
$this->element = $element;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
65
src/Entity/Attachments/StorelocationAttachment.php
Normal file
65
src/Entity/Attachments/StorelocationAttachment.php
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof Storelocation) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a StorelocationAttachment must be a Storelocation!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
66
src/Entity/Attachments/SupplierAttachment.php
Normal file
66
src/Entity/Attachments/SupplierAttachment.php
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof Supplier) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a SupplierAttachment must be a Supplier!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
68
src/Entity/Attachments/UserAttachment.php
Normal file
68
src/Entity/Attachments/UserAttachment.php
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* part-db version 0.1
|
||||||
|
* Copyright (C) 2005 Christoph Lechner
|
||||||
|
* http://www.cl-projects.de/
|
||||||
|
*
|
||||||
|
* part-db version 0.2+
|
||||||
|
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
|
||||||
|
* http://code.google.com/p/part-db/
|
||||||
|
*
|
||||||
|
* Part-DB Version 0.4+
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
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")
|
||||||
|
* @ORM\JoinColumn(name="element_id", referencedColumnName="id", nullable=false, onDelete="CASCADE").
|
||||||
|
*/
|
||||||
|
protected $element;
|
||||||
|
|
||||||
|
public function setElement(AttachmentContainingDBElement $element): Attachment
|
||||||
|
{
|
||||||
|
if (!$element instanceof User) {
|
||||||
|
throw new \InvalidArgumentException('The element associated with a UserAttachment must be a User!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->element = $element;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,12 +29,13 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Entity\Parts\PartTraits;
|
namespace App\Entity\Base;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Attachments\Attachment;
|
use App\Entity\Attachments\Attachment;
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
use App\Security\Annotations\ColumnSecurity;
|
use App\Security\Annotations\ColumnSecurity;
|
||||||
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A entity with this class has a master attachment, which is used as a preview image for this object.
|
* A entity with this class has a master attachment, which is used as a preview image for this object.
|
||||||
|
@ -45,7 +46,7 @@ trait MasterAttachmentTrait
|
||||||
/**
|
/**
|
||||||
* @var Attachment
|
* @var Attachment
|
||||||
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
|
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
|
||||||
* @ORM\JoinColumn(name="id_master_picture_attachement", referencedColumnName="id")
|
* @ORM\JoinColumn(name="id_preview_attachement", referencedColumnName="id")
|
||||||
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
|
* @Assert\Expression("value == null or value.isPicture()", message="part.master_attachment.must_be_picture")
|
||||||
* @ColumnSecurity(prefix="attachments", type="object")
|
* @ColumnSecurity(prefix="attachments", type="object")
|
||||||
*/
|
*/
|
|
@ -61,7 +61,10 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Devices;
|
namespace App\Entity\Devices;
|
||||||
|
|
||||||
|
use App\Entity\Attachments\AttachmentTypeAttachment;
|
||||||
|
use App\Entity\Attachments\DeviceAttachment;
|
||||||
use App\Entity\Base\PartsContainingDBElement;
|
use App\Entity\Base\PartsContainingDBElement;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,6 +75,13 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
*/
|
*/
|
||||||
class Device extends PartsContainingDBElement
|
class Device extends PartsContainingDBElement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|DeviceAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\DeviceAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Device", mappedBy="parent")
|
* @ORM\OneToMany(targetEntity="Device", mappedBy="parent")
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -52,7 +52,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Parts;
|
namespace App\Entity\Parts;
|
||||||
|
|
||||||
|
use App\Entity\Attachments\CategoryAttachment;
|
||||||
use App\Entity\Base\PartsContainingDBElement;
|
use App\Entity\Base\PartsContainingDBElement;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,6 +65,13 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
*/
|
*/
|
||||||
class Category extends PartsContainingDBElement
|
class Category extends PartsContainingDBElement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|CategoryAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CategoryAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
|
* @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -61,7 +61,10 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Parts;
|
namespace App\Entity\Parts;
|
||||||
|
|
||||||
|
use App\Entity\Attachments\Attachment;
|
||||||
|
use App\Entity\Attachments\FootprintAttachment;
|
||||||
use App\Entity\Base\PartsContainingDBElement;
|
use App\Entity\Base\PartsContainingDBElement;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,6 +75,12 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
*/
|
*/
|
||||||
class Footprint extends PartsContainingDBElement
|
class Footprint extends PartsContainingDBElement
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Collection|FootprintAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\FootprintAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Footprint", mappedBy="parent")
|
* @ORM\OneToMany(targetEntity="Footprint", mappedBy="parent")
|
||||||
*/
|
*/
|
||||||
|
@ -83,22 +92,17 @@ class Footprint extends PartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
protected $parent;
|
protected $parent;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
* @ORM\Column(type="text")
|
|
||||||
*/
|
|
||||||
protected $filename;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Part", mappedBy="footprint", fetch="EXTRA_LAZY")
|
* @ORM\OneToMany(targetEntity="Part", mappedBy="footprint", fetch="EXTRA_LAZY")
|
||||||
*/
|
*/
|
||||||
protected $parts;
|
protected $parts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var FootprintAttachment
|
||||||
* @ORM\Column(type="text")
|
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\FootprintAttachment")
|
||||||
|
* @ORM\JoinColumn(name="id_footprint_3d", referencedColumnName="id")
|
||||||
*/
|
*/
|
||||||
protected $filename_3d;
|
protected $footprint_3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ID as an string, defined by the element class.
|
* Returns the ID as an string, defined by the element class.
|
||||||
|
|
|
@ -61,7 +61,10 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Parts;
|
namespace App\Entity\Parts;
|
||||||
|
|
||||||
|
use App\Entity\Attachments\FootprintAttachment;
|
||||||
|
use App\Entity\Attachments\ManufacturerAttachment;
|
||||||
use App\Entity\Base\Company;
|
use App\Entity\Base\Company;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,6 +75,13 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
*/
|
*/
|
||||||
class Manufacturer extends Company
|
class Manufacturer extends Company
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Collection|ManufacturerAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Manufacturer", mappedBy="parent")
|
* @ORM\OneToMany(targetEntity="Manufacturer", mappedBy="parent")
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,7 +32,10 @@
|
||||||
namespace App\Entity\Parts;
|
namespace App\Entity\Parts;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Entity\Attachments\ManufacturerAttachment;
|
||||||
|
use App\Entity\Attachments\MeasurementUnitAttachment;
|
||||||
use App\Entity\Base\PartsContainingDBElement;
|
use App\Entity\Base\PartsContainingDBElement;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
@ -49,6 +52,12 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||||
class MeasurementUnit extends PartsContainingDBElement
|
class MeasurementUnit extends PartsContainingDBElement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|MeasurementUnitAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\MeasurementUnitAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
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 gramms)
|
||||||
* or m (for meters).
|
* or m (for meters).
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace App\Entity\Parts;
|
||||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||||
use App\Entity\Devices\Device;
|
use App\Entity\Devices\Device;
|
||||||
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
|
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
|
||||||
use App\Entity\Parts\PartTraits\MasterAttachmentTrait;
|
use App\Entity\Base\MasterAttachmentTrait;
|
||||||
use App\Entity\Parts\PartTraits\BasicPropertyTrait;
|
use App\Entity\Parts\PartTraits\BasicPropertyTrait;
|
||||||
use App\Entity\Parts\PartTraits\InstockTrait;
|
use App\Entity\Parts\PartTraits\InstockTrait;
|
||||||
use App\Entity\Parts\PartTraits\ManufacturerTrait;
|
use App\Entity\Parts\PartTraits\ManufacturerTrait;
|
||||||
|
@ -87,7 +87,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||||
class Part extends AttachmentContainingDBElement
|
class Part extends AttachmentContainingDBElement
|
||||||
{
|
{
|
||||||
use AdvancedPropertyTrait;
|
use AdvancedPropertyTrait;
|
||||||
use MasterAttachmentTrait;
|
//use MasterAttachmentTrait;
|
||||||
use BasicPropertyTrait;
|
use BasicPropertyTrait;
|
||||||
use InstockTrait;
|
use InstockTrait;
|
||||||
use ManufacturerTrait;
|
use ManufacturerTrait;
|
||||||
|
|
|
@ -61,7 +61,10 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Parts;
|
namespace App\Entity\Parts;
|
||||||
|
|
||||||
|
use App\Entity\Attachments\ManufacturerAttachment;
|
||||||
|
use App\Entity\Attachments\StorelocationAttachment;
|
||||||
use App\Entity\Base\PartsContainingDBElement;
|
use App\Entity\Base\PartsContainingDBElement;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,6 +75,13 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
*/
|
*/
|
||||||
class Storelocation extends PartsContainingDBElement
|
class Storelocation extends PartsContainingDBElement
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|StorelocationAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Storelocation", mappedBy="parent")
|
* @ORM\OneToMany(targetEntity="Storelocation", mappedBy="parent")
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -61,9 +61,12 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Parts;
|
namespace App\Entity\Parts;
|
||||||
|
|
||||||
|
use App\Entity\Attachments\ManufacturerAttachment;
|
||||||
|
use App\Entity\Attachments\SupplierAttachment;
|
||||||
use App\Entity\Base\Company;
|
use App\Entity\Base\Company;
|
||||||
use App\Entity\PriceInformations\Currency;
|
use App\Entity\PriceInformations\Currency;
|
||||||
use App\Validator\Constraints\Selectable;
|
use App\Validator\Constraints\Selectable;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
|
@ -75,6 +78,12 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||||
*/
|
*/
|
||||||
class Supplier extends Company
|
class Supplier extends Company
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Collection|SupplierAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Supplier", mappedBy="parent")
|
* @ORM\OneToMany(targetEntity="Supplier", mappedBy="parent")
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,7 +32,10 @@
|
||||||
namespace App\Entity\PriceInformations;
|
namespace App\Entity\PriceInformations;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Entity\Attachments\CurrencyAttachment;
|
||||||
|
use App\Entity\Attachments\SupplierAttachment;
|
||||||
use App\Entity\Base\StructuralDBElement;
|
use App\Entity\Base\StructuralDBElement;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
@ -49,6 +52,12 @@ class Currency extends StructuralDBElement
|
||||||
|
|
||||||
public const PRICE_SCALE = 5;
|
public const PRICE_SCALE = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|CurrencyAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\CurrencyAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string The 3 letter ISO code of the currency.
|
* @var string The 3 letter ISO code of the currency.
|
||||||
* @ORM\Column(type="string")
|
* @ORM\Column(type="string")
|
||||||
|
|
|
@ -31,9 +31,12 @@
|
||||||
|
|
||||||
namespace App\Entity\UserSystem;
|
namespace App\Entity\UserSystem;
|
||||||
|
|
||||||
|
use App\Entity\Attachments\GroupAttachment;
|
||||||
|
use App\Entity\Attachments\SupplierAttachment;
|
||||||
use App\Entity\Base\StructuralDBElement;
|
use App\Entity\Base\StructuralDBElement;
|
||||||
use App\Security\Interfaces\HasPermissionsInterface;
|
use App\Security\Interfaces\HasPermissionsInterface;
|
||||||
use App\Validator\Constraints\ValidPermission;
|
use App\Validator\Constraints\ValidPermission;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +47,13 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
*/
|
*/
|
||||||
class Group extends StructuralDBElement implements HasPermissionsInterface
|
class Group extends StructuralDBElement implements HasPermissionsInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|GroupAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\ManufacturerAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Group", mappedBy="parent")
|
* @ORM\OneToMany(targetEntity="Group", mappedBy="parent")
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -61,11 +61,15 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\UserSystem;
|
namespace App\Entity\UserSystem;
|
||||||
|
|
||||||
|
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||||
|
use App\Entity\Attachments\SupplierAttachment;
|
||||||
|
use App\Entity\Attachments\UserAttachment;
|
||||||
use App\Entity\Base\NamedDBElement;
|
use App\Entity\Base\NamedDBElement;
|
||||||
use App\Entity\PriceInformations\Currency;
|
use App\Entity\PriceInformations\Currency;
|
||||||
use App\Security\Interfaces\HasPermissionsInterface;
|
use App\Security\Interfaces\HasPermissionsInterface;
|
||||||
use App\Validator\Constraints\Selectable;
|
use App\Validator\Constraints\Selectable;
|
||||||
use App\Validator\Constraints\ValidPermission;
|
use App\Validator\Constraints\ValidPermission;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
@ -79,11 +83,17 @@ use Symfony\Component\Validator\Constraints as Assert;
|
||||||
* @ORM\Table("`users`")
|
* @ORM\Table("`users`")
|
||||||
* @UniqueEntity("name", message="validator.user.username_already_used")
|
* @UniqueEntity("name", message="validator.user.username_already_used")
|
||||||
*/
|
*/
|
||||||
class User extends NamedDBElement implements UserInterface, HasPermissionsInterface
|
class User extends AttachmentContainingDBElement implements UserInterface, HasPermissionsInterface
|
||||||
{
|
{
|
||||||
/** The User id of the anonymous user */
|
/** The User id of the anonymous user */
|
||||||
public const ID_ANONYMOUS = 1;
|
public const ID_ANONYMOUS = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection|UserAttachment[]
|
||||||
|
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\UserAttachment", mappedBy="element")
|
||||||
|
*/
|
||||||
|
protected $attachments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Id()
|
* @ORM\Id()
|
||||||
* @ORM\GeneratedValue()
|
* @ORM\GeneratedValue()
|
||||||
|
@ -190,11 +200,6 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
||||||
*/
|
*/
|
||||||
protected $permissions;
|
protected $permissions;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(type="text", name="config_image_path")
|
|
||||||
*/
|
|
||||||
protected $image_path = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text", name="config_instock_comment_w")
|
* @ORM\Column(type="text", name="config_instock_comment_w")
|
||||||
*/
|
*/
|
||||||
|
@ -205,8 +210,28 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
||||||
*/
|
*/
|
||||||
protected $instock_comment_a = '';
|
protected $instock_comment_a = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string|null The hash of a token the user must provide when he wants to reset his password.
|
||||||
|
* @ORM\Column(type="string", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $pw_reset_token = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \DateTime The time until the password reset token is valid.
|
||||||
|
* @ORM\Column(type="datetime", nullable=true)
|
||||||
|
*/
|
||||||
|
protected $pw_reset_expires = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool Determines if the user is disabled (user can not log in)
|
||||||
|
* @ORM\Column(type="boolean")
|
||||||
|
*/
|
||||||
|
protected $disabled = false;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
parent::__construct();
|
||||||
$this->permissions = new PermissionsEmbed();
|
$this->permissions = new PermissionsEmbed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
117
src/Migrations/Version20190924113252.php
Normal file
117
src/Migrations/Version20190924113252.php
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20190924113252 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE users ADD id_preview_attachement INT DEFAULT NULL, ADD pw_reset_token VARCHAR(255) DEFAULT NULL, ADD pw_reset_expires DATETIME DEFAULT NULL, ADD disabled TINYINT(1) NOT NULL, DROP config_image_path');
|
||||||
|
$this->addSql('ALTER TABLE users ADD CONSTRAINT FK_1483A5E96DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_1483A5E96DEDCEC2 ON users (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE attachment_types ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE attachment_types ADD CONSTRAINT FK_EFAED7196DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_EFAED7196DEDCEC2 ON attachment_types (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE categories ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE categories ADD CONSTRAINT FK_3AF346686DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_3AF346686DEDCEC2 ON categories (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE currencies ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE currencies ADD CONSTRAINT FK_37C446936DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_37C446936DEDCEC2 ON currencies (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE devices ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE devices ADD CONSTRAINT FK_11074E9A6DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_11074E9A6DEDCEC2 ON devices (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE footprints ADD id_footprint_3d INT DEFAULT NULL, ADD id_preview_attachement INT DEFAULT NULL, DROP filename, DROP filename_3d');
|
||||||
|
$this->addSql('ALTER TABLE footprints ADD CONSTRAINT FK_A34D68A232A38C34 FOREIGN KEY (id_footprint_3d) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('ALTER TABLE footprints ADD CONSTRAINT FK_A34D68A26DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A34D68A232A38C34 ON footprints (id_footprint_3d)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A34D68A26DEDCEC2 ON footprints (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE manufacturers ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE manufacturers ADD CONSTRAINT FK_94565B126DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_94565B126DEDCEC2 ON manufacturers (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE measurement_units ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE measurement_units ADD CONSTRAINT FK_F5AF83CF6DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_F5AF83CF6DEDCEC2 ON measurement_units (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE storelocations ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE storelocations ADD CONSTRAINT FK_75170206DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_75170206DEDCEC2 ON storelocations (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE suppliers ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE suppliers ADD CONSTRAINT FK_AC28B95C6DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_AC28B95C6DEDCEC2 ON suppliers (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE attachments DROP FOREIGN KEY FK_47C4FAD61F1F2A24');
|
||||||
|
$this->addSql('ALTER TABLE attachments ADD original_filename VARCHAR(255) DEFAULT NULL, CHANGE filename path VARCHAR(255) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE `groups` ADD id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE `groups` ADD CONSTRAINT FK_F06D39706DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_F06D39706DEDCEC2 ON `groups` (id_preview_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE parts DROP FOREIGN KEY FK_6940A7FEEBBCC786');
|
||||||
|
$this->addSql('DROP INDEX IDX_6940A7FEEBBCC786 ON parts');
|
||||||
|
$this->addSql('ALTER TABLE parts CHANGE id_master_picture_attachement id_preview_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE parts ADD CONSTRAINT FK_6940A7FE6DEDCEC2 FOREIGN KEY (id_preview_attachement) REFERENCES `attachments` (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_6940A7FE6DEDCEC2 ON parts (id_preview_attachement)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE `attachment_types` DROP FOREIGN KEY FK_EFAED7196DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_EFAED7196DEDCEC2 ON `attachment_types`');
|
||||||
|
$this->addSql('ALTER TABLE `attachment_types` DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `attachments` DROP original_filename, CHANGE path filename VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci');
|
||||||
|
$this->addSql('ALTER TABLE `attachments` ADD CONSTRAINT FK_47C4FAD61F1F2A24 FOREIGN KEY (element_id) REFERENCES parts (id) ON DELETE CASCADE');
|
||||||
|
$this->addSql('ALTER TABLE `categories` DROP FOREIGN KEY FK_3AF346686DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_3AF346686DEDCEC2 ON `categories`');
|
||||||
|
$this->addSql('ALTER TABLE `categories` DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE currencies DROP FOREIGN KEY FK_37C446936DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_37C446936DEDCEC2 ON currencies');
|
||||||
|
$this->addSql('ALTER TABLE currencies DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `devices` DROP FOREIGN KEY FK_11074E9A6DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_11074E9A6DEDCEC2 ON `devices`');
|
||||||
|
$this->addSql('ALTER TABLE `devices` DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `footprints` DROP FOREIGN KEY FK_A34D68A232A38C34');
|
||||||
|
$this->addSql('ALTER TABLE `footprints` DROP FOREIGN KEY FK_A34D68A26DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_A34D68A232A38C34 ON `footprints`');
|
||||||
|
$this->addSql('DROP INDEX IDX_A34D68A26DEDCEC2 ON `footprints`');
|
||||||
|
$this->addSql('ALTER TABLE `footprints` ADD filename MEDIUMTEXT NOT NULL COLLATE utf8_unicode_ci, ADD filename_3d MEDIUMTEXT NOT NULL COLLATE utf8_unicode_ci, DROP id_footprint_3d, DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `groups` DROP FOREIGN KEY FK_F06D39706DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_F06D39706DEDCEC2 ON `groups`');
|
||||||
|
$this->addSql('ALTER TABLE `groups` DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `manufacturers` DROP FOREIGN KEY FK_94565B126DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_94565B126DEDCEC2 ON `manufacturers`');
|
||||||
|
$this->addSql('ALTER TABLE `manufacturers` DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `measurement_units` DROP FOREIGN KEY FK_F5AF83CF6DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_F5AF83CF6DEDCEC2 ON `measurement_units`');
|
||||||
|
$this->addSql('ALTER TABLE `measurement_units` DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FE6DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_6940A7FE6DEDCEC2 ON `parts`');
|
||||||
|
$this->addSql('ALTER TABLE `parts` CHANGE id_preview_attachement id_master_picture_attachement INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE `parts` ADD CONSTRAINT FK_6940A7FEEBBCC786 FOREIGN KEY (id_master_picture_attachement) REFERENCES attachments (id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_6940A7FEEBBCC786 ON `parts` (id_master_picture_attachement)');
|
||||||
|
$this->addSql('ALTER TABLE `storelocations` DROP FOREIGN KEY FK_75170206DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_75170206DEDCEC2 ON `storelocations`');
|
||||||
|
$this->addSql('ALTER TABLE `storelocations` DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `suppliers` DROP FOREIGN KEY FK_AC28B95C6DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_AC28B95C6DEDCEC2 ON `suppliers`');
|
||||||
|
$this->addSql('ALTER TABLE `suppliers` DROP id_preview_attachement');
|
||||||
|
$this->addSql('ALTER TABLE `users` DROP FOREIGN KEY FK_1483A5E96DEDCEC2');
|
||||||
|
$this->addSql('DROP INDEX IDX_1483A5E96DEDCEC2 ON `users`');
|
||||||
|
$this->addSql('ALTER TABLE `users` ADD config_image_path TEXT NOT NULL COLLATE utf8_general_ci, DROP id_preview_attachement, DROP pw_reset_token, DROP pw_reset_expires, DROP disabled');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue