Browse Source

Modification des relations entre User et Tag:

bastien 13 years ago
parent
commit
90e409e46b

+ 1 - 1
app/autoload.php View File

@@ -15,7 +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
+    //'Muzich'           => __DIR__.'/../vendor/src',
19 19
 ));
20 20
 $loader->registerPrefixes(array(
21 21
     'Twig_Extensions_' => __DIR__.'/../vendor/twig-extensions/lib',

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


+ 11 - 1
src/Muzich/CoreBundle/Entity/Tag.php View File

@@ -17,7 +17,7 @@ class Tag
17 17
   protected $elements;
18 18
   
19 19
   /**
20
-   * @ORM\ManyToMany(targetEntity="Muzich\UserBundle\Entity\User", mappedBy="tags_favorites")
20
+   * @ORM\OneToMany(targetEntity="Muzich\CoreBundle\Entity\UsersTagsFavorites", mappedBy="tags_favorites")
21 21
    */
22 22
   protected $users_favorites;
23 23
   
@@ -112,4 +112,14 @@ class Tag
112 112
       return $this->users_favorites;
113 113
   }
114 114
     
115
+
116
+    /**
117
+     * Add users_favorites
118
+     *
119
+     * @param Muzich\CoreBundle\Entity\UsersTagsFavorites $usersFavorites
120
+     */
121
+    public function addUsersTagsFavorites(Muzich\CoreBundle\Entity\UsersTagsFavorites $usersFavorites)
122
+    {
123
+        $this->users_favorites[] = $usersFavorites;
124
+    }
115 125
 }

+ 102 - 0
src/Muzich/CoreBundle/Entity/UsersTagsFavorites.php View File

@@ -0,0 +1,102 @@
1
+<?php
2
+
3
+namespace Muzich\CoreBundle\Entity;
4
+
5
+use Doctrine\ORM\Mapping as ORM;
6
+
7
+/**
8
+ * @ORM\Entity
9
+ * @ORM\Table(name="users_tags_favorites")
10
+ */
11
+class UsersTagsFavorites
12
+{
13
+  
14
+  /**
15
+   * @ORM\ManyToOne(targetEntity="Muzich\UserBundle\Entity\User", inversedBy="tags_favorites")
16
+   * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
17
+   */
18
+  protected $users_favorites;
19
+  
20
+  /**
21
+   * @ORM\ManyToOne(targetEntity="Muzich\CoreBundle\Entity\Tag", inversedBy="users_favorites")
22
+   * @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
23
+   */
24
+  protected $tags_favorites;
25
+  
26
+  
27
+  /**
28
+   * @ORM\Id
29
+   * @ORM\Column(type="integer")
30
+   * @ORM\GeneratedValue(strategy="AUTO")
31
+   * @var type int
32
+   */
33
+  protected $id;
34
+  
35
+  /**
36
+   * @ORM\Column(type="integer")
37
+   * @var type int
38
+   */
39
+  protected $position;
40
+    
41
+
42
+  /**
43
+   * Set position
44
+   *
45
+   * @param integer $position
46
+   */
47
+  public function setPosition($position)
48
+  {
49
+      $this->position = $position;
50
+  }
51
+
52
+  /**
53
+   * Get position
54
+   *
55
+   * @return integer 
56
+   */
57
+  public function getPosition()
58
+  {
59
+      return $this->position;
60
+  }
61
+
62
+  /**
63
+   * Set users_favorites
64
+   *
65
+   * @param Muzich\UserBundle\Entity\User $usersFavorites
66
+   */
67
+  public function setUsersFavorites(Muzich\UserBundle\Entity\User $usersFavorites)
68
+  {
69
+      $this->users_favorites = $usersFavorites;
70
+  }
71
+
72
+  /**
73
+   * Get users_favorites
74
+   *
75
+   * @return \Muzich\UserBundle\Entity\User 
76
+   */
77
+  public function getUsersFavorites()
78
+  {
79
+      return $this->users_favorites;
80
+  }
81
+
82
+  /**
83
+   * Set tags_favorites
84
+   *
85
+   * @param Muzich\CoreBundle\Entity\Tag $tagsFavorites
86
+   */
87
+  public function setTagsFavorites(Muzich\CoreBundle\Entity\Tag $tagsFavorites)
88
+  {
89
+      $this->tags_favorites = $tagsFavorites;
90
+  }
91
+
92
+  /**
93
+   * Get tags_favorites
94
+   *
95
+   * @return Muzich\CoreBundle\Entity\Tag 
96
+   */
97
+  public function getTagsFavorites()
98
+  {
99
+      return $this->tags_favorites;
100
+  }
101
+  
102
+}

+ 13 - 4
src/Muzich/UserBundle/Entity/User.php View File

@@ -13,8 +13,7 @@ class User extends BaseUser
13 13
 {
14 14
   
15 15
   /**
16
-   * @ORM\ManyToMany(targetEntity="Muzich\CoreBundle\Entity\Tag", inversedBy="users_favorites")
17
-   * @ORM\JoinTable(name="users_tags_favorites")
16
+   * @ORM\OneToMany(targetEntity="Muzich\CoreBundle\Entity\UsersTagsFavorites", mappedBy="users_favorites")
18 17
    */
19 18
   private $tags_favorites;
20 19
   
@@ -27,7 +26,7 @@ class User extends BaseUser
27 26
 
28 27
   public function __construct()
29 28
   {
30
-    $this->tags_favorites = new \Doctrine\Common\Collections\ArrayCollection();
29
+    $this->tags_favorites = new Doctrine\Common\Collections\ArrayCollection();
31 30
     parent::__construct();
32 31
   }
33 32
 
@@ -47,7 +46,7 @@ class User extends BaseUser
47 46
    *
48 47
    * @param Muzich\UserBundle\Entity\Tag $tagsFavorites
49 48
    */
50
-  public function addTag(\Muzich\UserBundle\Entity\Tag $tagsFavorites)
49
+  public function addTag(Muzich\CoreBundle\Entity\UsersTagsFavorites $tagsFavorites)
51 50
   {
52 51
       $this->tags_favorites[] = $tagsFavorites;
53 52
   }
@@ -62,4 +61,14 @@ class User extends BaseUser
62 61
       return $this->tags_favorites;
63 62
   }
64 63
   
64
+
65
+  /**
66
+   * Add tags_favorites
67
+   *
68
+   * @param Muzich\CoreBundle\Entity\UsersTagsFavorites $tagsFavorites
69
+   */
70
+  public function addUsersTagsFavorites(Muzich\CoreBundle\Entity\UsersTagsFavorites $tagsFavorites)
71
+  {
72
+      $this->tags_favorites[] = $tagsFavorites;
73
+  }
65 74
 }