Browse Source

Rlations entre User et Tag (relation porteuse pas encore écrite)

bastien 13 years ago
parent
commit
7e2c342238
4 changed files with 8375 additions and 47 deletions
  1. 1 0
      app/autoload.php
  2. 8270 0
      app/logs/dev.log
  3. 72 45
      src/Muzich/CoreBundle/Entity/Tag.php
  4. 32 2
      src/Muzich/UserBundle/Entity/User.php

+ 1 - 0
app/autoload.php View File

@@ -15,6 +15,7 @@ $loader->registerNamespaces(array(
15 15
     'Assetic'          => __DIR__.'/../vendor/assetic/src',
16 16
     'Metadata'         => __DIR__.'/../vendor/metadata/src',
17 17
     'FOS'              => __DIR__.'/../vendor/bundles',
18
+    'Muzich'           => __DIR__.'/../vendor/src',
18 19
 ));
19 20
 $loader->registerPrefixes(array(
20 21
     'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',

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


+ 72 - 45
src/Muzich/CoreBundle/Entity/Tag.php View File

@@ -17,6 +17,11 @@ class Tag
17 17
   protected $elements;
18 18
   
19 19
   /**
20
+   * @ORM\ManyToMany(targetEntity="Muzich\UserBundle\Entity\User", mappedBy="tags_favorites")
21
+   */
22
+  protected $users_favorites;
23
+  
24
+  /**
20 25
    * @ORM\Id
21 26
    * @ORM\Column(type="integer")
22 27
    * @ORM\GeneratedValue(strategy="AUTO")
@@ -32,57 +37,79 @@ class Tag
32 37
   
33 38
   public function __construct()
34 39
   {
40
+    $this->users_favorites = new \Doctrine\Common\Collections\ArrayCollection();
35 41
     $this->elements = new \Doctrine\Common\Collections\ArrayCollection();
36 42
   }
37 43
   
38 44
 
39
-    /**
40
-     * Get id
41
-     *
42
-     * @return integer 
43
-     */
44
-    public function getId()
45
-    {
46
-        return $this->id;
47
-    }
45
+  /**
46
+   * Get id
47
+   *
48
+   * @return integer 
49
+   */
50
+  public function getId()
51
+  {
52
+      return $this->id;
53
+  }
48 54
 
49
-    /**
50
-     * Set name
51
-     *
52
-     * @param string $name
53
-     */
54
-    public function setName($name)
55
-    {
56
-        $this->name = $name;
57
-    }
55
+  /**
56
+   * Set name
57
+   *
58
+   * @param string $name
59
+   */
60
+  public function setName($name)
61
+  {
62
+      $this->name = $name;
63
+  }
58 64
 
59
-    /**
60
-     * Get name
61
-     *
62
-     * @return string 
63
-     */
64
-    public function getName()
65
-    {
66
-        return $this->name;
67
-    }
65
+  /**
66
+   * Get name
67
+   *
68
+   * @return string 
69
+   */
70
+  public function getName()
71
+  {
72
+      return $this->name;
73
+  }
68 74
 
69
-    /**
70
-     * Add elements
71
-     *
72
-     * @param Muzich\CoreBundle\Entity\Tag $elements
73
-     */
74
-    public function addTag(\Muzich\CoreBundle\Entity\Tag $elements)
75
-    {
76
-        $this->elements[] = $elements;
77
-    }
75
+  /**
76
+   * Add elements
77
+   *
78
+   * @param Muzich\CoreBundle\Entity\Tag $elements
79
+   */
80
+  public function addTag(Muzich\CoreBundle\Entity\Tag $elements)
81
+  {
82
+      $this->elements[] = $elements;
83
+  }
84
+
85
+  /**
86
+   * Get elements
87
+   *
88
+   * @return Doctrine\Common\Collections\Collection 
89
+   */
90
+  public function getElements()
91
+  {
92
+      return $this->elements;
93
+  }
94
+
95
+  /**
96
+   * Add users_favorites
97
+   *
98
+   * @param Muzich\UserBundle\Entity\User $usersFavorites
99
+   */
100
+  public function addUser(Muzich\UserBundle\Entity\User $usersFavorites)
101
+  {
102
+      $this->users_favorites[] = $usersFavorites;
103
+  }
78 104
 
79
-    /**
80
-     * Get elements
81
-     *
82
-     * @return Doctrine\Common\Collections\Collection 
83
-     */
84
-    public function getElements()
85
-    {
86
-        return $this->elements;
87
-    }
105
+  /**
106
+   * Get users_favorites
107
+   *
108
+   * @return Doctrine\Common\Collections\Collection 
109
+   */
110
+  public function getUsersFavorites()
111
+  {
112
+      return $this->users_favorites;
113
+  }
114
+    
88 115
 }

+ 32 - 2
src/Muzich/UserBundle/Entity/User.php View File

@@ -1,6 +1,7 @@
1 1
 <?php
2 2
 
3 3
 namespace Muzich\UserBundle\Entity;
4
+
4 5
 use FOS\UserBundle\Entity\User as BaseUser;
5 6
 use Doctrine\ORM\Mapping as ORM;
6 7
 
@@ -10,7 +11,14 @@ use Doctrine\ORM\Mapping as ORM;
10 11
  */
11 12
 class User extends BaseUser
12 13
 {
14
+  
13 15
   /**
16
+   * @ORM\ManyToMany(targetEntity="Muzich\CoreBundle\Entity\Tag", inversedBy="users_favorites")
17
+   * @ORM\JoinTable(name="users_tags_favorites")
18
+   */
19
+  private $tags_favorites;
20
+  
21
+ /**
14 22
   * @ORM\Id
15 23
   * @ORM\Column(type="integer")
16 24
   * @ORM\generatedValue(strategy="AUTO")
@@ -19,7 +27,8 @@ class User extends BaseUser
19 27
 
20 28
   public function __construct()
21 29
   {
22
-      parent::__construct();
30
+    $this->tags_favorites = new \Doctrine\Common\Collections\ArrayCollection();
31
+    parent::__construct();
23 32
   }
24 33
 
25 34
   /**
@@ -29,7 +38,28 @@ class User extends BaseUser
29 38
    */
30 39
   public function getId()
31 40
   {
32
-      return $this->id;
41
+    return $this->id;
42
+  }
43
+  
44
+
45
+  /**
46
+   * Add tags_favorites
47
+   *
48
+   * @param Muzich\UserBundle\Entity\Tag $tagsFavorites
49
+   */
50
+  public function addTag(\Muzich\UserBundle\Entity\Tag $tagsFavorites)
51
+  {
52
+      $this->tags_favorites[] = $tagsFavorites;
53
+  }
54
+
55
+  /**
56
+   * Get tags_favorites
57
+   *
58
+   * @return Doctrine\Common\Collections\Collection 
59
+   */
60
+  public function getTagsFavorites()
61
+  {
62
+      return $this->tags_favorites;
33 63
   }
34 64
   
35 65
 }