This commit is contained in:
parent
9c2e2b6ade
commit
8554cf714d
@ -1,6 +1,7 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
|
load: [docker, composer]
|
||||||
steps:
|
steps:
|
||||||
- name: install
|
- name: install
|
||||||
image: composer
|
image: composer
|
||||||
@ -17,7 +18,9 @@ steps:
|
|||||||
- chmod +x /usr/local/bin/phpcs
|
- chmod +x /usr/local/bin/phpcs
|
||||||
- chmod +x /usr/local/bin/phpcbf
|
- chmod +x /usr/local/bin/phpcbf
|
||||||
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
- 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
|
- name: test
|
||||||
image: php:8.1
|
image: php:8.1
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
<jdbc-url>jdbc:mysql://127.0.0.1:3306</jdbc-url>
|
<jdbc-url>jdbc:mysql://127.0.0.1:3306</jdbc-url>
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</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>
|
<driver-ref>mariadb</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<configured-by-url>true</configured-by-url>
|
<configured-by-url>true</configured-by-url>
|
||||||
<remarks>DDEV generated data source</remarks>
|
<remarks>DDEV generated data source</remarks>
|
||||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
<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>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</data-source>
|
||||||
</component>
|
</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:
|
App\EventSubscriber\SlackNotifySubscriber:
|
||||||
arguments:
|
arguments:
|
||||||
$slackWebhookUrl: '%env(SLACK_DSN)%'
|
$slackWebhookUrl: '%env(SLACK_DSN)%'
|
||||||
# App\Helper\Hiltes:
|
|
||||||
# arguments:
|
|
||||||
# $orderRepository: '@App\Repository\OrderRepository'
|
|
||||||
|
|
||||||
# add more service definitions when explicit configuration is needed
|
# add more service definitions when explicit configuration is needed
|
||||||
# please note that last definitions always *replace* previous ones
|
# 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-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
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;
|
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-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
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;
|
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,9 +22,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
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;
|
unicode-range: U+1F00-1FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,9 +32,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
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;
|
unicode-range: U+0370-03FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
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;
|
unicode-range: U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,9 +52,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
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;
|
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-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
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');
|
src: url(./files/open-sans-latin-ext-400-normal.woff2) format('woff2');
|
||||||
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;
|
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 */
|
/* open-sans-latin-400-normal */
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
src: url(./files/open-sans-latin-400-normal.woff2) format('woff2'), url(./files/open-sans-latin-400-normal.woff) format('woff');
|
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+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;
|
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-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
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;
|
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-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
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;
|
unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,9 +22,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
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;
|
unicode-range: U+1F00-1FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,9 +32,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
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;
|
unicode-range: U+0370-03FF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
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;
|
unicode-range: U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,9 +52,9 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
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;
|
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-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
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');
|
src: url(./files/open-sans-latin-ext-700-normal.woff2) format('woff2');
|
||||||
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;
|
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 */
|
/* open-sans-latin-700-normal */
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Open Sans';
|
font-family: 'Open Sans';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: var(--fontsource-display, swap);
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
src: url(./files/open-sans-latin-700-normal.woff2) format('woff2'), url(./files/open-sans-latin-700-normal.woff) format('woff');
|
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+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;
|
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;
|
namespace App\Command;
|
||||||
|
|
||||||
use App\Entity\Order;
|
use App\Entity\Order;
|
||||||
|
use App\Helper\Hiltes;
|
||||||
use App\Repository\OrderRepository;
|
use App\Repository\OrderRepository;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
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\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use App\Helper\Hiltes;
|
|
||||||
|
|
||||||
#[AsCommand(
|
#[AsCommand(
|
||||||
name: 'hiltes:export',
|
name: 'hiltes:export',
|
||||||
@ -33,8 +33,7 @@ class HiltesExportCommand extends Command
|
|||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
->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 Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
use Symfony\Component\Finder\Finder;
|
|
||||||
|
|
||||||
#[AsCommand(
|
#[AsCommand(
|
||||||
name: 'hiltes:import',
|
name: 'hiltes:import',
|
||||||
description: 'Importiert die Bestandsdaten von Hiltes',
|
description: 'Importiert die Bestandsdaten von Hiltes',
|
||||||
@ -28,6 +25,7 @@ class HiltesImportCommand extends Command
|
|||||||
private $warehouseRepository;
|
private $warehouseRepository;
|
||||||
private $productRepository;
|
private $productRepository;
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ProductRepository $productRepository,
|
ProductRepository $productRepository,
|
||||||
StockRepository $stockRepository,
|
StockRepository $stockRepository,
|
||||||
@ -41,6 +39,7 @@ class HiltesImportCommand extends Command
|
|||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function configure(): void
|
protected function configure(): void
|
||||||
{
|
{
|
||||||
$this->addOption('delta', 'd', InputOption::VALUE_NONE, 'Delta Import');
|
$this->addOption('delta', 'd', InputOption::VALUE_NONE, 'Delta Import');
|
||||||
|
@ -26,6 +26,7 @@ class JtlExportCommand extends Command
|
|||||||
private $warehouseRepository;
|
private $warehouseRepository;
|
||||||
private $productRepository;
|
private $productRepository;
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ProductRepository $productRepository,
|
ProductRepository $productRepository,
|
||||||
StockRepository $stockRepository,
|
StockRepository $stockRepository,
|
||||||
@ -44,8 +45,7 @@ class JtlExportCommand extends Command
|
|||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
->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
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
@ -74,7 +74,6 @@ class JtlExportCommand extends Command
|
|||||||
$jtl->createExportFile($data);
|
$jtl->createExportFile($data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$io->success('Ende JTL Export');
|
$io->success('Ende JTL Export');
|
||||||
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
|
@ -11,7 +11,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\Notifier\Chatter;
|
use Symfony\Component\Notifier\Chatter;
|
||||||
use Symfony\Component\Notifier\Message\ChatMessage;
|
use Symfony\Component\Notifier\Message\ChatMessage;
|
||||||
use Symfony\Component\Notifier\ChatterInterface;
|
|
||||||
use Symfony\Component\Notifier\Transport;
|
use Symfony\Component\Notifier\Transport;
|
||||||
|
|
||||||
#[AsCommand(
|
#[AsCommand(
|
||||||
@ -24,8 +23,7 @@ class JtlImportCommand extends Command
|
|||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
|
->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
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
@ -50,7 +48,6 @@ class JtlImportCommand extends Command
|
|||||||
->transport('slack');
|
->transport('slack');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sentMessage = $chatter->send($message);
|
$sentMessage = $chatter->send($message);
|
||||||
|
|
||||||
$io->success('You have a new command! Now make it your own! Pass --help to see your options.');
|
$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;
|
namespace App\Entity;
|
||||||
|
|
||||||
|
use ApiPlatform\Metadata\ApiProperty;
|
||||||
use ApiPlatform\Metadata\ApiResource;
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
use App\Repository\OrderRepository;
|
use App\Repository\OrderRepository;
|
||||||
|
use DateTimeInterface;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
@ -14,6 +16,7 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
* 2 = Bestellung in Bearbeitung
|
* 2 = Bestellung in Bearbeitung
|
||||||
* 3 = Bestellung versendet
|
* 3 = Bestellung versendet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: OrderRepository::class)]
|
#[ORM\Entity(repositoryClass: OrderRepository::class)]
|
||||||
#[ORM\Table(name: '`order`')]
|
#[ORM\Table(name: '`order`')]
|
||||||
#[ApiResource]
|
#[ApiResource]
|
||||||
@ -22,9 +25,12 @@ class Order
|
|||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\GeneratedValue]
|
#[ORM\GeneratedValue]
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
|
#[ApiProperty(identifier: false)]
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
#[ORM\Column(length: 255,unique: true)]
|
||||||
|
#[ApiProperty(identifier: true)]
|
||||||
|
|
||||||
private ?string $orderId = null;
|
private ?string $orderId = null;
|
||||||
|
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
@ -34,7 +40,7 @@ class Order
|
|||||||
private array $data = [];
|
private array $data = [];
|
||||||
|
|
||||||
#[ORM\Column(name: 'change_date', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
#[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
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
@ -77,12 +83,12 @@ class Order
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChangeDate(): ?\DateTimeInterface
|
public function getChangeDate(): ?DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->changeDate;
|
return $this->changeDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setChangeDate(\DateTimeInterface $changeDate): static
|
public function setChangeDate(DateTimeInterface $changeDate): static
|
||||||
{
|
{
|
||||||
$this->changeDate = $changeDate;
|
$this->changeDate = $changeDate;
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ namespace App\Entity;
|
|||||||
|
|
||||||
use ApiPlatform\Metadata\ApiResource;
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
use App\Repository\ProductRepository;
|
use App\Repository\ProductRepository;
|
||||||
use App\Repository\StockRepository;
|
use DateTimeInterface;
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ class Product
|
|||||||
private ?string $gtin = null;
|
private ?string $gtin = null;
|
||||||
|
|
||||||
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
#[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
|
public function getId(): ?int
|
||||||
@ -41,12 +41,12 @@ class Product
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdateTime(): ?\DateTimeInterface
|
public function getUpdateTime(): ?DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->updateTime;
|
return $this->updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUpdateTime(\DateTimeInterface $updateTime): self
|
public function setUpdateTime(DateTimeInterface $updateTime): self
|
||||||
{
|
{
|
||||||
$this->updateTime = $updateTime;
|
$this->updateTime = $updateTime;
|
||||||
|
|
||||||
|
@ -3,11 +3,12 @@
|
|||||||
namespace App\Entity;
|
namespace App\Entity;
|
||||||
|
|
||||||
use App\Repository\StockRepository;
|
use App\Repository\StockRepository;
|
||||||
#use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use DateTimeInterface;
|
||||||
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
|
#use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: StockRepository::class)]
|
#[ORM\Entity(repositoryClass: StockRepository::class)]
|
||||||
#[ORM\UniqueEntity(['warehouse_id', 'product_id'])]
|
#[ORM\UniqueEntity(['warehouse_id', 'product_id'])]
|
||||||
#[ORM\UniqueConstraint(
|
#[ORM\UniqueConstraint(
|
||||||
@ -30,14 +31,14 @@ class Stock
|
|||||||
private ?Warehouse $warehouse = null;
|
private ?Warehouse $warehouse = null;
|
||||||
|
|
||||||
#[ORM\Column(name: 'update_time', type: Types::DATETIME_MUTABLE, nullable: true, options: ['default' => 'CURRENT_TIMESTAMP'])]
|
#[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
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setId(int $id): ?self
|
public function setId(int $id): ?self
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
@ -55,6 +56,7 @@ class Stock
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProductId(): ?int
|
public function getProductId(): ?int
|
||||||
{
|
{
|
||||||
return $this->product_id;
|
return $this->product_id;
|
||||||
@ -66,6 +68,7 @@ class Stock
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWarehouseId(): ?int
|
public function getWarehouseId(): ?int
|
||||||
{
|
{
|
||||||
return $this->warehouse_id;
|
return $this->warehouse_id;
|
||||||
@ -112,12 +115,12 @@ class Stock
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpdateTime(): ?\DateTimeInterface
|
public function getUpdateTime(): ?DateTimeInterface
|
||||||
{
|
{
|
||||||
return $this->update_time;
|
return $this->update_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUpdateTime(?\DateTimeInterface $update_time): self
|
public function setUpdateTime(?DateTimeInterface $update_time): self
|
||||||
{
|
{
|
||||||
$this->update_time = $update_time;
|
$this->update_time = $update_time;
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ class Warehouse
|
|||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setId(int $id): self
|
public function setId(int $id): self
|
||||||
{
|
{
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
@ -3,16 +3,15 @@
|
|||||||
namespace App\EventSubscriber;
|
namespace App\EventSubscriber;
|
||||||
|
|
||||||
use ApiPlatform\Symfony\EventListener\EventPriorities;
|
use ApiPlatform\Symfony\EventListener\EventPriorities;
|
||||||
|
use App\Entity\Order;
|
||||||
use App\Helper\Hiltes;
|
use App\Helper\Hiltes;
|
||||||
use App\Helper\Slack;
|
use App\Helper\Slack;
|
||||||
use App\Entity\Order;
|
|
||||||
use Maknz\Slack\Client;
|
use Maknz\Slack\Client;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpKernel\Event\ViewEvent;
|
use Symfony\Component\HttpKernel\Event\ViewEvent;
|
||||||
use Symfony\Component\HttpKernel\KernelEvents;
|
use Symfony\Component\HttpKernel\KernelEvents;
|
||||||
use Symfony\Component\Notifier\ChatterInterface;
|
|
||||||
|
|
||||||
|
|
||||||
class SlackNotifySubscriber implements EventSubscriberInterface
|
class SlackNotifySubscriber implements EventSubscriberInterface
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
namespace App\Helper;
|
namespace App\Helper;
|
||||||
|
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
|
||||||
class Ftp
|
class Ftp
|
||||||
{
|
{
|
||||||
private string $host;
|
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
|
public function getHost(): string
|
||||||
{
|
{
|
||||||
return $this->host;
|
return $this->host;
|
||||||
@ -32,6 +83,7 @@ class Ftp
|
|||||||
{
|
{
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPort(): int
|
public function getPort(): int
|
||||||
{
|
{
|
||||||
return $this->port;
|
return $this->port;
|
||||||
@ -71,53 +123,4 @@ class Ftp
|
|||||||
{
|
{
|
||||||
$this->remoteDir = $remoteDir;
|
$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\Entity\Order;
|
||||||
use App\Repository\OrderRepository;
|
use App\Repository\OrderRepository;
|
||||||
use Doctrine\Common\Collections\Criteria;
|
|
||||||
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
use Symfony\Component\Filesystem\Exception\IOExceptionInterface;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
|
@ -9,21 +9,24 @@ use App\Entity\Warehouse;
|
|||||||
use App\Repository\ProductRepository;
|
use App\Repository\ProductRepository;
|
||||||
use App\Repository\StockRepository;
|
use App\Repository\StockRepository;
|
||||||
use App\Repository\WarehouseRepository;
|
use App\Repository\WarehouseRepository;
|
||||||
|
use Exception;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
use SplFileObject;
|
||||||
use Symfony\Component\Finder\Finder;
|
use Symfony\Component\Finder\Finder;
|
||||||
|
|
||||||
|
|
||||||
class HiltesImport
|
class HiltesImport
|
||||||
{
|
{
|
||||||
|
protected $currentDirPath;
|
||||||
|
protected $cachedWarehouseIds;
|
||||||
|
protected $arrData = array();
|
||||||
private $productRepository;
|
private $productRepository;
|
||||||
private $stockRepository;
|
private $stockRepository;
|
||||||
private $warehouseRepository;
|
private $warehouseRepository;
|
||||||
private $logger;
|
private $logger;
|
||||||
protected $currentDirPath;
|
|
||||||
protected $cachedWarehouseIds;
|
|
||||||
private $cachedProdIds;
|
private $cachedProdIds;
|
||||||
private $cachedStockIds;
|
private $cachedStockIds;
|
||||||
protected $arrData = array();
|
|
||||||
|
|
||||||
public function __construct(ProductRepository $productRepository, WarehouseRepository $warehouseRepository, StockRepository $stockRepository, LoggerInterface $logger)
|
public function __construct(ProductRepository $productRepository, WarehouseRepository $warehouseRepository, StockRepository $stockRepository, LoggerInterface $logger)
|
||||||
{
|
{
|
||||||
@ -52,7 +55,7 @@ class HiltesImport
|
|||||||
if (is_file($file['realPath'])) {
|
if (is_file($file['realPath'])) {
|
||||||
$count += $this->loadFiles($file['realPath']);
|
$count += $this->loadFiles($file['realPath']);
|
||||||
} else {
|
} 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');
|
$this->logger->info('No Files');
|
||||||
}
|
}
|
||||||
} else {
|
} 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getStocks()
|
protected function getStocks()
|
||||||
{
|
{
|
||||||
$stocks = $this->stockRepository->findAll();
|
$stocks = $this->stockRepository->findAll();
|
||||||
@ -112,7 +116,7 @@ class HiltesImport
|
|||||||
protected function loadFiles($srcFile)
|
protected function loadFiles($srcFile)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$file = new \SplFileObject($srcFile);
|
$file = new SplFileObject($srcFile);
|
||||||
$this->logger->info('Starte Import von ' . $file->getRealPath());
|
$this->logger->info('Starte Import von ' . $file->getRealPath());
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
@ -120,7 +124,7 @@ class HiltesImport
|
|||||||
$this->processLine($file->fgets());
|
$this->processLine($file->fgets());
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +199,8 @@ class HiltesImport
|
|||||||
* @param string $gtin
|
* @param string $gtin
|
||||||
* @return false|int|mixed|null
|
* @return false|int|mixed|null
|
||||||
*/
|
*/
|
||||||
private function checkProduct(string $gtin){
|
private function checkProduct(string $gtin)
|
||||||
|
{
|
||||||
#*** WEnn keine geCached Id Vorhanden
|
#*** WEnn keine geCached Id Vorhanden
|
||||||
if (empty($this->cachedProdIds[$gtin])) {
|
if (empty($this->cachedProdIds[$gtin])) {
|
||||||
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);
|
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);
|
||||||
|
@ -5,8 +5,10 @@ namespace App\Helper;
|
|||||||
use App\Repository\ProductRepository;
|
use App\Repository\ProductRepository;
|
||||||
use App\Repository\StockRepository;
|
use App\Repository\StockRepository;
|
||||||
use App\Repository\WarehouseRepository;
|
use App\Repository\WarehouseRepository;
|
||||||
use Psr\Log\LoggerInterface;
|
use ArrayIterator;
|
||||||
|
use Exception;
|
||||||
use League\Csv\Writer;
|
use League\Csv\Writer;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
|
|
||||||
class Jtl
|
class Jtl
|
||||||
@ -87,7 +89,7 @@ class Jtl
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$writer = Writer::createFromPath(getcwd() . '/jtl/cds-export.csv', 'w+');
|
$writer = Writer::createFromPath(getcwd() . '/jtl/cds-export.csv', 'w+');
|
||||||
$bytes = $writer->insertAll(new \ArrayIterator($data));
|
$bytes = $writer->insertAll(new ArrayIterator($data));
|
||||||
|
|
||||||
if ($bytes) {
|
if ($bytes) {
|
||||||
$this->logger->info('Exported ' . $bytes . ' bytes');
|
$this->logger->info('Exported ' . $bytes . ' bytes');
|
||||||
@ -96,12 +98,10 @@ class Jtl
|
|||||||
$FTP->uploadFile(getcwd() . '/jtl/cds-export.csv');
|
$FTP->uploadFile(getcwd() . '/jtl/cds-export.csv');
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (\Exception $e){
|
} catch (Exception $e) {
|
||||||
$this->logger->error($e->getMessage());
|
$this->logger->error($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Helper;
|
namespace App\Helper;
|
||||||
|
|
||||||
use Symfony\Component\Notifier\Chatter;
|
|
||||||
use Symfony\Component\Notifier\ChatterInterface;
|
use Symfony\Component\Notifier\ChatterInterface;
|
||||||
use Symfony\Component\Notifier\Exception\TransportExceptionInterface;
|
use Symfony\Component\Notifier\Exception\TransportExceptionInterface;
|
||||||
use Symfony\Component\Notifier\Message\ChatMessage;
|
use Symfony\Component\Notifier\Message\ChatMessage;
|
||||||
@ -16,7 +15,7 @@ class Slack
|
|||||||
$this->chatter = $chatter;
|
$this->chatter = $chatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendMessage(String $message): void
|
public function sendMessage(string $message): void
|
||||||
{
|
{
|
||||||
$message = (new ChatMessage($message))
|
$message = (new ChatMessage($message))
|
||||||
->transport('slack');
|
->transport('slack');
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Repository;
|
|||||||
use App\Entity\Order;
|
use App\Entity\Order;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends ServiceEntityRepository<Order>
|
* @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
|
// * @return Order[] Returns an array of Order objects
|
||||||
// */
|
// */
|
||||||
@ -63,4 +80,11 @@ class OrderRepository extends ServiceEntityRepository
|
|||||||
// ->getOneOrNullResult()
|
// ->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;
|
namespace App\Repository;
|
||||||
|
|
||||||
use App\Entity\Product;
|
use App\Entity\Product;
|
||||||
|
use DateTime;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ class ProductRepository extends ServiceEntityRepository
|
|||||||
public function save(Product $entity, bool $flush = false): ?int
|
public function save(Product $entity, bool $flush = false): ?int
|
||||||
{
|
{
|
||||||
|
|
||||||
$entity->setUpdateTime(new \DateTime());
|
$entity->setUpdateTime(new DateTime());
|
||||||
|
|
||||||
$this->getEntityManager()->persist($entity);
|
$this->getEntityManager()->persist($entity);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Repository;
|
namespace App\Repository;
|
||||||
|
|
||||||
use App\Entity\Stock;
|
use App\Entity\Stock;
|
||||||
|
use DateTime;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ class StockRepository extends ServiceEntityRepository
|
|||||||
|
|
||||||
public function save(Stock $entity, bool $flush = false): void
|
public function save(Stock $entity, bool $flush = false): void
|
||||||
{
|
{
|
||||||
$entity->setUpdateTime(new \DateTime());
|
$entity->setUpdateTime(new DateTime());
|
||||||
|
|
||||||
$this->getEntityManager()->persist($entity);
|
$this->getEntityManager()->persist($entity);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user