This commit is contained in:
parent
9c2e2b6ade
commit
8554cf714d
@ -1,6 +1,7 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
load: [docker, composer]
|
||||
steps:
|
||||
- name: install
|
||||
image: composer
|
||||
@ -17,7 +18,9 @@ steps:
|
||||
- chmod +x /usr/local/bin/phpcs
|
||||
- chmod +x /usr/local/bin/phpcbf
|
||||
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||
- phpcs -d memory_limit=512M --extensions=php --standard=PSR2 ./src/
|
||||
|
||||
- phpcbf -w ./src/
|
||||
|
||||
|
||||
- name: test
|
||||
image: php:8.1
|
||||
|
@ -8,13 +8,13 @@
|
||||
<jdbc-url>jdbc:mysql://127.0.0.1:3306</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="DDEV" uuid="460f8880-31b0-4942-b249-e8c664c61f08">
|
||||
<data-source source="LOCAL" name="DDEV" uuid="5149739e-7c31-440b-a2ab-9c77c78be0cd">
|
||||
<driver-ref>mariadb</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<configured-by-url>true</configured-by-url>
|
||||
<remarks>DDEV generated data source</remarks>
|
||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mariadb://127.0.0.1:51773/db?user=db&password=db</jdbc-url>
|
||||
<jdbc-url>jdbc:mariadb://127.0.0.1:55034/db?user=db&password=db</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
|
458
composer.lock
generated
458
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -22,9 +22,6 @@ services:
|
||||
App\EventSubscriber\SlackNotifySubscriber:
|
||||
arguments:
|
||||
$slackWebhookUrl: '%env(SLACK_DSN)%'
|
||||
# App\Helper\Hiltes:
|
||||
# arguments:
|
||||
# $orderRepository: '@App\Repository\OrderRepository'
|
||||
|
||||
# add more service definitions when explicit configuration is needed
|
||||
# please note that last definitions always *replace* previous ones
|
33
migrations/Version20231110153931.php
Normal file
33
migrations/Version20231110153931.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20231110153931 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
// this up() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('ALTER TABLE `order` CHANGE data data JSON NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||
$this->addSql('CREATE UNIQUE INDEX UNIQ_F52993988D9F6D38 ON `order` (order_id)');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql('DROP INDEX UNIQ_F52993988D9F6D38 ON `order`');
|
||||
$this->addSql('ALTER TABLE `order` CHANGE data data JSON NOT NULL COMMENT \'(DC2Type:json)\'');
|
||||
}
|
||||
}
|
@ -2,9 +2,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 400;
|
||||
src: url(./files/open-sans-cyrillic-ext-400-normal.woff2) format('woff2'), url(./files/open-sans-cyrillic-ext-400-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-cyrillic-ext-400-normal.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
@ -12,9 +12,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 400;
|
||||
src: url(./files/open-sans-cyrillic-400-normal.woff2) format('woff2'), url(./files/open-sans-cyrillic-400-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-cyrillic-400-normal.woff2) format('woff2');
|
||||
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
||||
}
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 400;
|
||||
src: url(./files/open-sans-greek-ext-400-normal.woff2) format('woff2'), url(./files/open-sans-greek-ext-400-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-greek-ext-400-normal.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
@ -32,9 +32,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 400;
|
||||
src: url(./files/open-sans-greek-400-normal.woff2) format('woff2'), url(./files/open-sans-greek-400-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-greek-400-normal.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
@ -42,9 +42,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 400;
|
||||
src: url(./files/open-sans-hebrew-400-normal.woff2) format('woff2'), url(./files/open-sans-hebrew-400-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-hebrew-400-normal.woff2) format('woff2');
|
||||
unicode-range: U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
|
||||
}
|
||||
|
||||
@ -52,9 +52,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 400;
|
||||
src: url(./files/open-sans-vietnamese-400-normal.woff2) format('woff2'), url(./files/open-sans-vietnamese-400-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-vietnamese-400-normal.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
|
||||
}
|
||||
|
||||
@ -62,18 +62,18 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 400;
|
||||
src: url(./files/open-sans-latin-ext-400-normal.woff2) format('woff2'), url(./files/open-sans-latin-ext-400-normal.woff) format('woff');
|
||||
unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
||||
src: url(./files/open-sans-latin-ext-400-normal.woff2) format('woff2');
|
||||
unicode-range: U+0100-02AF,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* open-sans-latin-400-normal */
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 400;
|
||||
src: url(./files/open-sans-latin-400-normal.woff2) format('woff2'), url(./files/open-sans-latin-400-normal.woff) format('woff');
|
||||
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
||||
src: url(./files/open-sans-latin-400-normal.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
||||
}
|
@ -2,9 +2,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 700;
|
||||
src: url(./files/open-sans-cyrillic-ext-700-normal.woff2) format('woff2'), url(./files/open-sans-cyrillic-ext-700-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-cyrillic-ext-700-normal.woff2) format('woff2');
|
||||
unicode-range: U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
|
||||
}
|
||||
|
||||
@ -12,9 +12,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 700;
|
||||
src: url(./files/open-sans-cyrillic-700-normal.woff2) format('woff2'), url(./files/open-sans-cyrillic-700-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-cyrillic-700-normal.woff2) format('woff2');
|
||||
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
||||
}
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 700;
|
||||
src: url(./files/open-sans-greek-ext-700-normal.woff2) format('woff2'), url(./files/open-sans-greek-ext-700-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-greek-ext-700-normal.woff2) format('woff2');
|
||||
unicode-range: U+1F00-1FFF;
|
||||
}
|
||||
|
||||
@ -32,9 +32,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 700;
|
||||
src: url(./files/open-sans-greek-700-normal.woff2) format('woff2'), url(./files/open-sans-greek-700-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-greek-700-normal.woff2) format('woff2');
|
||||
unicode-range: U+0370-03FF;
|
||||
}
|
||||
|
||||
@ -42,9 +42,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 700;
|
||||
src: url(./files/open-sans-hebrew-700-normal.woff2) format('woff2'), url(./files/open-sans-hebrew-700-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-hebrew-700-normal.woff2) format('woff2');
|
||||
unicode-range: U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
|
||||
}
|
||||
|
||||
@ -52,9 +52,9 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 700;
|
||||
src: url(./files/open-sans-vietnamese-700-normal.woff2) format('woff2'), url(./files/open-sans-vietnamese-700-normal.woff) format('woff');
|
||||
src: url(./files/open-sans-vietnamese-700-normal.woff2) format('woff2');
|
||||
unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
|
||||
}
|
||||
|
||||
@ -62,18 +62,18 @@
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 700;
|
||||
src: url(./files/open-sans-latin-ext-700-normal.woff2) format('woff2'), url(./files/open-sans-latin-ext-700-normal.woff) format('woff');
|
||||
unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
||||
src: url(./files/open-sans-latin-ext-700-normal.woff2) format('woff2');
|
||||
unicode-range: U+0100-02AF,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20CF,U+2113,U+2C60-2C7F,U+A720-A7FF;
|
||||
}
|
||||
|
||||
/* open-sans-latin-700-normal */
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
font-display: var(--fontsource-display, swap);
|
||||
font-weight: 700;
|
||||
src: url(./files/open-sans-latin-700-normal.woff2) format('woff2'), url(./files/open-sans-latin-700-normal.woff) format('woff');
|
||||
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
||||
src: url(./files/open-sans-latin-700-normal.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
namespace App\Command;
|
||||
|
||||
use App\Entity\Order;
|
||||
use App\Helper\Hiltes;
|
||||
use App\Repository\OrderRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
@ -12,7 +13,6 @@ use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use App\Helper\Hiltes;
|
||||
|
||||
#[AsCommand(
|
||||
name: 'hiltes:export',
|
||||
@ -33,8 +33,7 @@ class HiltesExportCommand extends Command
|
||||
{
|
||||
$this
|
||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
|
||||
;
|
||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,14 +10,11 @@ use App\Repository\WarehouseRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
#[AsCommand(
|
||||
name: 'hiltes:import',
|
||||
description: 'Importiert die Bestandsdaten von Hiltes',
|
||||
@ -28,6 +25,7 @@ class HiltesImportCommand extends Command
|
||||
private $warehouseRepository;
|
||||
private $productRepository;
|
||||
private $logger;
|
||||
|
||||
public function __construct(
|
||||
ProductRepository $productRepository,
|
||||
StockRepository $stockRepository,
|
||||
@ -41,6 +39,7 @@ class HiltesImportCommand extends Command
|
||||
$this->logger = $logger;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->addOption('delta', 'd', InputOption::VALUE_NONE, 'Delta Import');
|
||||
|
@ -26,6 +26,7 @@ class JtlExportCommand extends Command
|
||||
private $warehouseRepository;
|
||||
private $productRepository;
|
||||
private $logger;
|
||||
|
||||
public function __construct(
|
||||
ProductRepository $productRepository,
|
||||
StockRepository $stockRepository,
|
||||
@ -44,8 +45,7 @@ class JtlExportCommand extends Command
|
||||
{
|
||||
$this
|
||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
|
||||
;
|
||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
@ -74,7 +74,6 @@ class JtlExportCommand extends Command
|
||||
$jtl->createExportFile($data);
|
||||
|
||||
|
||||
|
||||
$io->success('Ende JTL Export');
|
||||
|
||||
return Command::SUCCESS;
|
||||
|
@ -11,7 +11,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Notifier\Chatter;
|
||||
use Symfony\Component\Notifier\Message\ChatMessage;
|
||||
use Symfony\Component\Notifier\ChatterInterface;
|
||||
use Symfony\Component\Notifier\Transport;
|
||||
|
||||
#[AsCommand(
|
||||
@ -24,8 +23,7 @@ class JtlImportCommand extends Command
|
||||
{
|
||||
$this
|
||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
|
||||
;
|
||||
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
@ -50,7 +48,6 @@ class JtlImportCommand extends Command
|
||||
->transport('slack');
|
||||
|
||||
|
||||
|
||||
$sentMessage = $chatter->send($message);
|
||||
|
||||
$io->success('You have a new command! Now make it your own! Pass --help to see your options.');
|
||||
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Orders;
|
||||
use App\Form\OrdersType;
|
||||
use App\Repository\OrdersRepository;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
#[Route('/orders')]
|
||||
class OrdersController extends AbstractController
|
||||
{
|
||||
private $logger;
|
||||
private $ordersRepository;
|
||||
|
||||
public function index(
|
||||
OrdersRepository $ordersRepository,
|
||||
LoggerInterface $logger
|
||||
)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->ordersRepository = $ordersRepository;
|
||||
}
|
||||
|
||||
|
||||
public function getOrders(): Orders
|
||||
{
|
||||
$this->logger->info('I just got the logger');
|
||||
|
||||
$orders = $this->ordersRepository->findAll();
|
||||
|
||||
|
||||
return $orders->getData();
|
||||
}
|
||||
|
||||
}
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\OrderRepository;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
@ -14,6 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* 2 = Bestellung in Bearbeitung
|
||||
* 3 = Bestellung versendet
|
||||
*/
|
||||
|
||||
#[ORM\Entity(repositoryClass: OrderRepository::class)]
|
||||
#[ORM\Table(name: '`order`')]
|
||||
#[ApiResource]
|
||||
@ -22,9 +25,12 @@ class Order
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
#[ApiProperty(identifier: false)]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
#[ORM\Column(length: 255,unique: true)]
|
||||
#[ApiProperty(identifier: true)]
|
||||
|
||||
private ?string $orderId = null;
|
||||
|
||||
#[ORM\Column]
|
||||
@ -34,7 +40,7 @@ class Order
|
||||
private array $data = [];
|
||||
|
||||
#[ORM\Column(name: 'change_date', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
private ?\DateTimeInterface $changeDate = null;
|
||||
private ?DateTimeInterface $changeDate = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
@ -77,12 +83,12 @@ class Order
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChangeDate(): ?\DateTimeInterface
|
||||
public function getChangeDate(): ?DateTimeInterface
|
||||
{
|
||||
return $this->changeDate;
|
||||
}
|
||||
|
||||
public function setChangeDate(\DateTimeInterface $changeDate): static
|
||||
public function setChangeDate(DateTimeInterface $changeDate): static
|
||||
{
|
||||
$this->changeDate = $changeDate;
|
||||
|
||||
|
@ -4,7 +4,7 @@ namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use App\Repository\ProductRepository;
|
||||
use App\Repository\StockRepository;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
@ -21,7 +21,7 @@ class Product
|
||||
private ?string $gtin = null;
|
||||
|
||||
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
private ?\DateTimeInterface $updateTime = null;
|
||||
private ?DateTimeInterface $updateTime = null;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
@ -41,12 +41,12 @@ class Product
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdateTime(): ?\DateTimeInterface
|
||||
public function getUpdateTime(): ?DateTimeInterface
|
||||
{
|
||||
return $this->updateTime;
|
||||
}
|
||||
|
||||
public function setUpdateTime(\DateTimeInterface $updateTime): self
|
||||
public function setUpdateTime(DateTimeInterface $updateTime): self
|
||||
{
|
||||
$this->updateTime = $updateTime;
|
||||
|
||||
|
@ -3,11 +3,12 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\StockRepository;
|
||||
#use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
#[ORM\Entity(repositoryClass: StockRepository::class)]
|
||||
#[ORM\UniqueEntity(['warehouse_id', 'product_id'])]
|
||||
#[ORM\UniqueConstraint(
|
||||
@ -30,14 +31,14 @@ class Stock
|
||||
private ?Warehouse $warehouse = null;
|
||||
|
||||
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
||||
private ?\DateTimeInterface $update_time = null;
|
||||
|
||||
private ?DateTimeInterface $update_time = null;
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): ?self
|
||||
{
|
||||
$this->id = $id;
|
||||
@ -55,6 +56,7 @@ class Stock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getProductId(): ?int
|
||||
{
|
||||
return $this->product_id;
|
||||
@ -66,6 +68,7 @@ class Stock
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWarehouseId(): ?int
|
||||
{
|
||||
return $this->warehouse_id;
|
||||
@ -112,12 +115,12 @@ class Stock
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdateTime(): ?\DateTimeInterface
|
||||
public function getUpdateTime(): ?DateTimeInterface
|
||||
{
|
||||
return $this->update_time;
|
||||
}
|
||||
|
||||
public function setUpdateTime(?\DateTimeInterface $update_time): self
|
||||
public function setUpdateTime(?DateTimeInterface $update_time): self
|
||||
{
|
||||
$this->update_time = $update_time;
|
||||
|
||||
|
@ -33,6 +33,7 @@ class Warehouse
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setId(int $id): self
|
||||
{
|
||||
$this->id = $id;
|
||||
|
@ -3,16 +3,15 @@
|
||||
namespace App\EventSubscriber;
|
||||
|
||||
use ApiPlatform\Symfony\EventListener\EventPriorities;
|
||||
use App\Entity\Order;
|
||||
use App\Helper\Hiltes;
|
||||
use App\Helper\Slack;
|
||||
use App\Entity\Order;
|
||||
use Maknz\Slack\Client;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Event\ViewEvent;
|
||||
use Symfony\Component\HttpKernel\KernelEvents;
|
||||
use Symfony\Component\Notifier\ChatterInterface;
|
||||
|
||||
|
||||
class SlackNotifySubscriber implements EventSubscriberInterface
|
||||
|
@ -3,6 +3,8 @@
|
||||
namespace App\Helper;
|
||||
|
||||
|
||||
use Exception;
|
||||
|
||||
class Ftp
|
||||
{
|
||||
private string $host;
|
||||
@ -23,6 +25,55 @@ class Ftp
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads a local file to a remote FTP server.
|
||||
*
|
||||
* @param string $localFile The local file path to upload.
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception If the upload fails or encounters an error.
|
||||
*
|
||||
*/
|
||||
public function uploadFile(string $localFile): void
|
||||
{
|
||||
$ftp = ftp_ssl_connect($this->getHost(), $this->getPort());
|
||||
|
||||
if (!$ftp) {
|
||||
throw new Exception("Failed to connect to FTP server");
|
||||
}
|
||||
|
||||
$ftp_login = ftp_login($ftp, $this->getUser(), $this->getPassword());
|
||||
|
||||
if (!$ftp_login) {
|
||||
throw new Exception("FTP login failed");
|
||||
}
|
||||
|
||||
ftp_pasv($ftp, true);
|
||||
|
||||
$remoteFile = 'stock_hiltes.csv';
|
||||
|
||||
if (!file_exists($localFile)) {
|
||||
throw new Exception("Local file does not exist: $localFile");
|
||||
}
|
||||
|
||||
$r = ftp_nb_put($ftp, $this->getRemoteDir() . $remoteFile, $localFile, FTP_BINARY);
|
||||
|
||||
while ($r == FTP_MOREDATA) {
|
||||
// Continue uploading...
|
||||
$r = ftp_nb_continue($ftp);
|
||||
}
|
||||
|
||||
if ($r != FTP_FINISHED) {
|
||||
throw new Exception("File upload failed");
|
||||
}
|
||||
|
||||
ftp_close($ftp);
|
||||
|
||||
if (!unlink($localFile)) {
|
||||
throw new Exception("Failed to delete local file: $localFile");
|
||||
}
|
||||
}
|
||||
|
||||
public function getHost(): string
|
||||
{
|
||||
return $this->host;
|
||||
@ -32,6 +83,7 @@ class Ftp
|
||||
{
|
||||
$this->host = $host;
|
||||
}
|
||||
|
||||
public function getPort(): int
|
||||
{
|
||||
return $this->port;
|
||||
@ -71,53 +123,4 @@ class Ftp
|
||||
{
|
||||
$this->remoteDir = $remoteDir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads a local file to a remote FTP server.
|
||||
*
|
||||
* @param string $localFile The local file path to upload.
|
||||
*
|
||||
* @throws \Exception If the upload fails or encounters an error.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function uploadFile(string $localFile): void
|
||||
{
|
||||
$ftp = ftp_ssl_connect($this->getHost(), $this->getPort());
|
||||
|
||||
if (!$ftp) {
|
||||
throw new \Exception("Failed to connect to FTP server");
|
||||
}
|
||||
|
||||
$ftp_login = ftp_login($ftp, $this->getUser(), $this->getPassword());
|
||||
|
||||
if (!$ftp_login) {
|
||||
throw new \Exception("FTP login failed");
|
||||
}
|
||||
|
||||
ftp_pasv($ftp, true);
|
||||
|
||||
$remoteFile = 'stock_hiltes.csv';
|
||||
|
||||
if (!file_exists($localFile)) {
|
||||
throw new \Exception("Local file does not exist: $localFile");
|
||||
}
|
||||
|
||||
$r = ftp_nb_put($ftp, $this->getRemoteDir() . $remoteFile, $localFile, FTP_BINARY);
|
||||
|
||||
while ($r == FTP_MOREDATA) {
|
||||
// Continue uploading...
|
||||
$r = ftp_nb_continue($ftp);
|
||||
}
|
||||
|
||||
if ($r != FTP_FINISHED) {
|
||||
throw new \Exception("File upload failed");
|
||||
}
|
||||
|
||||
ftp_close($ftp);
|
||||
|
||||
if (!unlink($localFile)) {
|
||||
throw new \Exception("Failed to delete local file: $localFile");
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ namespace App\Helper;
|
||||
|
||||
use App\Entity\Order;
|
||||
use App\Repository\OrderRepository;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
@ -9,21 +9,24 @@ use App\Entity\Warehouse;
|
||||
use App\Repository\ProductRepository;
|
||||
use App\Repository\StockRepository;
|
||||
use App\Repository\WarehouseRepository;
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use SplFileObject;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
|
||||
class HiltesImport
|
||||
{
|
||||
protected $currentDirPath;
|
||||
protected $cachedWarehouseIds;
|
||||
protected $arrData = array();
|
||||
private $productRepository;
|
||||
private $stockRepository;
|
||||
private $warehouseRepository;
|
||||
private $logger;
|
||||
protected $currentDirPath;
|
||||
protected $cachedWarehouseIds;
|
||||
private $cachedProdIds;
|
||||
private $cachedStockIds;
|
||||
protected $arrData = array();
|
||||
|
||||
public function __construct(ProductRepository $productRepository, WarehouseRepository $warehouseRepository, StockRepository $stockRepository, LoggerInterface $logger)
|
||||
{
|
||||
@ -52,7 +55,7 @@ class HiltesImport
|
||||
if (is_file($file['realPath'])) {
|
||||
$count += $this->loadFiles($file['realPath']);
|
||||
} else {
|
||||
throw new \RuntimeException("Error: File not found - " . $file['realPath']);
|
||||
throw new RuntimeException("Error: File not found - " . $file['realPath']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +64,7 @@ class HiltesImport
|
||||
$this->logger->info('No Files');
|
||||
}
|
||||
} else {
|
||||
throw new \RuntimeException('Error in getFiles or no file WS.FERTIG');
|
||||
throw new RuntimeException('Error in getFiles or no file WS.FERTIG');
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,6 +103,7 @@ class HiltesImport
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function getStocks()
|
||||
{
|
||||
$stocks = $this->stockRepository->findAll();
|
||||
@ -112,7 +116,7 @@ class HiltesImport
|
||||
protected function loadFiles($srcFile)
|
||||
{
|
||||
try {
|
||||
$file = new \SplFileObject($srcFile);
|
||||
$file = new SplFileObject($srcFile);
|
||||
$this->logger->info('Starte Import von ' . $file->getRealPath());
|
||||
$count = 0;
|
||||
|
||||
@ -120,7 +124,7 @@ class HiltesImport
|
||||
$this->processLine($file->fgets());
|
||||
$count++;
|
||||
}
|
||||
}catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
|
||||
@ -195,7 +199,8 @@ class HiltesImport
|
||||
* @param string $gtin
|
||||
* @return false|int|mixed|null
|
||||
*/
|
||||
private function checkProduct(string $gtin){
|
||||
private function checkProduct(string $gtin)
|
||||
{
|
||||
#*** WEnn keine geCached Id Vorhanden
|
||||
if (empty($this->cachedProdIds[$gtin])) {
|
||||
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);
|
||||
|
@ -5,8 +5,10 @@ namespace App\Helper;
|
||||
use App\Repository\ProductRepository;
|
||||
use App\Repository\StockRepository;
|
||||
use App\Repository\WarehouseRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use ArrayIterator;
|
||||
use Exception;
|
||||
use League\Csv\Writer;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
||||
class Jtl
|
||||
@ -87,7 +89,7 @@ class Jtl
|
||||
{
|
||||
try {
|
||||
$writer = Writer::createFromPath(getcwd() . '/jtl/cds-export.csv', 'w+');
|
||||
$bytes = $writer->insertAll(new \ArrayIterator($data));
|
||||
$bytes = $writer->insertAll(new ArrayIterator($data));
|
||||
|
||||
if ($bytes) {
|
||||
$this->logger->info('Exported ' . $bytes . ' bytes');
|
||||
@ -96,12 +98,10 @@ class Jtl
|
||||
$FTP->uploadFile(getcwd() . '/jtl/cds-export.csv');
|
||||
}
|
||||
|
||||
}catch (\Exception $e){
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Helper;
|
||||
|
||||
use Symfony\Component\Notifier\Chatter;
|
||||
use Symfony\Component\Notifier\ChatterInterface;
|
||||
use Symfony\Component\Notifier\Exception\TransportExceptionInterface;
|
||||
use Symfony\Component\Notifier\Message\ChatMessage;
|
||||
@ -16,7 +15,7 @@ class Slack
|
||||
$this->chatter = $chatter;
|
||||
}
|
||||
|
||||
public function sendMessage(String $message): void
|
||||
public function sendMessage(string $message): void
|
||||
{
|
||||
$message = (new ChatMessage($message))
|
||||
->transport('slack');
|
||||
|
@ -5,6 +5,7 @@ namespace App\Repository;
|
||||
use App\Entity\Order;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Order>
|
||||
@ -39,6 +40,22 @@ class OrderRepository extends ServiceEntityRepository
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update(Order $entity, bool $flush = false): void
|
||||
{
|
||||
$order = $this->getEntityManager()->find(Order::class, $entity->getId());
|
||||
|
||||
if (!$order) {
|
||||
throw $this->createNotFoundException('Order not found: ' . $entity->getId());
|
||||
}
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return Order[] Returns an array of Order objects
|
||||
// */
|
||||
@ -63,4 +80,11 @@ class OrderRepository extends ServiceEntityRepository
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
private function createNotFoundException(string $string)
|
||||
{
|
||||
throw new Exception($string);
|
||||
}
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Orders;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Orders>
|
||||
*
|
||||
* @method Orders|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method Orders|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method Orders[] findAll()
|
||||
* @method Orders[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class OrdersRepository extends ServiceEntityRepository
|
||||
{
|
||||
private ValidatorInterface $validator;
|
||||
|
||||
public function __construct(ManagerRegistry $registry, ValidatorInterface $validator)
|
||||
{
|
||||
parent::__construct($registry, Orders::class);
|
||||
$this->validator = $validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Orders $entity
|
||||
* @param bool $flush
|
||||
* @return void
|
||||
*/
|
||||
public function add(Orders $entity, bool $flush = false): void
|
||||
{
|
||||
|
||||
$errors = $this->validator->validate($entity);
|
||||
if (count($errors) > 0) {
|
||||
var_dump($errors);
|
||||
}
|
||||
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Orders $entity
|
||||
* @param bool $flush
|
||||
* @return void
|
||||
*/
|
||||
public function update(Orders $entity, bool $flush = false): void
|
||||
{
|
||||
$order = $this->getEntityManager()->find(Orders::class, $entity->getId());
|
||||
|
||||
if (!$order) {
|
||||
throw $this->createNotFoundException('Order not found: '.$entity->getId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Orders $entity
|
||||
* @param bool $flush
|
||||
* @return void
|
||||
*/
|
||||
public function remove(Orders $entity, bool $flush = false): void
|
||||
{
|
||||
$this->getEntityManager()->remove($entity);
|
||||
|
||||
if ($flush) {
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Orders[] Returns an array of Orders objects
|
||||
*/
|
||||
public function findByStatus($status): array
|
||||
{
|
||||
return $this->createQueryBuilder('o')
|
||||
->andWhere('o.status = :val')
|
||||
->setParameter('val', $status)
|
||||
->orderBy('o.id', 'ASC')
|
||||
->setMaxResults(100)
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $orderId
|
||||
* @return Orders|null
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
*/
|
||||
public function findOneByOrderId($orderId): ?Orders
|
||||
{
|
||||
return $this->createQueryBuilder('o')
|
||||
->andWhere('o.order_id = :val')
|
||||
->setParameter('val', $orderId)
|
||||
->getQuery()
|
||||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Product;
|
||||
use DateTime;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
@ -24,7 +25,7 @@ class ProductRepository extends ServiceEntityRepository
|
||||
public function save(Product $entity, bool $flush = false): ?int
|
||||
{
|
||||
|
||||
$entity->setUpdateTime(new \DateTime());
|
||||
$entity->setUpdateTime(new DateTime());
|
||||
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\Stock;
|
||||
use DateTime;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
@ -23,7 +24,7 @@ class StockRepository extends ServiceEntityRepository
|
||||
|
||||
public function save(Stock $entity, bool $flush = false): void
|
||||
{
|
||||
$entity->setUpdateTime(new \DateTime());
|
||||
$entity->setUpdateTime(new DateTime());
|
||||
|
||||
$this->getEntityManager()->persist($entity);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user