This bundle adds the possibility to use the FOSUserBundle with the users provided from a Neo4j Graph DB.
The bundle adds a custom storage layer to the FOSUserBundle for Neo4j and provides such a Security Provider for Symfony.
{
"require":{
...,
"kwattro/neo4j-user-bundle": "*"
}
}
public function registerBundles()
{
$bundles = array(
...,
new FOS\UserBundle\FOSUserBundle(),
new Kwattro\Neo4j\UserBundle\KwattroNeo4jUserBundle(),
);
Your Custom User class must extends the Neo4j User Model
//Acme/DemoBundle/Entity/User.php
<?php
namespace Acme\DemoBundle\Entity;
use HireVoice\Neo4j\Annotation as OGM;
use Doctrine\Common\Collections\ArrayCollection;
use Kwattro\Neo4j\UserBundle\Node\User as BaseUser;
/**
* All entity classes must be declared as such.
*
* @OGM\Entity
*/
class User extends BaseUser
{
/**
* The internal node ID from Neo4j must be stored. Thus an Auto field is required
* @OGM\Auto
*/
protected $id;
}
// app/config/config.yml
fos_user:
db_driver: custom
user_class: Acme\DemoBundle\Entity\User
service:
user_manager: kwattro_neo4j_user.manager
firewall_name: main
Configure it in accordance with the FOSUserBundle documentation, the only change is that you need to specify the security provider with the one provided by the Neo4jUserBundle
security:
providers:
fos_userbundle:
id: kwattro_neo4j_user.user_provider.username
Adds the routes in accordance with the FOSUserBundle documentation at Step6