mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Applied code style rules to src/
This commit is contained in:
parent
700c049d26
commit
f861de791f
186 changed files with 1462 additions and 1059 deletions
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -26,7 +29,7 @@ use Doctrine\Common\Persistence\ObjectManager;
|
|||
|
||||
class AppFixtures extends Fixture
|
||||
{
|
||||
public function load(ObjectManager $manager)
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
// $product = new Product();
|
||||
// $manager->persist($product);
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -46,7 +49,7 @@ class DataStructureFixtures extends Fixture
|
|||
/**
|
||||
* Load data fixtures with the passed EntityManager.
|
||||
*/
|
||||
public function load(ObjectManager $manager)
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
//Reset autoincrement
|
||||
$types = [AttachmentType::class, Device::class, Category::class, Footprint::class, Manufacturer::class,
|
||||
|
@ -65,14 +68,14 @@ class DataStructureFixtures extends Fixture
|
|||
* @param string $class The class for which the nodes should be generated (must be a StructuralDBElement child)
|
||||
* @param ObjectManager $manager The ObjectManager that should be used to persist the nodes
|
||||
*/
|
||||
public function createNodesForClass(string $class, ObjectManager $manager)
|
||||
public function createNodesForClass(string $class, ObjectManager $manager): void
|
||||
{
|
||||
if (!new $class() instanceof StructuralDBElement) {
|
||||
if (! new $class() instanceof StructuralDBElement) {
|
||||
throw new \InvalidArgumentException('$class must be a StructuralDBElement!');
|
||||
}
|
||||
|
||||
$table_name = $this->em->getClassMetadata($class)->getTableName();
|
||||
$this->em->getConnection()->exec("ALTER TABLE `$table_name` AUTO_INCREMENT = 1;");
|
||||
$this->em->getConnection()->exec("ALTER TABLE `${table_name}` AUTO_INCREMENT = 1;");
|
||||
|
||||
/** @var StructuralDBElement $node1 */
|
||||
$node1 = new $class();
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -31,21 +34,21 @@ class GroupFixtures extends Fixture
|
|||
public const USERS = 'group-users';
|
||||
public const READONLY = 'group-readonly';
|
||||
|
||||
public function load(ObjectManager $manager)
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$admins = new Group();
|
||||
$admins->setName('admins');
|
||||
//Perm values taken from Version 1
|
||||
$admins->getPermissions()->setRawPermissionValues([
|
||||
'system' => '21', 'groups' => '1365', 'users' => '87381', 'self' => '85', 'config' => '85',
|
||||
'database' => '21', 'parts' => '1431655765', 'parts_name' => '5', 'parts_description' => '5',
|
||||
'parts_footprint' => '5', 'parts_manufacturer' => '5', 'parts_comment' => '5', 'parts_order' => '5',
|
||||
'parts_orderdetails' => '341', 'parts_prices' => '341', 'parts_attachments' => '341', 'devices' => '5461',
|
||||
'devices_parts' => '325', 'storelocations' => '5461', 'footprints' => '5461', 'categories' => '5461',
|
||||
'suppliers' => '5461', 'manufacturers' => '5461', 'attachment_types' => '1365', 'tools' => '1365',
|
||||
'labels' => '21', 'parts_category' => '5', 'parts_minamount' => '5', 'parts_lots' => '85', 'parts_tags' => '5',
|
||||
'parts_unit' => '5', 'parts_mass' => '5', 'parts_status' => '5', 'parts_mpn' => '5', 'currencies' => '5461',
|
||||
'measurement_units' => '5461',
|
||||
'system' => 21, 'groups' => 1365, 'users' => 87381, 'self' => 85, 'config' => 85,
|
||||
'database' => 21, 'parts' => 1431655765, 'parts_name' => 5, 'parts_description' => 5,
|
||||
'parts_footprint' => 5, 'parts_manufacturer' => 5, 'parts_comment' => 5, 'parts_order' => 5,
|
||||
'parts_orderdetails' => 341, 'parts_prices' => 341, 'parts_attachments' => 341, 'devices' => 5461,
|
||||
'devices_parts' => 325, 'storelocations' => 5461, 'footprints' => 5461, 'categories' => 5461,
|
||||
'suppliers' => 5461, 'manufacturers' => 5461, 'attachment_types' => 1365, 'tools' => 1365,
|
||||
'labels' => 21, 'parts_category' => 5, 'parts_minamount' => 5, 'parts_lots' => 85, 'parts_tags' => 5,
|
||||
'parts_unit' => 5, 'parts_mass' => 5, 'parts_status' => 5, 'parts_mpn' => 5, 'currencies' => 5461,
|
||||
'measurement_units' => 5461,
|
||||
]);
|
||||
$this->setReference(self::ADMINS, $admins);
|
||||
$manager->persist($admins);
|
||||
|
@ -53,15 +56,15 @@ class GroupFixtures extends Fixture
|
|||
$readonly = new Group();
|
||||
$readonly->setName('readonly');
|
||||
$readonly->getPermissions()->setRawPermissionValues([
|
||||
'system' => '2', 'groups' => '2730', 'users' => '43690', 'self' => '25', 'config' => '170',
|
||||
'database' => '42', 'parts' => '2778027689', 'parts_name' => '9', 'parts_description' => '9',
|
||||
'parts_footprint' => '9', 'parts_manufacturer' => '9', 'parts_comment' => '9', 'parts_order' => '9',
|
||||
'parts_orderdetails' => '681', 'parts_prices' => '681', 'parts_attachments' => '681', 'devices' => '1705',
|
||||
'devices_parts' => '649', 'storelocations' => '1705', 'footprints' => '1705', 'categories' => '1705',
|
||||
'suppliers' => '1705', 'manufacturers' => '1705', 'attachment_types' => '681', 'tools' => '1366',
|
||||
'labels' => '165', 'parts_category' => '9', 'parts_minamount' => '9', 'parts_lots' => '169', 'parts_tags' => '9',
|
||||
'parts_unit' => '9', 'parts_mass' => '9', 'parts_status' => '9', 'parts_mpn' => '9', 'currencies' => '9897',
|
||||
'measurement_units' => '9897',
|
||||
'system' => 2, 'groups' => 2730, 'users' => 43690, 'self' => 25, 'config' => 170,
|
||||
'database' => 42, 'parts' => 2778027689, 'parts_name' => 9, 'parts_description' => 9,
|
||||
'parts_footprint' => 9, 'parts_manufacturer' => 9, 'parts_comment' => 9, 'parts_order' => 9,
|
||||
'parts_orderdetails' => 681, 'parts_prices' => 681, 'parts_attachments' => 681, 'devices' => 1705,
|
||||
'devices_parts' => 649, 'storelocations' => 1705, 'footprints' => 1705, 'categories' => 1705,
|
||||
'suppliers' => 1705, 'manufacturers' => 1705, 'attachment_types' => 681, 'tools' => 1366,
|
||||
'labels' => 165, 'parts_category' => 9, 'parts_minamount' => 9, 'parts_lots' => 169, 'parts_tags' => 9,
|
||||
'parts_unit' => 9, 'parts_mass' => 9, 'parts_status' => 9, 'parts_mpn' => 9, 'currencies' => 9897,
|
||||
'measurement_units' => 9897,
|
||||
]);
|
||||
$this->setReference(self::READONLY, $readonly);
|
||||
$manager->persist($readonly);
|
||||
|
@ -69,15 +72,15 @@ class GroupFixtures extends Fixture
|
|||
$users = new Group();
|
||||
$users->setName('users');
|
||||
$users->getPermissions()->setRawPermissionValues([
|
||||
'system' => '42', 'groups' => '2730', 'users' => '43690', 'self' => '89', 'config' => '105',
|
||||
'database' => '41', 'parts' => '1431655765', 'parts_name' => '5', 'parts_description' => '5',
|
||||
'parts_footprint' => '5', 'parts_manufacturer' => '5', 'parts_comment' => '5', 'parts_order' => '5',
|
||||
'parts_orderdetails' => '341', 'parts_prices' => '341', 'parts_attachments' => '341', 'devices' => '5461',
|
||||
'devices_parts' => '325', 'storelocations' => '5461', 'footprints' => '5461', 'categories' => '5461',
|
||||
'suppliers' => '5461', 'manufacturers' => '5461', 'attachment_types' => '1365', 'tools' => '1365',
|
||||
'labels' => '85', 'parts_category' => '5', 'parts_minamount' => '5', 'parts_lots' => '85', 'parts_tags' => '5',
|
||||
'parts_unit' => '5', 'parts_mass' => '5', 'parts_status' => '5', 'parts_mpn' => '5', 'currencies' => '5461',
|
||||
'measurement_units' => '5461',
|
||||
'system' => 42, 'groups' => 2730, 'users' => 43690, 'self' => 89, 'config' => 105,
|
||||
'database' => 41, 'parts' => 1431655765, 'parts_name' => 5, 'parts_description' => 5,
|
||||
'parts_footprint' => 5, 'parts_manufacturer' => 5, 'parts_comment' => 5, 'parts_order' => 5,
|
||||
'parts_orderdetails' => 341, 'parts_prices' => 341, 'parts_attachments' => 341, 'devices' => 5461,
|
||||
'devices_parts' => 325, 'storelocations' => 5461, 'footprints' => 5461, 'categories' => 5461,
|
||||
'suppliers' => 5461, 'manufacturers' => 5461, 'attachment_types' => 1365, 'tools' => 1365,
|
||||
'labels' => 85, 'parts_category' => 5, 'parts_minamount' => 5, 'parts_lots' => 85, 'parts_tags' => 5,
|
||||
'parts_unit' => 5, 'parts_mass' => 5, 'parts_status' => 5, 'parts_mpn' => 5, 'currencies' => 5461,
|
||||
'measurement_units' => 5461,
|
||||
]);
|
||||
$this->setReference(self::USERS, $users);
|
||||
$manager->persist($users);
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -38,7 +41,7 @@ class UserFixtures extends Fixture
|
|||
$this->encoder = $encoder;
|
||||
}
|
||||
|
||||
public function load(ObjectManager $manager)
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
//Reset autoincrement
|
||||
$this->em->getConnection()->exec('ALTER TABLE `users` AUTO_INCREMENT = 1;');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue