Skip to content

Commit

Permalink
Merge pull request #20 from netbrothers-gmbh/19-user-deprecated-since…
Browse files Browse the repository at this point in the history
…-symfonyconsole-61-relying-on-the-static-property-$defaultname-for-setting-a-command-name-is-deprecated

Ready for Symfony 6.4
  • Loading branch information
netbrothers-sw authored Dec 6, 2023
2 parents 369e46a + 6c15afe commit ebbf848
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 29 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog for NetBrothers Versions
===================================

Version 2.0.0 - 06.12.2023
----------------------------------
- Fixing Deprecated Since symfony/console 6.1: Relying on the static property "$defaultName"
for setting a command name is deprecated.
- updated symfony requirements to >=6 <7
- updated php requirements to >=8.1
- Upgrading Version-Number to 2.0.0

Version 0.0.4 - 18.02.2022
----------------------------------
- Fixing Bug "There is no active transaction".
Expand Down
9 changes: 2 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"mariadb"
],
"require": {
"php": ">=7.4",
"symfony/console": "*",
"php": ">=8.1",
"symfony/console": ">=6 <7",
"doctrine/orm": "*",
"doctrine/dbal": "^3.5"
},
Expand All @@ -36,11 +36,6 @@
"NetBrothers\\VersionBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"NetBrothers\\VersionBundle\\Tests\\": "tests/"
}
},
"bin": [
"bin/netbrothers-version"
],
Expand Down
38 changes: 18 additions & 20 deletions src/Command/MakeVersionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use NetBrothers\VersionBundle\Services\JobService;
use NetBrothers\VersionBundle\Services\Sql\ExecuteService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -26,28 +27,28 @@
* Class MakeVersionCommand
* @package NetBrothers\VersionBundle\Command
*/
#[AsCommand(
name: 'netbrothers:version',
description: 'Create version tables and triggers.',
)]
class MakeVersionCommand extends Command
{
/** @inheritdoc */
protected static $defaultName = 'netbrothers:version';

/** @var JobService */
private $jobService;
private JobService $jobService;

/** @var GenerateService */
private $generateService;
private GenerateService $generateService;

/** @var array */
private $sql = [];
/** @var array<int, string> */
private array $sql = [];

/** @var array */
private $jobs = [];
private array $jobs = [];

/** @var ExecuteService */
private $executeService;
private ExecuteService $executeService;

/** @var EntityManagerInterface */
private $entityManager;
private EntityManagerInterface $entityManager;

/** configuration */
protected function configure()
Expand Down Expand Up @@ -93,20 +94,16 @@ protected function configure()
}

/**
* @param null|EntityManagerInterface $entityManager
* @param array $ignoreTables
* @param array $excludeColumnNames
* @param bool $initLater
* @return void
* @throws InvalidArgumentException
* @throws InvalidArgumentException
*/
public function __construct(
?EntityManagerInterface $entityManager = null,
array $ignoreTables = [],
array $excludeColumnNames = [],
bool $initLater = false
bool $initLater = false,
string $name = null
) {
parent::__construct();
parent::__construct($name);
if ($initLater) {
return;
}
Expand All @@ -130,7 +127,8 @@ protected function initCommand(
EntityManagerInterface $entityManager = null,
array $ignoreTables = [],
array $excludeColumnNames = []
) {
): void
{
$this->entityManager = $entityManager;
$con = $this->entityManager->getConnection();
$con->getConfiguration()->setSchemaAssetsFilter(null);
Expand Down
7 changes: 5 additions & 2 deletions src/Command/MakeVersionStandaloneCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

use Symfony\Component\Console\Attribute\AsCommand;
/**
* Project: netbrothers-gmbh/version-bundle
*
* @author Thilo Ratnaweera <info@netbrothers.de>
* @copyright © 2021 NetBrothers GmbH.
* @license MIT
*/
#[AsCommand(
name: 'netbrothers:version-standalone',
description: 'Create version tables and triggers.',
)]
final class MakeVersionStandaloneCommand extends MakeVersionCommand
{
private EntityManagerInterface $entityManager;
protected static $defaultName = 'netbrothers:version-standalone';

protected function configure()
{
Expand Down

0 comments on commit ebbf848

Please sign in to comment.