Skip to content

Commit

Permalink
Deprecate and move public constants from old Sylius < 1.3 Kernel (Syl…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmenozzi committed Feb 4, 2022
1 parent b477812 commit bfea0db
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use GuzzleHttp\Psr7\Uri;
use Http\Message\MessageFactory;
use Psr\Http\Message\UriInterface;
use Sylius\Bundle\CoreBundle\Application\Kernel;
use Sylius\Bundle\CoreBundle\SyliusCoreBundle;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

Expand Down Expand Up @@ -47,7 +47,7 @@ public function __construct(
public function getVersionAction(Request $request): JsonResponse
{
$content = [
'version' => Kernel::VERSION,
'version' => SyliusCoreBundle::VERSION,
'hostname' => $request->getHost(),
'locale' => $request->getLocale(),
'user_agent' => $request->headers->get('User-Agent'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Sylius\Bundle\AdminBundle\Twig;

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Sylius\Bundle\CoreBundle\SyliusCoreBundle;
use Twig\Environment;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
Expand Down Expand Up @@ -52,7 +52,7 @@ public function renderWidget(Environment $environment): string

return $environment->render('@SyliusAdmin/_notification.html.twig', [
'frequency' => $this->checkFrequency,
'currentVersion' => Kernel::VERSION,
'currentVersion' => SyliusCoreBundle::VERSION,
]);
}
}
24 changes: 18 additions & 6 deletions src/Sylius/Bundle/CoreBundle/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,36 @@

namespace Sylius\Bundle\CoreBundle\Application;

use Sylius\Bundle\CoreBundle\SyliusCoreBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as HttpKernel;

/**
* @deprecated Using "Sylius\Bundle\CoreBundle\Application\Kernel" as Symfony kernel is deprecated since Sylius 1.3.
* Please migrate to Symfony 4 directory structure.
* Upgrade guide: https://github.com/Sylius/Sylius/blob/1.3/UPGRADE-1.3.md#directory-structure-change
*/
class Kernel extends HttpKernel
{
use MicroKernelTrait;

public const VERSION = '1.12.0-DEV';
/** @deprecated Use Sylius\Bundle\CoreBundle\SyliusCoreBundle::VERSION instead */
public const VERSION = SyliusCoreBundle::VERSION;

public const VERSION_ID = '11200';
/** @deprecated Use Sylius\Bundle\CoreBundle\SyliusCoreBundle::VERSION_ID instead */
public const VERSION_ID = SyliusCoreBundle::VERSION_ID;

public const MAJOR_VERSION = '1';
/** @deprecated Use Sylius\Bundle\CoreBundle\SyliusCoreBundle:MAJOR_VERSION instead */
public const MAJOR_VERSION = SyliusCoreBundle::MAJOR_VERSION;

public const MINOR_VERSION = '12';
/** @deprecated Use Sylius\Bundle\CoreBundle\SyliusCoreBundle:MINOR_VERSION instead */
public const MINOR_VERSION = SyliusCoreBundle::MINOR_VERSION;

public const RELEASE_VERSION = '0';
/** @deprecated Use Sylius\Bundle\CoreBundle\SyliusCoreBundle:RELEASE_VERSION instead */
public const RELEASE_VERSION = SyliusCoreBundle::RELEASE_VERSION;

public const EXTRA_VERSION = 'DEV';
/** @deprecated Use Sylius\Bundle\CoreBundle\SyliusCoreBundle:EXTRA_VERSION instead */
public const EXTRA_VERSION = SyliusCoreBundle::EXTRA_VERSION;

public function __construct(string $environment, bool $debug)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Sylius/Bundle/CoreBundle/Collector/SyliusCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Sylius\Bundle\CoreBundle\Collector;

use Sylius\Bundle\CoreBundle\Application\Kernel;
use Sylius\Bundle\CoreBundle\SyliusCoreBundle;
use Sylius\Component\Channel\Context\ChannelNotFoundException;
use Sylius\Component\Core\Context\ShopperContextInterface;
use Sylius\Component\Core\Model\ChannelInterface;
Expand All @@ -35,7 +35,7 @@ public function __construct(
$this->shopperContext = $shopperContext;

$this->data = [
'version' => Kernel::VERSION,
'version' => SyliusCoreBundle::VERSION,
'base_currency_code' => null,
'currency_code' => null,
'default_locale_code' => $defaultLocaleCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ twig:
sylius: "@sylius.context.shopper"
sylius_base_locale: "%locale%"
sylius_meta:
version: !php/const Sylius\Bundle\CoreBundle\Application\Kernel::VERSION
version: !php/const Sylius\Bundle\CoreBundle\SyliusCoreBundle::VERSION

sonata_block:
blocks:
Expand Down
12 changes: 12 additions & 0 deletions src/Sylius/Bundle/CoreBundle/SyliusCoreBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@

final class SyliusCoreBundle extends AbstractResourceBundle
{
public const VERSION = '1.12.0-DEV';

public const VERSION_ID = '11200';

public const MAJOR_VERSION = '1';

public const MINOR_VERSION = '12';

public const RELEASE_VERSION = '0';

public const EXTRA_VERSION = 'DEV';

public function getSupportedDrivers(): array
{
return [
Expand Down

0 comments on commit bfea0db

Please sign in to comment.