Fixed project for symfony 5.1

feature/symfony_upgrade
Hecht 4 years ago
parent 7594b5af67
commit 334f734012

20
.env

@ -15,14 +15,18 @@
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=2e4a817309fb576a536b62a60eaf2aaa
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
APP_SECRET=296bba2d9c7a4f6eee2c7611d66a8aec
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^(localhost|example\.com)$'
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# For a PostgreSQL database, use: "postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=11&charset=utf8"
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7
###< doctrine/doctrine-bundle ###
###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
###> symfony/mailer ###
# MAILER_DSN=smtp://localhost
###< symfony/mailer ###

8
.gitignore vendored

@ -1,8 +1,8 @@
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
@ -13,10 +13,4 @@
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
###> symfony/web-server-bundle ###
/.web-server-pid
###< symfony/web-server-bundle ###
.project

@ -4,7 +4,8 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
@ -14,8 +15,8 @@ set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.');
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
}
$input = new ArgvInput();
@ -27,7 +28,7 @@ if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}
require dirname(__DIR__).'/config/bootstrap.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);

@ -2,39 +2,57 @@
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"friendsofsymfony/rest-bundle": "^2.4",
"composer/package-versions-deprecated": "^1.11",
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"friendsofsymfony/rest-bundle": "^3.0",
"phpdocumentor/reflection-docblock": "^5.2",
"sensio/framework-extra-bundle": "^5.1",
"symfony/asset": "4.4.*",
"symfony/console": "4.4.*",
"symfony/expression-language": "4.4.*",
"symfony/flex": "^1.1",
"symfony/form": "4.4.*",
"symfony/framework-bundle": "4.4.*",
"symfony/asset": "5.1.*",
"symfony/console": "5.1.*",
"symfony/dotenv": "5.1.*",
"symfony/expression-language": "5.1.*",
"symfony/flex": "^1.3.1",
"symfony/form": "5.1.*",
"symfony/framework-bundle": "5.1.*",
"symfony/http-client": "5.1.*",
"symfony/intl": "5.1.*",
"symfony/mailer": "5.1.*",
"symfony/mime": "5.1.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.4.*",
"symfony/security-bundle": "4.4.*",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.4.*",
"symfony/twig-bundle": "4.4.*",
"symfony/validator": "4.4.*",
"symfony/web-link": "4.4.*",
"symfony/yaml": "4.4.*"
"symfony/notifier": "5.1.*",
"symfony/process": "5.1.*",
"symfony/property-access": "5.1.*",
"symfony/property-info": "5.1.*",
"symfony/security-bundle": "5.1.*",
"symfony/serializer": "5.1.*",
"symfony/string": "5.1.*",
"symfony/translation": "5.1.*",
"symfony/twig-bundle": "^5.1",
"symfony/validator": "5.1.*",
"symfony/web-link": "5.1.*",
"symfony/yaml": "5.1.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"symfony/debug-pack": "*",
"symfony/dotenv": "4.4.*",
"doctrine/doctrine-fixtures-bundle": "^3.3",
"symfony/browser-kit": "^5.1",
"symfony/css-selector": "^5.1",
"symfony/debug-bundle": "^5.1",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.4.*"
"symfony/phpunit-bridge": "^5.1",
"symfony/stopwatch": "^5.1",
"symfony/var-dumper": "^5.1",
"symfony/web-profiler-bundle": "^5.1"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
@ -54,6 +72,7 @@
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
@ -76,7 +95,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.4.*"
"require": "5.1.*"
}
}
}

3056
composer.lock generated

File diff suppressed because it is too large Load Diff

@ -13,38 +13,8 @@ if (!class_exists(Dotenv::class)) {
if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
(new Dotenv(false))->populate($env);
} else {
$path = dirname(__DIR__).'/.env';
$dotenv = new Dotenv(false);
// load all the .env files
if (method_exists($dotenv, 'loadEnv')) {
$dotenv->loadEnv($path);
} else {
// fallback code in case your Dotenv component is not 4.2 or higher (when loadEnv() was added)
if (file_exists($path) || !file_exists($p = "$path.dist")) {
$dotenv->load($path);
} else {
$dotenv->load($p);
}
if (null === $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) {
$dotenv->populate(array('APP_ENV' => $env = 'dev'));
}
if ('test' !== $env && file_exists($p = "$path.local")) {
$dotenv->load($p);
$env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env;
}
if (file_exists($p = "$path.$env")) {
$dotenv->load($p);
}
if (file_exists($p = "$path.$env.local")) {
$dotenv->load($p);
}
}
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER += $_ENV;

@ -2,18 +2,16 @@
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
FOS\RestBundle\FOSRestBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
];

