E
E
Edward2017-04-03 19:36:23
symfony
Edward, 2017-04-03 19:36:23

How to connect your User Provider?

I did it like here , but I don’t know how to connect to Silex. Or is it done differently for him? Where can I see an example specifically for Silex? There is SimpleUser, but as I understand it is not supported in new versions
#UPD I managed to connect SimpleUser, did everything according to the instructions, only Silex does not see namaspace, what's the problem?

use Silex\Application;
use Silex\Provider;
use Silex\Provider\AssetServiceProvider;
use Silex\Provider\TwigServiceProvider;
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\Provider\HttpFragmentServiceProvider;
use Silex\Provider\FormServiceProvider;
use Silex\Provider\DoctrineServiceProvider;

$app = new Application();
$app->register(new ServiceControllerServiceProvider());
$app->register(new AssetServiceProvider());
$app->register(new TwigServiceProvider());
$app->register(new HttpFragmentServiceProvider());
$app->register(new FormServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());
$app->register(new Silex\Provider\LocaleServiceProvider());
$app->register(new \Devture\SilexProvider\Config\ServicesProvider());
$app->register(new Silex\Provider\SessionServiceProvider());
$userServiceProvider = new SimpleUser\UserServiceProvider();
$app->register($userServiceProvider);

$app['security.firewalls'] = array(
    'secured_area' => array(
        'pattern' => '^.*$',
        'anonymous' => true,
        'remember_me' => array(),
        'form' => array(
            'login_path' => '/user/login',
            'check_path' => '/user/login_check',
        ),
        'logout' => array(
            'logout_path' => '/user/logout',
        ),
        'users' => $app->share(function($app) { return $app['user.manager']; }),
    ),
);
$app->mount('/user', $userServiceProvider);

Result:
WCk3p.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question