Skip to content

Commit

Permalink
Apply php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dvesh3 authored and github-actions[bot] committed Aug 1, 2023
1 parent 03c06ee commit 0cee680
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 23 deletions.
4 changes: 1 addition & 3 deletions lib/Maintenance/Tasks/CleanupBrickTablesTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@
*/
class CleanupBrickTablesTask implements TaskInterface
{

public function __construct(private ConcreteTaskHelperInterface $helper)
{
}

public function execute(): void
{
$this->helper->cleanupCollectionTable();
$this->helper->cleanupCollectionTable();
}

}
3 changes: 0 additions & 3 deletions lib/Maintenance/Tasks/CleanupFieldcollectionTablesTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
use Pimcore\Maintenance\TaskInterface;
use Pimcore\Maintenance\Tasks\DataObject\ConcreteTaskHelperInterface;


/**
* @internal
*/
class CleanupFieldcollectionTablesTask implements TaskInterface
{

public function __construct(private ConcreteTaskHelperInterface $helper)
{
}
Expand All @@ -34,5 +32,4 @@ public function execute(): void
{
$this->helper->cleanupCollectionTable();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Maintenance\Tasks\DataObject;

use Doctrine\DBAL\Connection;
use Pimcore\Db;
use Pimcore\Model\DataObject\Objectbrick\Definition;
use Psr\Log\LoggerInterface;

Expand All @@ -32,8 +31,8 @@ public function __construct(
private LoggerInterface $logger,
private DataObjectTaskHelperInterface $helper,
private Connection $db
)
{ }
) {
}

public function cleanupCollectionTable(): void
{
Expand Down Expand Up @@ -76,8 +75,10 @@ private function checkIfBrickExists(string $brickType, string $tableName): bool
$brickDef = Definition::getByKey($brickType);
if (!$brickDef) {
$this->logger->error("Brick '" . $brickType . "' not found. Please check table " . $tableName);

return false;
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Maintenance\Tasks\DataObject;

use Doctrine\DBAL\Connection;
use Pimcore\Db;
use Psr\Log\LoggerInterface;

/**
Expand All @@ -32,8 +31,8 @@ public function __construct(
private LoggerInterface $logger,
private DataObjectTaskHelperInterface $helper,
private Connection $db
)
{ }
) {
}

public function cleanupCollectionTable(): void
{
Expand Down Expand Up @@ -87,8 +86,10 @@ private function checkIfFcExists(string $fcType, string $tableName): bool
$fcDef = \Pimcore\Model\DataObject\Fieldcollection\Definition::getByKey($fcType);
if (!$fcDef) {
$this->logger->error("Fieldcollection '" . $fcType . "' not found. Please check table " . $tableName);

return false;
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
interface ConcreteTaskHelperInterface
{
public function cleanupCollectionTable(): void;

}
22 changes: 17 additions & 5 deletions lib/Maintenance/Tasks/DataObject/DataObjectTaskHelper.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
<?php
declare(strict_types=1);

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Maintenance\Tasks\DataObject;

use Doctrine\DBAL\Connection;
use Pimcore\Db;
use Pimcore\Model\DataObject\ClassDefinition;
use Psr\Log\LoggerInterface;

Expand All @@ -16,8 +28,8 @@ class DataObjectTaskHelper implements DataObjectTaskHelperInterface
public function __construct(
private LoggerInterface $logger,
private Connection $db
)
{ }
) {
}

public function getCollectionNames(string $dir): array
{
Expand All @@ -39,11 +51,11 @@ public function cleanupTable(
string $tableName,
string $classId,
bool $isLocalized = true
): void
{
): void {
$classDefinition = ClassDefinition::getByIdIgnoreCase($classId);
if (!$classDefinition) {
$this->logger->error("Classdefinition '" . $classId . "' not found. Please check table " . $tableName);

return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ public function cleanupTable(
string $classId,
bool $isLocalized = true
): void;

}

0 comments on commit 0cee680

Please sign in to comment.