@ -1,4 +0,0 @@
# See https://symfony.com/doc/current/email/dev_environment.html
swiftmailer:
# send all emails to a specific address
#delivery_addresses: ['me@example.com']

@ -5,19 +5,14 @@ doctrine:
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '5.7'
# only needed for MySQL
charset: utf8mb4
default_table_options:
collate: utf8mb4_unicode_ci
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
type: yml
dir: '%kernel.project_dir%/config/orm'
prefix: 'App\Entity'
alias: App

@ -1,15 +1,22 @@
# Read the documentation: https://symfony.com/doc/master/bundles/FOSRestBundle/index.html
fos_rest: null
# param_fetcher_listener: true
fos_rest:
disable_csrf_role: ROLE_API
param_fetcher_listener: true
body_listener: true
# allowed_methods_listener: true
# routing_loader: true
# view:
# view_response_listener: true
# exception:
# codes:
# App\Exception\MyException: 403
# messages:
# App\Exception\MyException: Forbidden area.
# format_listener:
# rules:
# - { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, html ] }
view:
view_response_listener: force
exception:
enabled: true
codes:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404
'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT
messages:
'Symfony\Component\Routing\Exception\ResourceNotFoundException': true
format_listener:
rules:
- { path: ^/api, prefer_extension: true, fallback_format: json, priorities: [ json, xml ] }
- { path: ^/, prefer_extension: true, fallback_format: html, priorities: [ html ] }
serializer:
groups: ['Default']

@ -1,3 +1,4 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
@ -7,6 +8,7 @@ framework:
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
#esi: true

@ -0,0 +1,3 @@
framework:
mailer:
dsn: '%env(MAILER_DSN)%'

@ -0,0 +1,16 @@
framework:
notifier:
#chatter_transports:
# slack: '%env(SLACK_DSN)%'
# telegram: '%env(TELEGRAM_DSN)%'
#texter_transports:
# twilio: '%env(TWILIO_DSN)%'
# nexmo: '%env(NEXMO_DSN)%'
channel_policy:
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
urgent: ['email']
high: ['email']
medium: ['email']
low: ['email']
admin_recipients:
- { email: admin@example.com }

@ -2,26 +2,14 @@ doctrine:
orm:
auto_generate_proxy_classes: false
metadata_cache_driver:
type: service
id: doctrine.system_cache_provider
type: pool
pool: doctrine.system_cache_pool
query_cache_driver:
type: service
id: doctrine.system_cache_provider
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: service
id: doctrine.result_cache_provider
services:
doctrine.result_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.result_cache_pool'
doctrine.system_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.system_cache_pool'
type: pool
pool: doctrine.result_cache_pool
framework:
cache:

@ -1,3 +1,7 @@
framework:
router:
utf8: true
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost

@ -8,6 +8,7 @@ security:
security: false
main:
anonymous: true
lazy: true
provider: users_in_memory
# activate different ways to authenticate

@ -1,3 +0,0 @@
swiftmailer:
url: '%env(MAILER_URL)%'
spool: { type: 'memory' }

@ -1,2 +0,0 @@
swiftmailer:
disable_delivery: true

@ -1,4 +1,3 @@
framework:
validation:
# As of Symfony 4.3 you can disable the NotCompromisedPassword Validator
# not_compromised_password: false
not_compromised_password: false

@ -1,4 +1,2 @@
twig:
default_path: '%kernel.project_dir%/templates'
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'

@ -1,3 +1,8 @@
framework:
validation:
email_validation_mode: html5
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []

@ -0,0 +1,5 @@
<?php
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
}

@ -0,0 +1,3 @@
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

@ -1,3 +0,0 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error

@ -10,20 +10,21 @@ services:
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}'
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
- '../src/Tests/'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller'
resource: '../src/Controller/'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed

@ -1,10 +1,13 @@
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
require dirname(__DIR__).'/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);

@ -4,13 +4,10 @@ namespace App\Controller;
use App\Repository\HeroRepository;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Controller\AbstractFOSRestController;
use Symfony\Component\HttpFoundation\Response;
/**
* @Rest\RouteResource("Hero")
*/
class HeroController extends FOSRestController
class HeroController extends AbstractFOSRestController
{
protected $heroRepository;
@ -20,6 +17,7 @@ class HeroController extends FOSRestController
}
/**
* @Rest\Route("api/heroes")
* @Rest\View()
*/
public function cgetAction()

