Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Version 13.1.0

## Features

### PHP 8.4 Compatibility

* Update dependencies
* Add PHP 8.4 support
* Replace abandoned `swiftmailer/swiftmailer` with `symfony/mailer`

# Version 13.0.0

## Features
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"require": {
"php": "^8.1",
"ramsey/uuid": "^4.2|^4.7",
"symfony/config": "~4.0|~5.0|~6.0",
"symfony/config": "~5.0|~6.0|~7.0",
"symfony/console": "~4.0|~5.0|~6.0|~7.0",
"symfony/expression-language": "~6.0",
"symfony/dependency-injection": "~4.0|~5.0|~6.0",
"techdivision/import-app-simple": "^19.0.0",
"techdivision/import-configuration-jms": "^18.0.0"
"symfony/dependency-injection": "~5.0|~6.0|~7.0",
"techdivision/import-app-simple": "^19.0",
"techdivision/import-configuration-jms": "^18.1"
},
"require-dev": {
"doctrine/dbal": "^4.0.4",
Expand Down
40 changes: 36 additions & 4 deletions config.json.simple
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@
{
"id": "import_cli.plugin.debug.send",
"subjects": [],
"swift-mailer": {
"id": "import.logger.factory.transport.swift.sendmail",
"mailer": {
"id": "import.logger.factory.transport.mailer.sendmail",
"transport": {
"params": {
"smtp-host": "localhost",
Expand Down Expand Up @@ -1848,7 +1848,8 @@
"callbacks": {
"0": {
"path": [
"import.callback.custom.regex.validator"
"import.callback.custom.regex.validator",
"import_category.callback.valid_category_path"
],
"store_view_code": [
"import.callback.store.view.code.validator"
Expand Down Expand Up @@ -9673,7 +9674,38 @@
}
}
},
"extension-libraries": [],
"extension-libraries": [
"techdivision\/import-app-simple",
"techdivision\/import",
"techdivision\/import-cli",
"techdivision\/import-ee",
"techdivision\/import-attribute",
"techdivision\/import-attribute-set",
"techdivision\/import-category",
"techdivision\/import-category-ee",
"techdivision\/import-customer",
"techdivision\/import-customer-address",
"techdivision\/import-product",
"techdivision\/import-product-ee",
"techdivision\/import-product-msi",
"techdivision\/import-product-tier-price",
"techdivision\/import-product-url-rewrite",
"techdivision\/import-product-bundle",
"techdivision\/import-product-bundle-ee",
"techdivision\/import-product-link",
"techdivision\/import-product-link-ee",
"techdivision\/import-product-media",
"techdivision\/import-product-media-ee",
"techdivision\/import-product-variant",
"techdivision\/import-product-variant-ee",
"techdivision\/import-product-grouped",
"techdivision\/import-product-grouped-ee",
"techdivision\/import-converter",
"techdivision\/import-converter-ee",
"techdivision\/import-converter-product-category",
"techdivision\/import-converter-product-attribute",
"techdivision\/import-converter-customer-attribute"
],
"header-mappings": {
"eav_entity_attribute": {
"entity_type_code": "entity_type_id",
Expand Down
4 changes: 2 additions & 2 deletions etc/configuration/operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"plugins": {
"debug.send": {
"id": "import_cli.plugin.debug.send",
"swift-mailer" : {
"id" : "import.logger.factory.transport.swift.sendmail",
"mailer" : {
"id" : "import.logger.factory.transport.mailer.sendmail",
"params" : {
"to" : "[email protected]",
"from" : "pacemaker@localhost",
Expand Down
11 changes: 5 additions & 6 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use TechDivision\Import\Cli\Utils\DependencyInjectionKeys;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

/**
* The M2IF - Console Tool implementation.
Expand All @@ -30,7 +29,7 @@
* @link https://github.com/techdivision/import-cli-simple
* @link http://www.techdivision.com
*/
class Application extends \Symfony\Component\Console\Application implements ContainerAwareInterface
class Application extends \Symfony\Component\Console\Application
{

/**
Expand All @@ -43,9 +42,9 @@ class Application extends \Symfony\Component\Console\Application implements Cont
/**
* The DI container instance.
*
* @var \Symfony\Component\DependencyInjection\ContainerInterface
* @var ContainerInterface|null
*/
protected $container;
protected ?ContainerInterface $container = null;

/**
* The constructor to initialize the instance.
Expand Down Expand Up @@ -85,7 +84,7 @@ public function __construct(ContainerInterface $container)
*
* @return void
*/
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null): void
{
$this->container = $container;
}
Expand All @@ -95,7 +94,7 @@ public function setContainer(ContainerInterface $container = null)
*
* @return \Symfony\Component\DependencyInjection\ContainerInterface|null The DI container instance
*/
public function getContainer()
public function getContainer(): ?ContainerInterface
{
return $this->container;
}
Expand Down
15 changes: 8 additions & 7 deletions src/Command/AbstractSimpleImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ protected function getContainer()
* @param \Symfony\Component\Console\Input\InputInterface $input An InputInterface instance
* @param \Symfony\Component\Console\Output\OutputInterface $output An OutputInterface instance
*
* @return null|int null or 0 if everything went fine, or an error code
* @return int 0 if everything went fine, or an error code
* @throws \LogicException When this abstract method is not implemented
* @see \Symfony\Component\Console\Command\Command::execute()
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{

// try to load the configuration file
Expand All @@ -110,10 +110,11 @@ protected function createSerializer(): Serializer
$builder = SerializerBuilder::create();
$builder->addDefaultSerializationVisitors();
$namingStrategy = new SerializedNameAnnotationStrategy(new IdenticalPropertyNamingStrategy());

// register the visitor in the builder instance
$visitor = new JsonSerializationVisitorFactory($namingStrategy);
$visitor->setOptions(JSON_PRETTY_PRINT);
// set naming strategy on builder (JMS Serializer v3+)
$builder->setPropertyNamingStrategy($namingStrategy);
// register the visitor factory in the builder instance
$visitor = new JsonSerializationVisitorFactory();
$visitor->setOptions(JSON_PRETTY_PRINT | JSON_PRESERVE_ZERO_FRACTION);
$builder->setSerializationVisitor($format, $visitor);
return $builder->build();
}
Expand All @@ -125,7 +126,7 @@ protected function createSerializer(): Serializer
* @param \Symfony\Component\Console\Input\InputInterface $input An InputInterface instance
* @param \Symfony\Component\Console\Output\OutputInterface $output An OutputInterface instance
*
* @return void
* @return int
*/
abstract protected function executeSimpleCommand(
ConfigurationInterface $configuration,
Expand Down
3 changes: 2 additions & 1 deletion src/Command/ImportClearPidFileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected function configure()
* @param \Symfony\Component\Console\Input\InputInterface $input An InputInterface instance
* @param \Symfony\Component\Console\Output\OutputInterface $output An OutputInterface instance
*
* @return void
* @return int
*/
protected function executeSimpleCommand(
ConfigurationInterface $configuration,
Expand All @@ -75,5 +75,6 @@ protected function executeSimpleCommand(
// write a message to the console
$output->writeln(sprintf('<error>PID file %s not available</error>', $pidFilename));
}
return 0;
}
}
5 changes: 3 additions & 2 deletions src/Command/ImportConvertValueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ protected function configure()
* @param \Symfony\Component\Console\Input\InputInterface $input An InputInterface instance
* @param \Symfony\Component\Console\Output\OutputInterface $output An OutputInterface instance
*
* @return void
* @return int
*/
protected function executeSimpleCommand(
ConfigurationInterface $configuration,
InputInterface $input,
OutputInterface $output
) {
): int {

// initialize the default CSV serializer
$serializer = new ValueCsvSerializer();
Expand Down Expand Up @@ -117,5 +117,6 @@ protected function executeSimpleCommand(

// second serialization that simulates the framework parsing the CSV file
$output->write($serializer->serialize($serialize));
return 0;
}
}
17 changes: 10 additions & 7 deletions src/Command/ImportCreateConfigurationFileCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
namespace TechDivision\Import\Cli\Command;

use JMS\Serializer\SerializerBuilder;
use JMS\Serializer\XmlSerializationVisitor;
use JMS\Serializer\JsonSerializationVisitor;
use JMS\Serializer\Visitor\Factory\JsonSerializationVisitorFactory;
use JMS\Serializer\Visitor\Factory\XmlSerializationVisitorFactory;
use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
use JMS\Serializer\Naming\SerializedNameAnnotationStrategy;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -64,7 +64,7 @@ protected function configure()
* @param \Symfony\Component\Console\Input\InputInterface $input An InputInterface instance
* @param \Symfony\Component\Console\Output\OutputInterface $output An OutputInterface instance
*
* @return void
* @return int
*/
protected function executeSimpleCommand(
ConfigurationInterface $configuration,
Expand All @@ -90,19 +90,21 @@ protected function executeSimpleCommand(

// initialize the naming strategy
$namingStrategy = new SerializedNameAnnotationStrategy(new IdenticalPropertyNamingStrategy());
// set the naming strategy on the builder (JMS Serializer v3+)
$builder->setPropertyNamingStrategy($namingStrategy);

// create the configuration based on the given configuration file suffix
switch ($format) {
// initialize the JSON visitor
case 'json':
// initialize the visitor because we want to set JSON options
$visitor = new JsonSerializationVisitor($namingStrategy);
$visitor->setOptions(JSON_PRETTY_PRINT);
// configure the factory because we want to set JSON options
$visitor = new JsonSerializationVisitorFactory();
$visitor->setOptions(JSON_PRETTY_PRINT | JSON_PRESERVE_ZERO_FRACTION);
break;

// initialize the XML visitor
case 'xml':
$visitor = new XmlSerializationVisitor($namingStrategy);
$visitor = new XmlSerializationVisitorFactory();
break;

// throw an execption in all other cases
Expand All @@ -122,5 +124,6 @@ protected function executeSimpleCommand(
} else {
$output->writeln(sprintf('<error>Can\'t write configuration file %s</error>', $configurationFilename));
}
return 0;
}
}
8 changes: 8 additions & 0 deletions src/Plugins/DebugCreatePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ public function process()
// finally create the array with the available serials to render on the console
$availableSerials = array_slice(array_keys($availableSerials), 0, $this->getInput()->getOption(InputOptionKeysInterface::RENDER_DEBUG_SERIALS));

// if no serials are available, abort gracefully instead of asking an empty \Symfony\Component\Console\Question\ChoiceQuestion
if (empty($availableSerials)) {
$this->getOutput()->writeln(
'<comment>No debug artefacts or import directories found to create a debug dump for. Aborting.</comment>'
);
return;
}

// this is, when the import:debug send command has been invoked
// WITHOUT the --serial=<UUID> parameter or an invalid serial
if (!in_array($serial = $this->getSerial(), $availableSerials, true)) {
Expand Down
Loading
Loading