Bonjour,
Je souhaite créer des entités mais le contenu :
- doit être internationalisé pour certains champs
- j'utilise aussi fosuserbundle donc les tables doivent pouvoir être administrées
- l'utilisateur lambda connecté peut créer et est propriétaire de certains enregs

les tables
category (id, name) // name doit être internationalisable
article (id,name, created_at, updated_at, active, startingdate, endingdate, price) // name doit être internationalisable, que faut-il faire aussi pour attacher l'utilisateur fosuserbundle
rubrique (id, name) // name doit être internationalisable

il doit exister 2 autres tables car
- un article peut être rattaché à plusieurs catégories (par d'internationalisation)
- un utilisateur créé un article mais saisit le contenu des rubriques dans différentes langues
ex : contentrubrique (id, langue_id, rubrique_id, content,active)
et donc pour ce cas il faut peut être une table langue (id, langue)

le format sera en yml pour doctrine
Merci de votre aide

category.php
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
 
<?php
namespace MyApp\ProjetBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
 
/**
 * @ORM\Entity
 */
class Category 
{
    /**
     * @ORM\GeneratedValue
     * @ORM\Id
     * @ORM\Column(type="integer")
     */
    private $id;
 
    /**
     * @ORM\Column(type="string",length="255")
     * @Assert\NotBlank()
     * @Assert\MinLength(3)
     */    
    private $name;
}

article.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
<?php
namespace MyApp\ProjetBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
 
/**
 * @ORM\Entity
 */
class Article
{
    /**
     * @ORM\GeneratedValue
     * @ORM\Id
     * @ORM\Column(type="integer")
     */
    private $id;
 
    /**
     * @ORM\Column(type="string",length="255")
     * @Assert\NotBlank()
     * @Assert\MinLength(3)
     */    
    private $name;
 
 
    /**
     * @ORM\Column(type="date")
     * @Assert\NotBlank()
     */    
    private $startingdate;
 
 
    /**
     * @ORM\Column(type="date")
     * @Assert\NotBlank()
     */    
    private $endingdate;
 
    /**
     * @ORM\Column(type="string",length="1")
     * @Assert\NotBlank()
     * @Assert\Choice(choices = {"1", "0"})
     */    
    private $active;
 
 /**
     * @var decimal $price
     *
     * @ORM\Column(name="price", type="decimal", length="7", scale="2")
     */
    private $price;
 
 
 
/**
     * @Gedmo\Timestampable(on="create")
     * @ORM\Column(name="created_at", type="datetime")
     */
    private $createdAt;
 
/**
     * @Gedmo\Timestampable(on="update")
     * @ORM\Column(name="updated_at", type="datetime")
     */
    private $updatedAt;
 
    /**
     * @ORM\ManyToMany(targetEntity="Category")
     * @Assert\NotBlank()
     */    
    private $category;
}
rubrique.php
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
 
<?php
namespace MyApp\ProjetBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
 
/**
 * @ORM\Entity
 */
class Rubrique 
{
    /**
     * @ORM\GeneratedValue
     * @ORM\Id
     * @ORM\Column(type="integer")
     */
    private $id;
 
    /**
     * @ORM\Column(type="string",length="255")
     * @Assert\NotBlank()
     * @Assert\MinLength(3)
     */    
    private $name;
}
langue.php
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
 
<?php
namespace MyApp\ProjetBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
 
/**
 * @ORM\Entity
 */
class Langue
{
    /**
     * @ORM\GeneratedValue
     * @ORM\Id
     * @ORM\Column(type="integer")
     */
    private $id;
 
    /**
     * @ORM\Column(type="string",length="255")
     * @Assert\NotBlank()
     * @Assert\MinLength(3)
     */    
    private $name;
}

contentrubrique.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
<?php
namespace MyApp\ProjetBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
 
/**
 * @ORM\Entity
 */
class contentrubrique
{
    /**
     * @ORM\GeneratedValue
     * @ORM\Id
     * @ORM\Column(type="integer")
     */
    private $id;
 
    /**
     * @ORM\Column(type="string",length="255")
     * @Assert\NotBlank()
     * @Assert\MinLength(3)
     */    
    private $name;
 
 
 
    /**
     * @ORM\Column(type="string",length="1")
     * @Assert\NotBlank()
     * @Assert\Choice(choices = {"1", "0"})
     */    
    private $active;
 
    /**
     * @ORM\Column(name="content", type="text", nullable="true")
     */
    private $content;
 
    /**
     * @ORM\ManyToOne(targetEntity="Langue")
     * @Assert\NotBlank()
     */    
    private $langue;
 
    /**
     * @ORM\ManyToOne(targetEntity="Rubrique")
     * @Assert\NotBlank()
     */    
    private $rubrique;
je ne sais pas si les déclarations sont bonnes
ex : * @ORM\ManyToOne(targetEntity="Rubrique") si il ne faut pas un ManyToMany

et comment mettre en place la partie internationalisation de certains champs ainsi que le point sur le fosuser

Merci de votre aide