Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oro 6.0.x compatibility added #6

Open
wants to merge 1 commit into
base: 5.1
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion Async/ImportProductProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(
*/
public static function getSubscribedTopics()
{
return [Topics::IMPORT_PRODUCTS];
return [\Creativestyle\Bundle\AkeneoBundle\Async\Topic\ImportProductsTopic::getName()];
}

/**
Expand Down
20 changes: 20 additions & 0 deletions Async/Topic/ImportProductsTopic.php

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add service definition with mq_topic tag

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Creativestyle\Bundle\AkeneoBundle\Async\Topic;

class ImportProductsTopic extends \Oro\Component\MessageQueue\Topic\AbstractTopic
{
public static function getName(): string
{
return 'oro.integration.akeneo.product';
}
public static function getDescription(): string
{
// TODO: Implement getDescription() method.
return '';
}
public function configureMessageBody(\Symfony\Component\OptionsResolver\OptionsResolver $resolver): void
{
// TODO: Implement configureMessageBody() method.
}
}
43 changes: 0 additions & 43 deletions Async/Topics.php

This file was deleted.

9 changes: 3 additions & 6 deletions Command/CleanupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
/**
* Clears old records from oro_integration_fields_changes table before repack.
*/
#[\Symfony\Component\Console\Attribute\AsCommand('oro:cron:akeneo:cleanup', 'Clears old records from oro_integration_fields_changes table.')]
class CleanupCommand extends Command implements
CronCommandScheduleDefinitionInterface,
CronCommandActivationInterface
{
/** @var string */
protected static $defaultName = 'oro:cron:akeneo:cleanup';

/** @var DoctrineHelper */
private $doctrineHelper;

Expand All @@ -44,7 +42,6 @@ public function getDefaultDefinition()
public function configure()
{
$this
->setDescription('Clears old records from oro_integration_fields_changes table.')
->setHelp(
<<<'HELP'
The <info>%command.name%</info> command clears fields changes for complete job records
Expand All @@ -55,7 +52,7 @@ public function configure()
);
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln(sprintf(
'<comment>Number of fields changes that has been deleted:</comment> %d',
Expand All @@ -64,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

$output->writeln('<info>Fields changes cleanup complete</info>');

return 0;
return \Symfony\Component\Console\Command\Command::SUCCESS;
}

private function deleteRecords(): int
Expand Down
17 changes: 5 additions & 12 deletions Controller/ValidateConnectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
use Oro\Bundle\CurrencyBundle\Provider\CurrencyProviderInterface;
use Oro\Bundle\IntegrationBundle\Entity\Channel;
use Oro\Bundle\IntegrationBundle\Form\Type\ChannelType;
use Oro\Bundle\SecurityBundle\Annotation\Acl;
use Oro\Bundle\SecurityBundle\Attribute\Acl;
use Psr\Http\Client\ClientExceptionInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Contracts\Translation\TranslatorInterface;

class ValidateConnectionController extends AbstractController
Expand Down Expand Up @@ -42,18 +42,11 @@ public function __construct(
}

/**
* @Route(path="/validate-akeneo-connection/{channelId}/", name="oro_akeneo_validate_connection", methods={"POST"})
* @ParamConverter("channel", class="OroIntegrationBundle:Channel", options={"id"="channelId"})
*
* @Acl(
* id="oro_integration_channel",
* type="entity",
* class="OroIntegrationBundle:Channel",
* permission="VIEW"
* )
*
* @throws \InvalidArgumentException
*/
#[\Symfony\Component\Routing\Attribute\Route(path: '/validate-akeneo-connection/{channelId}/', name: 'oro_akeneo_validate_connection', methods: ['POST'])]
#[ParamConverter('channel', class: 'OroIntegrationBundle:Channel', options: ['id' => 'channelId'])]
#[Acl(id: 'oro_integration_channel', type: 'entity', class: 'OroIntegrationBundle:Channel', permission: 'VIEW')]
public function validateConnectionAction(Request $request, Channel $channel = null): JsonResponse
{
if (!$channel) {
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
{
return new TreeBuilder('oro_akeneo');
}
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/OroAkeneoExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function load(array $configs, ContainerBuilder $container)
/**
* {@inheritdoc}
*/
public function getAlias()
public function getAlias(): string
{
return self::ALIAS;
}
Expand Down
27 changes: 10 additions & 17 deletions Entity/AkeneoLocale.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,30 @@

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Table(name="oro_akeneo_locale")
*
* @ORM\Entity(repositoryClass="Creativestyle\Bundle\AkeneoBundle\Entity\Repository\AkeneoLocaleRepository")
*/

#[ORM\Entity(repositoryClass: \Creativestyle\Bundle\AkeneoBundle\Entity\Repository\AkeneoLocaleRepository::class)]
#[ORM\Table(name: 'oro_akeneo_locale')]
class AkeneoLocale
{
/**
* @var string
*
* @ORM\Column(name="locale", type="string", length=10, nullable=true)
*/
#[ORM\Column(name: 'locale', type: 'string', length: 10, nullable: true)]
protected $locale;
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
#[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
/**
* @var string
*
* @ORM\Column(name="code", type="string", length=200)
*/
#[ORM\Column(name: 'code', type: 'string', length: 200)]
private $code;
/**
* @ORM\ManyToOne(targetEntity="Creativestyle\Bundle\AkeneoBundle\Entity\AkeneoSettings", inversedBy="akeneoLocales")
* @ORM\JoinColumn(referencedColumnName="id")
*/
#[ORM\ManyToOne(targetEntity: \Creativestyle\Bundle\AkeneoBundle\Entity\AkeneoSettings::class, inversedBy: 'akeneoLocales')]
#[ORM\JoinColumn(referencedColumnName: 'id')]
private $akeneoSettings;

/**
Expand Down
Loading