Browse Source

As relations entre Group et les Tags

bastien 12 years ago
parent
commit
156e7d0c70

File diff suppressed because it is too large
+ 1183 - 0
app/logs/dev.log


+ 28 - 0
src/Muzich/CoreBundle/Entity/Group.php View File

@@ -57,6 +57,14 @@ class Group
57 57
    * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
58 58
    */
59 59
   protected $owner;
60
+  
61
+  /**
62
+   * Cet attribut contient les enregistrements GroupsTagsFavorites lié 
63
+   * a ce Groupe dans le cadre des tags de groupe.
64
+   * 
65
+   * @ORM\OneToMany(targetEntity="GroupsTagsFavorites", mappedBy="group")
66
+   */
67
+  protected $tags;
60 68
 
61 69
   /**
62 70
    * 
@@ -156,4 +164,24 @@ class Group
156 164
   {
157 165
       return $this->owner;
158 166
   }
167
+
168
+  /**
169
+   * Add tags
170
+   *
171
+   * @param GroupsTagsFavorites $tags
172
+   */
173
+  public function addGroupsTagsFavorites(GroupsTagsFavorites $tags)
174
+  {
175
+    $this->tags[] = $tags;
176
+  }
177
+
178
+  /**
179
+   * Get tags
180
+   *
181
+   * @return Doctrine\Common\Collections\Collection 
182
+   */
183
+  public function getTags()
184
+  {
185
+    return $this->tags;
186
+  }
159 187
 }

+ 121 - 0
src/Muzich/CoreBundle/Entity/GroupsTagsFavorites.php View File

@@ -0,0 +1,121 @@
1
+<?php
2
+
3
+namespace Muzich\CoreBundle\Entity;
4
+
5
+use Doctrine\ORM\Mapping as ORM;
6
+
7
+/**
8
+ * Cette classe représente la relation porteuse entre Group et Tag, 
9
+ * en tant que Tags favoris du groupe.
10
+ * 
11
+ * @ORM\Entity
12
+ * @ORM\Table(name="groups_tags_favorites")
13
+ */
14
+class GroupsTagsFavorites
15
+{
16
+  
17
+  /**
18
+   * @ORM\Id
19
+   * @ORM\Column(type="integer")
20
+   * @ORM\GeneratedValue(strategy="AUTO")
21
+   * @var type int
22
+   */
23
+  protected $id;
24
+  
25
+  /**
26
+   * Cet attribut contient l'objet Group lié
27
+   * 
28
+   * @ORM\ManyToOne(targetEntity="Group", inversedBy="tags")
29
+   * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
30
+   */
31
+  protected $group;
32
+  
33
+  /**
34
+   * Cet attribut contient l'objet Tag lié
35
+   * 
36
+   * @ORM\ManyToOne(targetEntity="Tag", inversedBy="groups")
37
+   * @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
38
+   */
39
+  protected $tag;
40
+  
41
+  /**
42
+   * L'attribut position permet de connaitre l'ordre de préfèrence du 
43
+   * groupe.
44
+   * 
45
+   * @ORM\Column(type="integer")
46
+   * @var type int
47
+   */
48
+  protected $position;
49
+    
50
+
51
+  /**
52
+   * Set position
53
+   *
54
+   * @param integer $position
55
+   */
56
+  public function setPosition($position)
57
+  {
58
+      $this->position = $position;
59
+  }
60
+
61
+  /**
62
+   * Get position
63
+   *
64
+   * @return integer 
65
+   */
66
+  public function getPosition()
67
+  {
68
+      return $this->position;
69
+  }
70
+  
71
+
72
+  /**
73
+   * Get id
74
+   *
75
+   * @return integer 
76
+   */
77
+  public function getId()
78
+  {
79
+      return $this->id;
80
+  }
81
+
82
+  /**
83
+   * Set group
84
+   *
85
+   * @param Group $group
86
+   */
87
+  public function setGroup(Group $group)
88
+  {
89
+    $this->group = $group;
90
+  }
91
+
92
+  /**
93
+   * Get group
94
+   *
95
+   * @return Group 
96
+   */
97
+  public function getGroup()
98
+  {
99
+    return $this->group;
100
+  }
101
+
102
+  /**
103
+   * Set tag
104
+   *
105
+   * @param Tag $tag
106
+   */
107
+  public function setTag(Tag $tag)
108
+  {
109
+    $this->tag = $tag;
110
+  }
111
+
112
+  /**
113
+   * Get tag
114
+   *
115
+   * @return Tag 
116
+   */
117
+  public function getTag()
118
+  {
119
+    return $this->tag;
120
+  }
121
+}

