DigitalState User Bundle

0.3.0 2017-02-21 00:36 UTC

This package is not auto-updated.

Last update: 2024-06-08 18:16:32 UTC


The User bundle extends the OroUserBundle and provides the developers additional core user functionality.

Code Climate Test Coverage

Table of Contents

Data Resolvers

This bundle introduces another type of data resolver based on current session data, instead of the database.



namespace Gov\Bundle\DemoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DemoController extends Controller
    public function demoAction()
        $data = $this->get('');
        $username = $data->resolve('ds.session.user.username');

A typical use case would be when you wish to pre-populate a form with session data.



namespace Gov\Bundle\DemoBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class DemoType extends AbstractType
    public function buildForm(FormBuilderInterface $builder, array $options)
        $builder->add('username', 'text', [
            'data' => 'ds.session.user.username',
            'resolve' => true

Migration Extensions

This bundle introduces a collection of convenient migration extensions to help with loading yml-based data fixtures.



namespace Gov\Bundle\DemoBundle\Migrations\Data\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Ds\Bundle\UserBundle\Migration\Extension\UserExtensionAwareInterface;
use Ds\Bundle\UserBundle\Migration\Extension\UserExtensionAwareTrait;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Doctrine\Common\Persistence\ObjectManager;

class LoadUserData extends AbstractFixture implements UserExtensionAwareInterface, ContainerAwareInterface
    use UserExtensionAwareTrait;
    use ContainerAwareTrait;

    public function load(ObjectManager $manager)
        // Currently extensions are not automatically injected via the *AwareInterface.
        $resource = __DIR__.'/../../../Resources/data/users.yml';
        $this->userExtension->import($resource, $manager);
        username: john
        password: john
        roles: [ ROLE_USER ]
        first_name: John
        last_name: Doe

    email: ~
    roles: []
    first_name: ~
    last_name: ~
    owner: main
    business_units: [ main ]
    organization: default
    organizations: [ default ]
    enabled: true