@ -4,13 +4,10 @@ namespace App\Controller;
use App\Repository\UserRepository;
use FOS\RestBundle\Controller\Annotations as Rest;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Controller\AbstractFOSRestController;
use Symfony\Component\HttpFoundation\Response;
/**
* @Rest\RouteResource("User")
*/
class UserController extends FOSRestController
class UserController extends AbstractFOSRestController
{
protected $userRepository;
@ -20,6 +17,7 @@ class UserController extends FOSRestController
}
/**
* @Rest\Route("api/users")
* @Rest\View()
*/
public function cgetAction()

@ -4,8 +4,8 @@ namespace App\DataFixtures;
use App\Entity\Hero;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Doctrine\DataFixtures\DependentFixtureInterface;
class HeroFixtures extends Fixture implements DependentFixtureInterface
{

@ -3,17 +3,15 @@ namespace App\DataFixtures;
use App\Entity\User;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
class UserFixtures extends Fixture
{
public const ADMIN_USER_REFERENCE = 'admin-user';
public const ADMIN_USER_TOKEN = 'ItsHammerTime!';
public const DUDE_USER_REFERENCE = 'dummy-user';
public const DUDE_USER_TOKEN = 'ItsDuderzeit!';
private $passwordEncoder;
@ -27,13 +25,13 @@ class UserFixtures extends Fixture
$userAdmin = new User();
$userAdmin->setUsername('admin');
$this->setPassword($userAdmin, '123456789');
$userAdmin->setApiToken(self::ADMIN_USER_TOKEN);
$userAdmin->setApiToken('ItsHammerTime!');
$manager->persist($userAdmin);
$userDude = new User();
$userDude->setUsername('dude');
$this->setPassword($userDude, '1234');
$userDude->setApiToken(self::DUDE_USER_TOKEN);
$userDude->setApiToken('ItsDuderzeit!');
$manager->persist($userDude);
$manager->flush();

@ -3,59 +3,36 @@
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
const CONFIG_EXTS = '.{php,xml,yaml,yml}';
public function getCacheDir()
{
return $this->getProjectDir().'/var/cache/'.$this->environment;
}
public function getLogDir()
{
return $this->getProjectDir().'/var/log';
}
public function registerBundles()
protected function configureContainer(ContainerConfigurator $container): void
{
$contents = require $this->getProjectDir().'/config/bundles.php';
foreach ($contents as $class => $envs) {
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class();
}
$container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/'.$this->environment.'/*.yaml');
if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
$container->import('../config/services.yaml');
$container->import('../config/{services}_'.$this->environment.'.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
(require $path)($container->withPath($path), $this);
}
}
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
{
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
// Feel free to remove the "container.autowiring.strict_mode" parameter
// if you are using symfony/dependency-injection 4.0+ as it's the default behavior
$container->setParameter('container.autowiring.strict_mode', true);
$container->setParameter('container.dumper.inline_class_loader', true);
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
protected function configureRoutes(RouteCollectionBuilder $routes)
protected function configureRoutes(RoutingConfigurator $routes): void
{
$confDir = $this->getProjectDir().'/config';
$routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
$routes->import('../config/{routes}/*.yaml');
$routes->import($confDir.'/{routes}/'.$this->environment.'/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
$routes->import('../config/routes.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
(require $path)($routes->withPath($path), $this);
}
}
}

@ -4,7 +4,7 @@ namespace App\Repository;
use App\Entity\Hero;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Hero|null find($id, $lockMode = null, $lockVersion = null)
@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
*/
class HeroRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Hero::class);
}

@ -4,7 +4,7 @@ namespace App\Repository;
use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method User|null find($id, $lockMode = null, $lockVersion = null)
@ -14,7 +14,7 @@ use Symfony\Bridge\Doctrine\RegistryInterface;
*/
class UserRepository extends ServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, User::class);
}