+ 65 - 37
src/Muzich/CoreBundle/Entity/Tag.php View File

@@ -31,11 +31,20 @@ class Tag
31 31
   
32 32
   /**
33 33
    * Cet attribu stocke les enregistrements UsersTagsFavorites liés
34
-   * a ce Tag dans le cadre des Tags favoris.
34
+   * a ce Tag dans le cadre des Tags favoris de l'user.
35 35
    * 
36 36
    * @ORM\OneToMany(targetEntity="UsersTagsFavorites", mappedBy="tag")
37 37
    */
38 38
   protected $users_favorites;
39
+  
40
+  /**
41
+   * Cet attribu stocke les enregistrements GroupsTagsFavorites liés
42
+   * a ce Tag dans le cadre des Tags favoris du groupe.
43
+   * 
44
+   * @ORM\OneToMany(targetEntity="GroupsTagsFavorites", mappedBy="tag")
45
+   */
46
+  protected $groups_favorites;
47
+  
39 48
   /**
40 49
    * Nom du tag
41 50
    * 
@@ -84,44 +93,63 @@ class Tag
84 93
       return $this->name;
85 94
   }
86 95
 
96
+  /**
97
+   * Add elements
98
+   *
99
+   * @param Element $elements
100
+   */
101
+  public function addElement(Element $elements)
102
+  {
103
+    $this->elements[] = $elements;
104
+  }
105
+
106
+  /**
107
+   * Get elements
108
+   *
109
+   * @return Doctrine\Common\Collections\Collection 
110
+   */
111
+  public function getElements()
112
+  {
113
+    return $this->elements;
114
+  }
87 115
 
88
-    /**
89
-     * Add elements
90
-     *
91
-     * @param Element $elements
92
-     */
93
-    public function addElement(Element $elements)
94
-    {
95
-        $this->elements[] = $elements;
96
-    }
116
+  /**
117
+   * Add users_favorites
118
+   *
119
+   * @param UsersTagsFavorites $usersFavorites
120
+   */
121
+  public function addUsersTagsFavorites(UsersTagsFavorites $usersFavorites)
122
+  {
123
+    $this->users_favorites[] = $usersFavorites;
124
+  }
97 125
 
98
-    /**
99
-     * Get elements
100
-     *
101
-     * @return Doctrine\Common\Collections\Collection 
102
-     */
103
-    public function getElements()
104
-    {
105
-        return $this->elements;
106
-    }
126
+  /**
127
+   * Get users_favorites
128
+   *
129
+   * @return Doctrine\Common\Collections\Collection 
130
+   */
131
+  public function getUsersFavorites()
132
+  {
133
+    return $this->users_favorites;
134
+  }
107 135
 
108
-    /**
109
-     * Add users_favorites
110
-     *
111
-     * @param UsersTagsFavorites $usersFavorites
112
-     */
113
-    public function addUsersTagsFavorites(UsersTagsFavorites $usersFavorites)
114
-    {
115
-        $this->users_favorites[] = $usersFavorites;
116
-    }
136
+  /**
137
+   * Add groups_favorites
138
+   *
139
+   * @param GroupsTagsFavorites $groupsFavorites
140
+   */
141
+  public function addGroupsTagsFavorites(GroupsTagsFavorites $groupsFavorites)
142
+  {
143
+    $this->groups_favorites[] = $groupsFavorites;
144
+  }
117 145
 
118
-    /**
119
-     * Get users_favorites
120
-     *
121
-     * @return Doctrine\Common\Collections\Collection 
122
-     */
123
-    public function getUsersFavorites()
124
-    {
125
-        return $this->users_favorites;
126
-    }
146
+  /**
147
+   * Get groups_favorites
148
+   *
149
+   * @return Doctrine\Common\Collections\Collection 
150
+   */
151
+  public function getGroupsFavorites()
152
+  {
153
+    return $this->groups_favorites;
154
+  }
127 155
 }