@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $this->addSql('CREATE TABLE sylius_product_variant_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_8DC18EDC2C2AC5D3 (translatable_id), UNIQUE INDEX sylius_product_variant_translation_uniq_trans (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); |
| 35 | 35 | $this->addSql('ALTER TABLE sylius_product_variant_translation ADD CONSTRAINT FK_8DC18EDC2C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES sylius_product_variant (id) ON DELETE CASCADE'); |
| 36 | - $this->addSql('INSERT INTO sylius_product_variant_translation (translatable_id, name, locale) SELECT id, name, "'.$defaultLocale.'" from sylius_product_variant WHERE sylius_product_variant.name IS NOT null'); |
|
| 36 | + $this->addSql('INSERT INTO sylius_product_variant_translation (translatable_id, name, locale) SELECT id, name, "' . $defaultLocale . '" from sylius_product_variant WHERE sylius_product_variant.name IS NOT null'); |
|
| 37 | 37 | $this->addSql('ALTER TABLE sylius_product_variant DROP name'); |
| 38 | 38 | } |
| 39 | 39 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); |
| 48 | 48 | |
| 49 | 49 | $this->addSql('ALTER TABLE sylius_product_variant ADD name VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci'); |
| 50 | - $this->addSql('UPDATE sylius_product_variant SET name = (SELECT name FROM sylius_product_variant_translation WHERE sylius_product_variant_translation.translatable_id = sylius_product_variant.id AND sylius_product_variant_translation.locale = "'.$defaultLocale.'")'); |
|
| 50 | + $this->addSql('UPDATE sylius_product_variant SET name = (SELECT name FROM sylius_product_variant_translation WHERE sylius_product_variant_translation.translatable_id = sylius_product_variant.id AND sylius_product_variant_translation.locale = "' . $defaultLocale . '")'); |
|
| 51 | 51 | $this->addSql('DROP TABLE sylius_product_variant_translation'); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $this->addSql('CREATE TABLE sylius_product_association_type_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT NOT NULL, name VARCHAR(255) DEFAULT NULL, locale VARCHAR(255) NOT NULL, INDEX IDX_4F618E52C2AC5D3 (translatable_id), UNIQUE INDEX sylius_product_association_type_translation_uniq_trans (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'); |
| 38 | 38 | $this->addSql('ALTER TABLE sylius_product_association_type_translation ADD CONSTRAINT FK_4F618E52C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES sylius_product_association_type (id) ON DELETE CASCADE'); |
| 39 | - $this->addSql('INSERT INTO sylius_product_association_type_translation (translatable_id, name, locale) SELECT id, name, "'.$defaultLocale.'" from sylius_product_association_type WHERE sylius_product_association_type.name IS NOT null'); |
|
| 39 | + $this->addSql('INSERT INTO sylius_product_association_type_translation (translatable_id, name, locale) SELECT id, name, "' . $defaultLocale . '" from sylius_product_association_type WHERE sylius_product_association_type.name IS NOT null'); |
|
| 40 | 40 | $this->addSql('ALTER TABLE sylius_product_association_type DROP name'); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $defaultLocale = $this->container->getParameter('locale'); |
| 51 | 51 | |
| 52 | 52 | $this->addSql('ALTER TABLE sylius_product_association_type ADD name VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci'); |
| 53 | - $this->addSql('UPDATE sylius_product_association_type SET name = (SELECT name FROM sylius_product_association_type_translation WHERE sylius_product_association_type_translation.translatable_id = sylius_product_association_type.id AND sylius_product_association_type_translation.locale = "'.$defaultLocale.'")'); |
|
| 53 | + $this->addSql('UPDATE sylius_product_association_type SET name = (SELECT name FROM sylius_product_association_type_translation WHERE sylius_product_association_type_translation.translatable_id = sylius_product_association_type.id AND sylius_product_association_type_translation.locale = "' . $defaultLocale . '")'); |
|
| 54 | 54 | $this->addSql('DROP TABLE sylius_product_association_type_translation'); |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $defaultLocale = $this->container->getParameter('locale'); |
| 36 | 36 | |
| 37 | 37 | $this->addSql('ALTER TABLE sylius_product_attribute_value ADD locale_code VARCHAR(255) NOT NULL'); |
| 38 | - $this->addSql('UPDATE sylius_product_attribute_value SET locale_code = "'.$defaultLocale.'"'); |
|
| 38 | + $this->addSql('UPDATE sylius_product_attribute_value SET locale_code = "' . $defaultLocale . '"'); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types = 1); |
|
| 1 | +<?php declare(strict_types=1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Sylius\Migrations; |
| 4 | 4 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | use Symfony\Component\Dotenv\Dotenv; |
| 5 | 5 | use Symfony\Component\HttpFoundation\Request; |
| 6 | 6 | |
| 7 | -require __DIR__.'/../vendor/autoload.php'; |
|
| 7 | +require __DIR__ . '/../vendor/autoload.php'; |
|
| 8 | 8 | |
| 9 | 9 | // The check is to ensure we don't use .env in production |
| 10 | 10 | if (!isset($_SERVER['APP_ENV']) && !isset($_ENV['APP_ENV'])) { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.'); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - $envFile = file_exists(__DIR__.'/../.env') ? __DIR__.'/../.env' : __DIR__.'/../.env.dist'; |
|
| 15 | + $envFile = file_exists(__DIR__ . '/../.env') ? __DIR__ . '/../.env' : __DIR__ . '/../.env.dist'; |
|
| 16 | 16 | (new Dotenv())->load($envFile); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | foreach ($this->getRoutes()->all() as $name => $route) { |
| 95 | 95 | if ($host = $route->getHost()) { |
| 96 | 96 | $matchHost = true; |
| 97 | - $host = '/'.strtr(strrev($host), '}.{', '(/)'); |
|
| 97 | + $host = '/' . strtr(strrev($host), '}.{', '(/)'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $routes->addRoute($host ?: '/(.*)', array($name, $route)); |
@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | private function doMatch(string $rawPathinfo, array &$allow = array(), array &$allowSchemes = array()): ?array |
| 160 | 160 | |
| 161 | 161 | EOF |
| 162 | - .$code."\n return null;\n }"; |
|
| 162 | + .$code . "\n return null;\n }"; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - return " public function match(\$rawPathinfo)\n".$code."\n throw \$allow ? new MethodNotAllowedException(array_keys(\$allow)) : new ResourceNotFoundException();\n }"; |
|
| 165 | + return " public function match(\$rawPathinfo)\n" . $code . "\n throw \$allow ? new MethodNotAllowedException(array_keys(\$allow)) : new ResourceNotFoundException();\n }"; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | } |
| 364 | 364 | $prev = false; |
| 365 | 365 | $rx = '{^(?'; |
| 366 | - $code .= "\n {$state->mark} => ".self::export($rx); |
|
| 366 | + $code .= "\n {$state->mark} => " . self::export($rx); |
|
| 367 | 367 | $state->mark += \strlen($rx); |
| 368 | 368 | $state->regex = $rx; |
| 369 | 369 | |
@@ -372,14 +372,14 @@ discard block |
||
| 372 | 372 | if ($hostRegex) { |
| 373 | 373 | preg_match('#^.\^(.*)\$.[a-zA-Z]*$#', $hostRegex, $rx); |
| 374 | 374 | $state->vars = array(); |
| 375 | - $hostRegex = '(?i:'.preg_replace_callback('#\?P<([^>]++)>#', $state->getVars, $rx[1]).')\.'; |
|
| 375 | + $hostRegex = '(?i:' . preg_replace_callback('#\?P<([^>]++)>#', $state->getVars, $rx[1]) . ')\.'; |
|
| 376 | 376 | $state->hostVars = $state->vars; |
| 377 | 377 | } else { |
| 378 | 378 | $hostRegex = '(?:(?:[^./]*+\.)++)'; |
| 379 | 379 | $state->hostVars = array(); |
| 380 | 380 | } |
| 381 | - $state->mark += \strlen($rx = ($prev ? ')' : '')."|{$hostRegex}(?"); |
|
| 382 | - $code .= "\n .".self::export($rx); |
|
| 381 | + $state->mark += \strlen($rx = ($prev ? ')' : '') . "|{$hostRegex}(?"); |
|
| 382 | + $code .= "\n ." . self::export($rx); |
|
| 383 | 383 | $state->regex .= $rx; |
| 384 | 384 | $prev = true; |
| 385 | 385 | } |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | $prevRegex = null; |
| 466 | 466 | $prefix = substr($route->getPrefix(), $prefixLen); |
| 467 | 467 | $state->mark += \strlen($rx = "|{$prefix}(?"); |
| 468 | - $code .= "\n .".self::export($rx); |
|
| 468 | + $code .= "\n ." . self::export($rx); |
|
| 469 | 469 | $state->regex .= $rx; |
| 470 | 470 | $code .= $this->indent($this->compileStaticPrefixCollection($route, $state, $prefixLen + \strlen($prefix))); |
| 471 | 471 | $code .= "\n .')'"; |
@@ -478,14 +478,14 @@ discard block |
||
| 478 | 478 | $compiledRoute = $route->compile(); |
| 479 | 479 | |
| 480 | 480 | if ($compiledRoute->getRegex() === $prevRegex) { |
| 481 | - $state->switch = substr_replace($state->switch, $this->compileRoute($route, $name, false)."\n", -19, 0); |
|
| 481 | + $state->switch = substr_replace($state->switch, $this->compileRoute($route, $name, false) . "\n", -19, 0); |
|
| 482 | 482 | continue; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | $state->mark += 3 + $state->markTail + \strlen($regex) - $prefixLen; |
| 486 | 486 | $state->markTail = 2 + \strlen($state->mark); |
| 487 | 487 | $rx = sprintf('|%s(*:%s)', substr($regex, $prefixLen), $state->mark); |
| 488 | - $code .= "\n .".self::export($rx); |
|
| 488 | + $code .= "\n ." . self::export($rx); |
|
| 489 | 489 | $state->regex .= $rx; |
| 490 | 490 | $vars = array_merge($state->hostVars, $vars); |
| 491 | 491 | |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | $code .= " // {$name}\n"; |
| 622 | 622 | } |
| 623 | 623 | |
| 624 | - $gotoname = 'not_'.preg_replace('/[^A-Za-z0-9_]/', '', $name); |
|
| 624 | + $gotoname = 'not_' . preg_replace('/[^A-Za-z0-9_]/', '', $name); |
|
| 625 | 625 | |
| 626 | 626 | // the offset where the return value is appended below, with indendation |
| 627 | 627 | $retOffset = 12 + \strlen($code); |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | |
| 731 | 731 | private function indent($code, $level = 1) |
| 732 | 732 | { |
| 733 | - return preg_replace('/^./m', str_repeat(' ', $level).'$0', $code); |
|
| 733 | + return preg_replace('/^./m', str_repeat(' ', $level) . '$0', $code); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | /** |
@@ -759,14 +759,14 @@ discard block |
||
| 759 | 759 | if ($i === $k) { |
| 760 | 760 | ++$i; |
| 761 | 761 | } else { |
| 762 | - $export .= self::export($k).' => '; |
|
| 762 | + $export .= self::export($k) . ' => '; |
|
| 763 | 763 | |
| 764 | 764 | if (\is_int($k) && $i < $k) { |
| 765 | 765 | $i = 1 + $k; |
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | - $export .= self::export($v).', '; |
|
| 769 | + $export .= self::export($v) . ', '; |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | return substr_replace($export, ')', -2); |