@ -27,12 +27,12 @@
"version": "v2.8.0"
},
"doctrine/doctrine-bundle": {
"version": "1.6",
"version": "2.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.6",
"ref": "2ede24c63b72e96be0b28819052033f887024927"
"version": "2.0",
"ref": "a9f2463b9f73efe74482f831f03a204a41328555"
},
"files": [
"config/packages/doctrine.yaml",
@ -41,9 +41,6 @@
"src/Repository/.gitignore"
]
},
"doctrine/doctrine-cache-bundle": {
"version": "1.3.5"
},
"doctrine/doctrine-fixtures-bundle": {
"version": "3.0",
"recipe": {
@ -93,6 +90,9 @@
"doctrine/reflection": {
"version": "v1.0.0"
},
"doctrine/sql-formatter": {
"version": "1.1.1"
},
"easycorp/easy-log-handler": {
"version": "1.0",
"recipe": {
@ -120,9 +120,6 @@
"config/packages/fos_rest.yaml"
]
},
"jdorn/sql-formatter": {
"version": "v1.2.17"
},
"laminas/laminas-code": {
"version": "3.4.1"
},
@ -162,6 +159,9 @@
"psr/container": {
"version": "1.0.0"
},
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/link": {
"version": "1.0.0"
},
@ -177,9 +177,6 @@
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
}
},
"swiftmailer/swiftmailer": {
"version": "v6.1.3"
},
"symfony/asset": {
"version": "v4.1.7"
},
@ -196,24 +193,20 @@
"version": "v4.1.7"
},
"symfony/console": {
"version": "3.3",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "5b06148c10d442bf536a4d3017cadb3a99fd9135"
"version": "5.1",
"ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c"
},
"files": [
"bin/console",
"config/bootstrap.php"
"bin/console"
]
},
"symfony/css-selector": {
"version": "v4.1.7"
},
"symfony/debug": {
"version": "v4.1.7"
},
"symfony/debug-bundle": {
"version": "4.1",
"recipe": {
@ -223,12 +216,12 @@
"ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea"
}
},
"symfony/debug-pack": {
"version": "v1.0.6"
},
"symfony/dependency-injection": {
"version": "v4.1.7"
},
"symfony/deprecation-contracts": {
"version": "v2.2.0"
},
"symfony/doctrine-bridge": {
"version": "v4.1.7"
},
@ -272,24 +265,28 @@
"version": "v4.1.7"
},
"symfony/framework-bundle": {
"version": "3.4",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.4",
"ref": "903c28f0ce372b8414cc569a8832428737e8abd1"
"version": "5.1",
"ref": "6ee1194b036378b21884e7f57b6a2ac721167f16"
},
"files": [
"config/bootstrap.php",
"config/packages/cache.yaml",
"config/packages/framework.yaml",
"config/packages/test/framework.yaml",
"config/preload.php",
"config/routes/dev/framework.yaml",
"config/services.yaml",
"public/index.php",
"src/Controller/.gitignore",
"src/Kernel.php"
]
},
"symfony/http-client": {
"version": "v5.1.7"
},
"symfony/http-client-contracts": {
"version": "v2.3.1"
},
@ -299,12 +296,21 @@
"symfony/http-kernel": {
"version": "v4.1.7"
},
"symfony/inflector": {
"version": "v4.1.7"
},
"symfony/intl": {
"version": "v4.1.7"
},
"symfony/mailer": {
"version": "4.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.3",
"ref": "15658c2a0176cda2e7dba66276a2030b52bd81b2"
},
"files": [
"config/packages/mailer.yaml"
]
},
"symfony/maker-bundle": {
"version": "1.0",
"recipe": {
@ -335,12 +341,21 @@
"config/packages/test/monolog.yaml"
]
},
"symfony/notifier": {
"version": "5.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.0",
"ref": "c31585e252b32fe0e1f30b1f256af553f4a06eb9"
},
"files": [
"config/packages/notifier.yaml"
]
},
"symfony/options-resolver": {
"version": "v4.1.7"
},
"symfony/orm-pack": {
"version": "v1.0.5"
},
"symfony/panther": {
"version": "v0.2.0"
},
@ -359,6 +374,9 @@
"tests/bootstrap.php"
]
},
"symfony/polyfill-intl-grapheme": {
"version": "v1.18.1"
},
"symfony/polyfill-intl-icu": {
"version": "v1.10.0"
},
@ -371,9 +389,6 @@
"symfony/polyfill-mbstring": {
"version": "v1.10.0"
},
"symfony/polyfill-php72": {
"version": "v1.10.0"
},
"symfony/polyfill-php73": {
"version": "v1.18.1"
},
@ -383,9 +398,6 @@
"symfony/process": {
"version": "v4.1.7"
},
"symfony/profiler-pack": {
"version": "v1.0.3"
},
"symfony/property-access": {
"version": "v4.1.7"
},
@ -393,12 +405,12 @@
"version": "v4.1.7"
},
"symfony/routing": {
"version": "4.2",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.2",
"ref": "683dcb08707ba8d41b7e34adb0344bfd68d248a7"
"version": "5.1",
"ref": "b4f3e7c95e38b606eef467e8a42a8408fc460c43"
},
"files": [
"config/packages/prod/routing.yaml",
@ -407,12 +419,12 @@
]
},
"symfony/security-bundle": {
"version": "3.3",
"version": "5.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "38d658ce68375d66d2cddc88892af8f08701e6e7"
"version": "5.1",
"ref": "0a4bae19389d3b9cba1ca0102e3b2bccea724603"
},
"files": [
"config/packages/security.yaml"
@ -433,34 +445,14 @@
"symfony/serializer": {
"version": "v4.1.7"
},
"symfony/serializer-pack": {
"version": "v1.0.1"
},
"symfony/service-contracts": {
"version": "v2.2.0"
},
"symfony/stopwatch": {
"version": "v4.1.7"
},
"symfony/swiftmailer-bundle": {
"version": "2.5",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "2.5",
"ref": "ae4d22af30bbd484506bc1817c5a3ef72c855b93"
},
"files": [
"config/packages/dev/swiftmailer.yaml",
"config/packages/swiftmailer.yaml",
"config/packages/test/swiftmailer.yaml"
]
},
"symfony/templating": {
"version": "v4.1.7"
},
"symfony/test-pack": {
"version": "v1.0.4"
"symfony/string": {
"version": "v5.1.7"
},
"symfony/translation": {
"version": "3.3",
@ -482,27 +474,26 @@
"version": "v4.1.7"
},
"symfony/twig-bundle": {
"version": "3.3",
"version": "5.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "1da1987340b5ba64b16383906d678b989e3d096e"
"version": "5.0",
"ref": "fab9149bbaa4d5eca054ed93f9e1b66cc500895d"
},
"files": [
"config/packages/test/twig.yaml",
"config/packages/twig.yaml",
"config/routes/dev/twig.yaml",
"templates/base.html.twig"
]
},
"symfony/validator": {
"version": "4.1",
"version": "4.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.1",
"ref": "21ab70175caf1e4b273791364fb30d27f1153546"
"version": "4.3",
"ref": "d902da3e4952f18d3bf05aab29512eb61cabd869"
},
"files": [
"config/packages/test/validator.yaml",
@ -527,18 +518,12 @@
"ref": "6bdfa1a95f6b2e677ab985cd1af2eae35d62e0f6"
}
},
"symfony/web-server-bundle": {
"version": "3.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "3.3",
"ref": "dae9b39fd6717970be7601101ce5aa960bf53d9a"
}
},
"symfony/yaml": {
"version": "v4.1.7"
},
"twig/extra-bundle": {
"version": "v3.0.5"
},
"twig/twig": {
"version": "v2.5.0"
},

