Commit 5148ae57 authored by Mat's avatar Mat

suis la procédure de FOSUserBundle pour mettre en place les groupes (roles)

* voir https://symfony.com/doc/2.0.x/bundles/FOSUserBundle/groups.html
* $ php bin/console doctrine:generate:entities TechnoBundle:User
--no-backup
* $ php bin/console doctrine:generate:entities TechnoBundle:Group
--no-backup
* $ php bin/console doctrine:schema:update --dump-sql --complete
* $ php bin/console doctrine:schema:update --force
parent 2aeff919
......@@ -83,6 +83,8 @@ fos_user:
db_driver: orm
firewall_name: main
user_class: TechnoBundle\Entity\User
group:
group_class: TechnoBundle\Entity\Group
from_email:
address: mat@collectifs.net
sender_name: admin
......@@ -34,3 +34,7 @@ fos_user_resetting:
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
fos_user_group:
resource: "@FOSUserBundle/Resources/config/routing/group.xml"
prefix: /group
<?php
namespace TechnoBundle\Entity;
use FOS\UserBundle\Model\Group as BaseGroup;
use Doctrine\ORM\Mapping as ORM;
/**
* Group
*
* @ORM\Entity
* @ORM\Table(name="fosgroup")
*/
class Group extends BaseGroup
{
/**
* @var int
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
}
......@@ -22,6 +22,15 @@ class User extends BaseUser
*/
protected $id;
/**
* @ORM\ManyToMany(targetEntity="TechnoBundle\Entity\Group")
* @ORM\JoinTable(name="fosuser_fosgroup",
* joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")}
* )
*/
protected $groups;
/**
* Get id
......
<?php
namespace TechnoBundle\Repository;
/**
* GroupRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class GroupRepository extends \Doctrine\ORM\EntityRepository
{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment