bonjour,

dans ma bdd j'ai une table gpUser et gpModule qui sont lié en relation many to many dans la table associative (gp_dtAcces) de ces deux tables j'ai un champ numdTacces qui me permet de définir les d'acces d'un utilisateur à un module.
ma table gpmodule
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
public function setTableDefinition()
    {
        $this->setTableName('gp_module');
        $this->hasColumn('id', 'integer', 4, array(
             'type' => 'integer',
             'fixed' => 0,
             'unsigned' => false,
             'primary' => true,
             'autoincrement' => true,
             'length' => '4',
             ));
 
 $this->hasMany('GpUser', array(
                'local' => 'GPModule_id',
                'foreign' => 'GPUser_id',
                'refClass' => 'GpDtacces'));
ma table gpuser
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
 public function setTableDefinition()
    {
        $this->setTableName('gp_user');
        $this->hasColumn('id', 'integer', 4, array(
             'type' => 'integer',
             'fixed' => 0,
             'unsigned' => false,
             'primary' => true,
             'autoincrement' => true,
             'length' => '4',
             ));
...
$this->hasMany('GpModule', array(
                'local' => 'GPUser_id',
                'foreign' => 'GPModule_id',
                'refClass' => 'GpDtacces'));
ma table associative.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
public function setTableDefinition()
    {
        $this->setTableName('gp_dtAcces');
        $this->hasColumn('GPUser_id', 'integer', 4, array(
             'type' => 'integer',
             'fixed' => 0,
             'unsigned' => false,
             'primary' => true,
             'autoincrement' => false,
             'length' => '4',
             ));
        $this->hasColumn('GPModule_id', 'integer', 4, array(
             'type' => 'integer',
             'fixed' => 0,
             'unsigned' => false,
             'primary' => true,
             'autoincrement' => false,
             'length' => '4',
             ));
        $this->hasColumn('numDtAcces', 'integer', 4, array(
             'type' => 'integer',
             'fixed' => 0,
             'unsigned' => false,
             'primary' => false,
             'notnull' => true,
             'autoincrement' => false,
             'length' => '4',
             ));
    }

ma question étant dans doctrine comment fait on pour définir les droits d'accès d'un user à un module depuis un user par exemple ?