@ -2,18 +2,14 @@
namespace App\Tests\Controller;
use Symfony\Component\BrowserKit\Client;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
class ClientRequestBuilder
{
/**
*
* @var Client
*/
private $client;
protected KernelBrowser $client;
/**
*
* @var string
@ -44,7 +40,7 @@ class ClientRequestBuilder
*/
private $acceptType;
public function __construct(Client $client)
public function __construct(KernelBrowser $client)
{
$this->client = $client;
$this->parameters = [];
@ -52,7 +48,7 @@ class ClientRequestBuilder
$this->acceptType = 'application/json';
}
public static function create(Client $client): ClientRequestBuilder
public static function create(KernelBrowser $client): ClientRequestBuilder
{
return new ClientRequestBuilder($client);
}

@ -5,16 +5,13 @@ namespace App\Tests\Controller;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Client;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
class RestTestBase extends WebTestCase
{
/**
* @var Client
*/
protected $client;
protected KernelBrowser $client;
protected function setUp()
{

@ -15,7 +15,7 @@ class UserControllerTest extends RestTestBase
->setMethod('GET')
->setUri('/api/users')
->setAcceptType('application/json')
->addServerParameter('HTTP_X-AUTH-TOKEN', UserFixtures::ADMIN_USER_TOKEN)
->addServerParameter('HTTP_X-AUTH-TOKEN', UserFixtures::ADMIN_USER_REFERENCE)
->request();
$response = $this->client->getResponse();

Loading…
Cancel
Save