Browse Source

A la relation entre l'Element et le Group.

bastien 13 years ago
parent
commit
329300aa9c
2 changed files with 56 additions and 0 deletions
  1. 28 0
      src/Muzich/CoreBundle/Entity/Element.php
  2. 28 0
      src/Muzich/CoreBundle/Entity/Group.php

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

47
    * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
47
    * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
48
    */
48
    */
49
   protected $owner;
49
   protected $owner;
50
+
51
+  /**
52
+   * Groupe de l'élément
53
+   * 
54
+   * @ORM\ManyToOne(targetEntity="Group", inversedBy="elements")
55
+   * @ORM\JoinColumn(name="group_id", referencedColumnName="id")
56
+   */
57
+  protected $group = null;
50
   
58
   
51
   /**
59
   /**
52
    * Cet attribu stocke les enregistrements UsersElementsFavorites liés
60
    * Cet attribu stocke les enregistrements UsersElementsFavorites liés
237
   {
245
   {
238
       return $this->elements_favorites;
246
       return $this->elements_favorites;
239
   }
247
   }
248
+
249
+  /**
250
+   * Set group
251
+   *
252
+   * @param Group $group
253
+   */
254
+  public function setGroup(Group $group)
255
+  {
256
+      $this->group = $group;
257
+  }
258
+
259
+  /**
260
+   * Get group
261
+   *
262
+   * @return Group 
263
+   */
264
+  public function getGroup()
265
+  {
266
+      return $this->group;
267
+  }
240
 }
268
 }

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

65
    * @ORM\OneToMany(targetEntity="GroupsTagsFavorites", mappedBy="group")
65
    * @ORM\OneToMany(targetEntity="GroupsTagsFavorites", mappedBy="group")
66
    */
66
    */
67
   protected $tags;
67
   protected $tags;
68
+  
69
+  /**
70
+   * Cet attribut contient les enregistrements Element lié 
71
+   * a ce Groupe.
72
+   * 
73
+   * @ORM\OneToMany(targetEntity="Element", mappedBy="group")
74
+   */
75
+  protected $elements;
68
 
76
 
69
   /**
77
   /**
70
    * 
78
    * 
184
   {
192
   {
185
     return $this->tags;
193
     return $this->tags;
186
   }
194
   }
195
+
196
+  /**
197
+   * Add elements
198
+   *
199
+   * @param Element $elements
200
+   */
201
+  public function addElement(Element $elements)
202
+  {
203
+      $this->elements[] = $elements;
204
+  }
205
+
206
+  /**
207
+   * Get elements
208
+   *
209
+   * @return Doctrine\Common\Collections\Collection 
210
+   */
211
+  public function getElements()
212
+  {
213
+      return $this->elements;
214
+  }
187
 }
215
 }