Browse Source

Evolution #57: Modifier le système de Type (element)

bastien 13 years ago
parent
commit
c1b4c50f6d

+ 2 - 1
src/Muzich/CoreBundle/Controller/CoreController.php View File

155
     }
155
     }
156
     
156
     
157
     $element = new Element();
157
     $element = new Element();
158
+    $element->setType('none');
158
     $form = $this->getAddForm($element);
159
     $form = $this->getAddForm($element);
159
-    
160
     $form->bindRequest($this->getRequest());
160
     $form->bindRequest($this->getRequest());
161
+    
161
     if ($form->isValid())
162
     if ($form->isValid())
162
     {
163
     {
163
 
164
 

+ 21 - 27
src/Muzich/CoreBundle/DataFixtures/ORM/LoadElementData.php View File

80
     $paul = $this->entity_manager->merge($this->getReference('user_paul'));
80
     $paul = $this->entity_manager->merge($this->getReference('user_paul'));
81
     $bob  = $this->entity_manager->merge($this->getReference('user_bob'));
81
     $bob  = $this->entity_manager->merge($this->getReference('user_bob'));
82
     $joelle  = $this->entity_manager->merge($this->getReference('user_joelle'));
82
     $joelle  = $this->entity_manager->merge($this->getReference('user_joelle'));
83
-
84
-    // 'youtube', 'soundclound', 'son2teuf', 'jamendo'
85
-    $youtube     = $this->entity_manager->merge($this->getReference('element_type_youtube.com'));
86
-    $soundclound = $this->entity_manager->merge($this->getReference('element_type_soundcloud.com'));
87
-    $son2teuf    = $this->entity_manager->merge($this->getReference('element_type_son2teuf.org'));
88
-    $jamendo     = $this->entity_manager->merge($this->getReference('element_type_jamendo.com'));
89
     
83
     
90
     $this->createElement('youtube_heretik_1', 'Heretik System Popof - Resistance', 
84
     $this->createElement('youtube_heretik_1', 'Heretik System Popof - Resistance', 
91
       'http://www.youtube.com/watch?v=tq4DjQK7nsM',
85
       'http://www.youtube.com/watch?v=tq4DjQK7nsM',
92
       $this->getArrayOfTag(array('hardtek')),
86
       $this->getArrayOfTag(array('hardtek')),
93
-    $youtube, $bux, null, '2011-12-10 17:35:07');
87
+    'youtube.com', $bux, null, '2011-12-10 17:35:07');
94
     
88
     
95
     $this->createElement('youtube_dtc_passdrop', 'dtc che passdrop', 
89
     $this->createElement('youtube_dtc_passdrop', 'dtc che passdrop', 
96
       'http://www.youtube.com/watch?v=2A4buFCp7qM', 
90
       'http://www.youtube.com/watch?v=2A4buFCp7qM', 
97
       $this->getArrayOfTag(array('hardtek')),
91
       $this->getArrayOfTag(array('hardtek')),
98
-    $youtube, $bux, null, '2011-12-10 18:35:07');
92
+    'youtube.com', $bux, null, '2011-12-10 18:35:07');
99
     
93
     
100
     $this->createElement('youtube_antroppod_1', 'Antropod - Polakatek', 
94
     $this->createElement('youtube_antroppod_1', 'Antropod - Polakatek', 
101
       'http://www.youtube.com/watch?v=VvpF3lCh1hk&NR=1', 
95
       'http://www.youtube.com/watch?v=VvpF3lCh1hk&NR=1', 
102
       $this->getArrayOfTag(array('hardtek')),
96
       $this->getArrayOfTag(array('hardtek')),
103
-    $youtube, $bux, null, '2011-12-10 19:45:07');
97
+    'youtube.com', $bux, null, '2011-12-10 19:45:07');
104
     
98
     
105
     $this->createElement('youtube_koinkoin_1', 'koinkOin - H5N1', 
99
     $this->createElement('youtube_koinkoin_1', 'koinkOin - H5N1', 
106
       'http://www.son2teuf.org/Voir-details/Sons/Lives/Hardtek-_-Tribe/koinkOin-_-H5N1', 
100
       'http://www.son2teuf.org/Voir-details/Sons/Lives/Hardtek-_-Tribe/koinkOin-_-H5N1', 
107
       $this->getArrayOfTag(array('hardtek', 'electro')),
101
       $this->getArrayOfTag(array('hardtek', 'electro')),
108
-    $youtube, $bux, null, '2011-12-10 21:35:07');
102
+    'son2teuf.org', $bux, null, '2011-12-10 21:35:07');
109
     
103
     
110
     
104
     
111
     $this->createElement('youtube_djfab_1', 'DJ FAB', 
105
     $this->createElement('youtube_djfab_1', 'DJ FAB', 
112
       'http://www.jamendo.com/fr/album/42567', 
106
       'http://www.jamendo.com/fr/album/42567', 
113
       $this->getArrayOfTag(array('hardtek')),
107
       $this->getArrayOfTag(array('hardtek')),
114
-    $jamendo, $jean, null, '2011-11-11 17:35:07');
108
+    'jamendo.com', $jean, null, '2011-11-11 17:35:07');
115
     
109
     
116
     $this->createElement('youtube_djantoine_1', 'dj antoine', 
110
     $this->createElement('youtube_djantoine_1', 'dj antoine', 
117
       'http://www.jamendo.com/fr/album/75206', 
111
       'http://www.jamendo.com/fr/album/75206', 
118
       $this->getArrayOfTag(array('hardtek', 'tribe')),
112
       $this->getArrayOfTag(array('hardtek', 'tribe')),
119
-    $jamendo, $jean, null, '2011-11-11 19:35:07');
113
+    'jamendo.com', $jean, null, '2011-11-11 19:35:07');
120
     
114
     
121
     $this->createElement('youtube_acroyek_1', 'Acrotek Hardtek G01', 
115
     $this->createElement('youtube_acroyek_1', 'Acrotek Hardtek G01', 
122
       'http://www.jamendo.com/fr/album/3409', 
116
       'http://www.jamendo.com/fr/album/3409', 
123
       $this->getArrayOfTag(array('hardtek')),
117
       $this->getArrayOfTag(array('hardtek')),
124
-    $jamendo, $jean, null, '2011-12-11 14:35:07');
118
+    'jamendo.com', $jean, null, '2011-12-11 14:35:07');
125
     
119
     
126
     
120
     
127
     $this->createElement('jamendo_caio_1', 'All Is Full Of Pain', 
121
     $this->createElement('jamendo_caio_1', 'All Is Full Of Pain', 
128
       'http://soundcloud.com/keytek/all-is-full-of-pain', 
122
       'http://soundcloud.com/keytek/all-is-full-of-pain', 
129
       $this->getArrayOfTag(array('tribe', 'hardtek')),
123
       $this->getArrayOfTag(array('tribe', 'hardtek')),
130
-    $soundclound, $paul, null, '2011-12-02 01:35:07');
124
+    'soundcloud.com', $paul, null, '2011-12-02 01:35:07');
131
     
125
     
132
     $this->createElement('jamendo_reverb_1', 'RE-FUCK (ReVeRB_FBC) mix.', 
126
     $this->createElement('jamendo_reverb_1', 'RE-FUCK (ReVeRB_FBC) mix.', 
133
       'http://soundcloud.com/reverb-2/re-fuck-reverb_fbc-mix', 
127
       'http://soundcloud.com/reverb-2/re-fuck-reverb_fbc-mix', 
134
       $this->getArrayOfTag(array('tribe')),
128
       $this->getArrayOfTag(array('tribe')),
135
-    $soundclound, $paul, null, '2011-12-04 14:35:07');
129
+    'soundcloud.com', $paul, null, '2011-12-04 14:35:07');
136
     
130
     
137
     $this->createElement('jamendo_cardio_1', 'CardioT3K - Juggernaut Trap', 
131
     $this->createElement('jamendo_cardio_1', 'CardioT3K - Juggernaut Trap', 
138
       'http://soundcloud.com/cardiot3k/cardiot3k-juggernaut-trap', 
132
       'http://soundcloud.com/cardiot3k/cardiot3k-juggernaut-trap', 
139
       $this->getArrayOfTag(array('tribe')),
133
       $this->getArrayOfTag(array('tribe')),
140
-    $soundclound, $paul, null, '2011-12-12 13:35:07');
134
+    'soundcloud.com', $paul, null, '2011-12-12 13:35:07');
141
     
135
     
142
     $this->createElement('dudeldrum', 'DUDELDRUM', 
136
     $this->createElement('dudeldrum', 'DUDELDRUM', 
143
       'http://www.jamendo.com/fr/album/89109', 
137
       'http://www.jamendo.com/fr/album/89109', 
144
       $this->getArrayOfTag(array('medieval')),
138
       $this->getArrayOfTag(array('medieval')),
145
-      $jamendo, $joelle,
139
+      'jamendo.com', $joelle,
146
       $this->entity_manager->merge($this->getReference('group_dudeldrum'))
140
       $this->entity_manager->merge($this->getReference('group_dudeldrum'))
147
       , '2011-12-16 18:11:07'
141
       , '2011-12-16 18:11:07'
148
     );
142
     );
150
     $this->createElement('infected_psycho', 'Infected Mushroom - Psycho', 
144
     $this->createElement('infected_psycho', 'Infected Mushroom - Psycho', 
151
       'http://www.youtube.com/watch?v=dLWXSsYJoWY', 
145
       'http://www.youtube.com/watch?v=dLWXSsYJoWY', 
152
       $this->getArrayOfTag(array('psytrance')),
146
       $this->getArrayOfTag(array('psytrance')),
153
-      $youtube, $paul,
147
+      'youtube.com', $paul,
154
       $this->entity_manager->merge($this->getReference('group_fan_de_psytrance'))
148
       $this->entity_manager->merge($this->getReference('group_fan_de_psytrance'))
155
       , '2011-12-10 16:11:17'
149
       , '2011-12-10 16:11:17'
156
     );
150
     );
158
     $this->createElement('infected_muse', 'Infected mushroom - Muse Breaks', 
152
     $this->createElement('infected_muse', 'Infected mushroom - Muse Breaks', 
159
       'http://www.youtube.com/watch?v=g0Cbfm1PStA', 
153
       'http://www.youtube.com/watch?v=g0Cbfm1PStA', 
160
       $this->getArrayOfTag(array('psytrance')),
154
       $this->getArrayOfTag(array('psytrance')),
161
-      $youtube, $bob,
155
+      'youtube.com', $bob,
162
       $this->entity_manager->merge($this->getReference('group_fan_de_psytrance'))
156
       $this->entity_manager->merge($this->getReference('group_fan_de_psytrance'))
163
       , '2011-12-08 17:35:07'
157
       , '2011-12-08 17:35:07'
164
     );
158
     );
166
     $this->createElement('joelle_1', 'Cents Pas - Joëlle', 
160
     $this->createElement('joelle_1', 'Cents Pas - Joëlle', 
167
       'http://www.youtube.com/watch?v=bIAFB4vRdGw', 
161
       'http://www.youtube.com/watch?v=bIAFB4vRdGw', 
168
       $this->getArrayOfTag(array('chanteuse')),
162
       $this->getArrayOfTag(array('chanteuse')),
169
-      $youtube, $joelle, null, '2011-12-08 14:21:07'
163
+      'youtube.com', $joelle, null, '2011-12-08 14:21:07'
170
     );
164
     );
171
     
165
     
172
     $this->createElement('joelle_2', 'Cents Pas - Joëlle (bis)', 
166
     $this->createElement('joelle_2', 'Cents Pas - Joëlle (bis)', 
173
       'http://www.youtube.com/watch?v=bIAFB4vRdGw', 
167
       'http://www.youtube.com/watch?v=bIAFB4vRdGw', 
174
       $this->getArrayOfTag(array('chanteuse')),
168
       $this->getArrayOfTag(array('chanteuse')),
175
-      $youtube, $joelle,
169
+      'youtube.com', $joelle,
176
       $this->entity_manager->merge($this->getReference('group_joelle'))
170
       $this->entity_manager->merge($this->getReference('group_joelle'))
177
       , '2011-12-07 14:12:07'
171
       , '2011-12-07 14:12:07'
178
     );
172
     );
180
     $this->createElement('ukf_1', 'UKF Dubstep Mix - August ', 
174
     $this->createElement('ukf_1', 'UKF Dubstep Mix - August ', 
181
       'http://www.youtube.com/watch?v=SFu2DfPDGeU', 
175
       'http://www.youtube.com/watch?v=SFu2DfPDGeU', 
182
       $this->getArrayOfTag(array('dubstep')),
176
       $this->getArrayOfTag(array('dubstep')),
183
-      $youtube, $joelle, null, '2011-12-10 00:35:07'
177
+      'youtube.com', $joelle, null, '2011-12-10 00:35:07'
184
     );
178
     );
185
     
179
     
186
     $this->createElement('beatbox_1', 'Dubstep Beatbox', 
180
     $this->createElement('beatbox_1', 'Dubstep Beatbox', 
187
       'http://www.dailymotion.com/video/xm5omz_dubstep-beatbox_creation', 
181
       'http://www.dailymotion.com/video/xm5omz_dubstep-beatbox_creation', 
188
       $this->getArrayOfTag(array('dubstep', 'beatbox')),
182
       $this->getArrayOfTag(array('dubstep', 'beatbox')),
189
-      null, $joelle, null, '2011-12-10 11:11:11'
183
+      'dailymotion.com', $joelle, null, '2011-12-10 11:11:11'
190
     );
184
     );
191
     
185
     
192
     $this->createElement('soulfly_1', 'SOULFLY - Prophecy', 
186
     $this->createElement('soulfly_1', 'SOULFLY - Prophecy', 
193
       'http://www.youtube.com/watch?v=zCc_jLctZkA', 
187
       'http://www.youtube.com/watch?v=zCc_jLctZkA', 
194
       $this->getArrayOfTag(array('metal')),
188
       $this->getArrayOfTag(array('metal')),
195
-      $youtube, $bux, null, '2011-12-12 17:39:07'
189
+      'youtube.com', $bux, null, '2011-12-12 17:39:07'
196
     );
190
     );
197
     
191
     
198
     $this->createElement('azyd_azylum_1', 'AZYD AZYLUM Live au Café Provisoire', 
192
     $this->createElement('azyd_azylum_1', 'AZYD AZYLUM Live au Café Provisoire', 
199
       'http://www.youtube.com/watch?v=8AXhRXAt2E4', 
193
       'http://www.youtube.com/watch?v=8AXhRXAt2E4', 
200
       $this->getArrayOfTag(array('metal')),
194
       $this->getArrayOfTag(array('metal')),
201
-      $youtube, $bux, null, '2011-11-11 11:11:11'
195
+      'youtube.com', $bux, null, '2011-11-11 11:11:11'
202
     );
196
     );
203
     
197
     
204
     $this->createElement('babylon_pression_1', 'Babylon Pression - Des Tasers et des Pauvres', 
198
     $this->createElement('babylon_pression_1', 'Babylon Pression - Des Tasers et des Pauvres', 
205
       'http://www.youtube.com/watch?v=XWkbaHxRvds&feature=related', 
199
       'http://www.youtube.com/watch?v=XWkbaHxRvds&feature=related', 
206
       $this->getArrayOfTag(array('metal', 'hardcore')),
200
       $this->getArrayOfTag(array('metal', 'hardcore')),
207
-      $youtube, $bux, null, '2011-12-14 18:35:07'
201
+      'youtube.com', $bux, null, '2011-12-14 18:35:07'
208
     );
202
     );
209
     
203
     
210
     $this->createElement('ed_cox_1', 'Ed Cox - La fanfare des teuffeurs (Hardcordian)', 
204
     $this->createElement('ed_cox_1', 'Ed Cox - La fanfare des teuffeurs (Hardcordian)', 
211
       'http://www.youtube.com/watch?v=Lk1gnh-JCDs&feature=related', 
205
       'http://www.youtube.com/watch?v=Lk1gnh-JCDs&feature=related', 
212
       $this->getArrayOfTag(array('electro')),
206
       $this->getArrayOfTag(array('electro')),
213
-      $youtube, $bux, null, '2011-12-15 21:35:07'
207
+      'youtube.com', $bux, null, '2011-12-15 21:35:07'
214
     );
208
     );
215
     
209
     
216
 
210
 

+ 0 - 54
src/Muzich/CoreBundle/DataFixtures/ORM/LoadElementTypeData.php View File

1
-<?php
2
-
3
-namespace Muzich\UserBundle\DataFixtures\ORM;
4
-
5
-use Doctrine\Common\DataFixtures\AbstractFixture;
6
-use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
8
-use Symfony\Component\DependencyInjection\ContainerInterface;
9
-use Muzich\CoreBundle\Entity\ElementType;
10
-
11
-class LoadElementTypeData  extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
12
-{
13
-  
14
-  private $container;
15
-  private $entity_manager;
16
-  
17
-  public function setContainer(ContainerInterface $container = null)
18
-  {
19
-    $this->container = $container;
20
-  }
21
-  
22
-  public function getOrder()
23
-  {
24
-    return 3; // the order in which fixtures will be loaded
25
-  }
26
-  
27
-  /**
28
-   *  
29
-   */
30
-  protected function createElementType($id, $name)
31
-  {
32
-    $elementType = new ElementType();
33
-    $elementType->setId($id);
34
-    $elementType->setName(ucfirst($name));
35
-    $this->entity_manager->persist($elementType);
36
-    $this->addReference('element_type_'.$id, $elementType);
37
-  }
38
-  
39
-  public function load($entity_manager)
40
-  {
41
-    $this->entity_manager = $entity_manager;
42
-    
43
-    foreach (array(
44
-      'youtube.com' => 'Youtube', 'soundcloud.com' => 'SoundCloud', 
45
-      'son2teuf.org' => 'Son2Teuf', 'jamendo.com' => 'jamendo',
46
-      'dailymotion.com' => 'Dailymotion'
47
-      ) as $id => $name)
48
-    {
49
-      $this->createElementType($id, $name);
50
-    }
51
-
52
-    $this->entity_manager->flush();
53
-  }
54
-}

+ 22 - 30
src/Muzich/CoreBundle/ElementFactory/ElementManager.php View File

7
 use Doctrine\ORM\EntityManager;
7
 use Doctrine\ORM\EntityManager;
8
 use Symfony\Component\DependencyInjection\Container;
8
 use Symfony\Component\DependencyInjection\Container;
9
 
9
 
10
-use Muzich\CoreBundle\ElementFactory\Site\YoutubeFactory;
11
-use Muzich\CoreBundle\ElementFactory\Site\DailymotionFactory;
12
-use Muzich\CoreBundle\ElementFactory\Site\Son2TeufFactory;
13
-use Muzich\CoreBundle\ElementFactory\Site\JamendoFactory;
14
-use Muzich\CoreBundle\ElementFactory\Site\SoundCloudFactory;
10
+use Muzich\CoreBundle\ElementFactory\Site\YoutubecomFactory;
11
+use Muzich\CoreBundle\ElementFactory\Site\DailymotioncomFactory;
12
+use Muzich\CoreBundle\ElementFactory\Site\JamendocomFactory;
13
+use Muzich\CoreBundle\ElementFactory\Site\SoundcloudcomFactory;
15
 
14
 
16
 /**
15
 /**
17
  * 
16
  * 
19
  * @author bux
18
  * @author bux
20
  */
19
  */
21
 class ElementManager
20
 class ElementManager
22
-{
23
-  
24
-  protected $types = array(
25
-    'youtube.com', 
26
-    'soundcloud.com', 
27
-    'son2teuf.org', 
28
-    'jamendo.com',
29
-    'dailymotion.com'
30
-  );
31
-  
21
+{  
32
   protected $em;
22
   protected $em;
33
   protected $element;
23
   protected $element;
34
   protected $container;
24
   protected $container;
25
+  protected $factories;
35
   
26
   
36
   /**
27
   /**
37
    * Procédure chargé de retourner des information destiné au 
28
    * Procédure chargé de retourner des information destiné au 
60
     $this->element = $element;
51
     $this->element = $element;
61
     $this->em = $em;
52
     $this->em = $em;
62
     $this->container = $container;
53
     $this->container = $container;
63
-    
54
+    $this->factories = $this->container->getParameter('factories');
55
+        
64
     $evm = new \Doctrine\Common\EventManager();
56
     $evm = new \Doctrine\Common\EventManager();
65
     $timestampableListener = new \Gedmo\Timestampable\TimestampableListener();
57
     $timestampableListener = new \Gedmo\Timestampable\TimestampableListener();
66
     $evm->addEventSubscriber($timestampableListener);
58
     $evm->addEventSubscriber($timestampableListener);
106
     
98
     
107
     preg_match("/^(http:\/\/)?([^\/]+)/i", $url, $chaines);
99
     preg_match("/^(http:\/\/)?([^\/]+)/i", $url, $chaines);
108
     
100
     
101
+    $type = 'unknow';
109
     if (array_key_exists(2, $chaines))
102
     if (array_key_exists(2, $chaines))
110
     {
103
     {
111
       $host = $chaines[2];
104
       $host = $chaines[2];
112
       // Repérer les derniers segments
105
       // Repérer les derniers segments
113
       preg_match("/[^\.\/]+\.[^\.\/]+$/",$host,$chaines);
106
       preg_match("/[^\.\/]+\.[^\.\/]+$/",$host,$chaines);
114
 
107
 
115
-      $type = null;
116
-
117
-      if (in_array($chaines[0], $this->types))
108
+      if (array_key_exists(0, $chaines))
118
       {
109
       {
119
-        $type = $this->em->getRepository('MuzichCoreBundle:ElementType')->find($chaines[0]);
110
+        $type = $chaines[0];
120
       }
111
       }
121
     }
112
     }
122
     
113
     
134
     // Instanciation d'un objet factory correspondant au type, par exemple
125
     // Instanciation d'un objet factory correspondant au type, par exemple
135
     // YoutubeFactory, qui répondant a une implementation retournera ces infos.
126
     // YoutubeFactory, qui répondant a une implementation retournera ces infos.
136
   
127
   
137
-    if ($this->element->getType())
128
+    if (in_array($this->element->getType(), $this->factories))
138
     {
129
     {
139
       $site_factory = $this->getFactory();
130
       $site_factory = $this->getFactory();
140
       $this->element->setEmbed($site_factory->getEmbedCode());
131
       $this->element->setEmbed($site_factory->getEmbedCode());
144
   
135
   
145
   protected function getFactory()
136
   protected function getFactory()
146
   { 
137
   { 
147
-    switch ($this->element->getType()->getId())
138
+//    $factory_name = ucfirst(str_replace('.', '', $this->element->getType())).'Factory';
139
+//    return new $factory_name($this->element, $this->container);
140
+    
141
+    switch ($this->element->getType())
148
     {
142
     {
149
       case 'youtube.com':
143
       case 'youtube.com':
150
-        return new YoutubeFactory($this->element, $this->container);
144
+        return new YoutubecomFactory($this->element, $this->container);
151
       break;
145
       break;
152
       case 'soundcloud.com':
146
       case 'soundcloud.com':
153
-        return new SoundCloudFactory($this->element, $this->container);
154
-      break;
155
-      case 'son2teuf.org':
156
-        return new Son2TeufFactory($this->element, $this->container);
147
+        return new SoundcloudcomFactory($this->element, $this->container);
157
       break;
148
       break;
158
       case 'jamendo.com':
149
       case 'jamendo.com':
159
-        return new JamendoFactory($this->element, $this->container);
150
+        return new JamendocomFactory($this->element, $this->container);
160
       break;
151
       break;
161
       case 'dailymotion.com':
152
       case 'dailymotion.com':
162
-        return new DailymotionFactory($this->element, $this->container);
153
+        return new DailymotioncomFactory($this->element, $this->container);
163
       break;
154
       break;
164
       default:
155
       default:
165
-        throw new Exception("La Factory n'est pas connu pour ce type.");
156
+        throw new Exception("La Factory n'est pas prise en charge pour ce type.");
166
       break;
157
       break;
167
     }
158
     }
159
+    
168
   }
160
   }
169
     
161
     
170
 }
162
 }

src/Muzich/CoreBundle/ElementFactory/Site/DailymotionFactory.php → src/Muzich/CoreBundle/ElementFactory/Site/DailymotioncomFactory.php View File

9
  *
9
  *
10
  * @author bux
10
  * @author bux
11
  */
11
  */
12
-class DailymotionFactory extends VideoSiteFactory
12
+class DailymotioncomFactory extends VideoSiteFactory
13
 {
13
 {
14
   
14
   
15
 }
15
 }

src/Muzich/CoreBundle/ElementFactory/Site/JamendoFactory.php → src/Muzich/CoreBundle/ElementFactory/Site/JamendocomFactory.php View File

9
  *
9
  *
10
  * @author bux
10
  * @author bux
11
  */
11
  */
12
-class JamendoFactory extends BaseFactory
12
+class JamendocomFactory extends BaseFactory
13
 {
13
 {
14
   public function getEmbedCode()
14
   public function getEmbedCode()
15
   {
15
   {

+ 0 - 17
src/Muzich/CoreBundle/ElementFactory/Site/Son2TeufFactory.php View File

1
-<?php
2
-
3
-namespace Muzich\CoreBundle\ElementFactory\Site;
4
-
5
-use Muzich\CoreBundle\ElementFactory\Site\base\BaseFactory;
6
-
7
-/**
8
- * 
9
- *
10
- * @author bux
11
- */
12
-class Son2TeufFactory extends BaseFactory
13
-{
14
-  
15
-}
16
-
17
-?>

src/Muzich/CoreBundle/ElementFactory/Site/SoundCloudFactory.php → src/Muzich/CoreBundle/ElementFactory/Site/SoundcloudcomFactory.php View File

11
  *
11
  *
12
  * @author bux
12
  * @author bux
13
  */
13
  */
14
-class SoundCloudFactory extends BaseFactory
14
+class SoundcloudcomFactory extends BaseFactory
15
 {
15
 {
16
   public function getEmbedCode()
16
   public function getEmbedCode()
17
   {
17
   {

src/Muzich/CoreBundle/ElementFactory/Site/YoutubeFactory.php → src/Muzich/CoreBundle/ElementFactory/Site/YoutubecomFactory.php View File

9
  *
9
  *
10
  * @author bux
10
  * @author bux
11
  */
11
  */
12
-class YoutubeFactory extends VideoSiteFactory
12
+class YoutubecomFactory extends VideoSiteFactory
13
 {
13
 {
14
   
14
   
15
 }
15
 }

+ 6 - 5
src/Muzich/CoreBundle/Entity/Element.php View File

32
   /**
32
   /**
33
    * Cet attribut stocke le type d'élément.
33
    * Cet attribut stocke le type d'élément.
34
    * 
34
    * 
35
-   * @ORM\ManyToOne(targetEntity="ElementType", inversedBy="elements")
36
-   * @ORM\JoinColumn(name="element_type_id", referencedColumnName="id")
35
+   * @ORM\Column(type="string", length=64)
36
+   * @Assert\NotBlank()
37
+   * @Assert\MaxLength(1024)
37
    */
38
    */
38
   protected $type;
39
   protected $type;
39
   
40
   
171
   /**
172
   /**
172
    * Set type
173
    * Set type
173
    *
174
    *
174
-   * @param ElementType $type
175
+   * @param string $type
175
    */
176
    */
176
-  public function setType(ElementType $type = null)
177
+  public function setType($type)
177
   {
178
   {
178
     $this->type = $type;
179
     $this->type = $type;
179
   }
180
   }
181
   /**
182
   /**
182
    * Get type
183
    * Get type
183
    *
184
    *
184
-   * @return ElementType 
185
+   * @return string 
185
    */
186
    */
186
   public function getType()
187
   public function getType()
187
   {
188
   {

+ 0 - 114
src/Muzich/CoreBundle/Entity/ElementType.php View File

1
-<?php
2
-
3
-namespace Muzich\CoreBundle\Entity;
4
-
5
-use Doctrine\ORM\Mapping as ORM;
6
-use \Doctrine\Common\Collections\ArrayCollection;
7
-
8
-/**
9
- * Type d'element
10
- *  * Youtube
11
- *  * Jamendo
12
- *  * ...
13
- * 
14
- * @ORM\Entity
15
- * @ORM\Table(name="element_type")
16
- */
17
-class ElementType
18
-{
19
-  
20
-  /**
21
-   * @ORM\Id
22
-   * @ORM\Column(type="string", length=18)
23
-   * @var type string
24
-   */
25
-  protected $id;
26
-  
27
-  /**
28
-   * Liste des elements de ce type
29
-   * 
30
-   * @ORM\OneToMany(targetEntity="Element", mappedBy="element_type")
31
-   */
32
-  protected $elements;
33
-  
34
-  /**
35
-   * Libelle du type
36
-   * 
37
-   * @ORM\Column(type="string", length=128)
38
-   * @var type string
39
-   */
40
-  protected $name;
41
-  
42
-  /**
43
-   * 
44
-   */
45
-  public function __construct()
46
-  {
47
-    $this->elements = new ArrayCollection();
48
-  }
49
-  
50
-  public function __toString()
51
-  {
52
-    return $this->name;
53
-  }
54
-
55
-  /**
56
-   * Set name
57
-   *
58
-   * @param string $name
59
-   */
60
-  public function setName($name)
61
-  {
62
-    $this->name = $name;
63
-  }
64
-
65
-  /**
66
-   * Get name
67
-   *
68
-   * @return string 
69
-   */
70
-  public function getName()
71
-  {
72
-    return $this->name;
73
-  }
74
-  
75
-  /**
76
-   * Set id
77
-   *
78
-   * @param string $id
79
-   */
80
-  public function setId($id)
81
-  {
82
-    $this->id = $id;
83
-  }
84
-
85
-  /**
86
-   * Get id
87
-   *
88
-   * @return string 
89
-   */
90
-  public function getId()
91
-  {
92
-    return $this->id;
93
-  }
94
-
95
-  /**
96
-   * Add elements
97
-   *
98
-   * @param Element $elements
99
-   */
100
-  public function addElement(Element $elements)
101
-  {
102
-    $this->elements[] = $elements;
103
-  }
104
-
105
-  /**
106
-   * Get elements
107
-   *
108
-   * @return Doctrine\Common\Collections\Collection 
109
-   */
110
-  public function getElements()
111
-  {
112
-    return $this->elements;
113
-  }
114
-}

+ 2 - 4
src/Muzich/CoreBundle/Repository/ElementRepository.php View File

18
   {
18
   {
19
     return $this->getEntityManager()
19
     return $this->getEntityManager()
20
       ->createQuery('
20
       ->createQuery('
21
-        SELECT e, t FROM MuzichCoreBundle:Element e 
22
-        JOIN e.type t
21
+        SELECT e FROM MuzichCoreBundle:Element e 
23
         ORDER BY e.name ASC'
22
         ORDER BY e.name ASC'
24
       )
23
       )
25
       ->getResult()
24
       ->getResult()
165
       }
164
       }
166
 
165
 
167
       // C'est la requête qui récupérera les données element avec ses jointures.
166
       // C'est la requête qui récupérera les données element avec ses jointures.
168
-      $query_select = "SELECT e, ty, t, o, g, fav
167
+      $query_select = "SELECT e, t, o, g, fav
169
         FROM MuzichCoreBundle:Element e 
168
         FROM MuzichCoreBundle:Element e 
170
         LEFT JOIN e.group g 
169
         LEFT JOIN e.group g 
171
-        LEFT JOIN e.type ty 
172
         LEFT JOIN e.tags t 
170
         LEFT JOIN e.tags t 
173
         LEFT JOIN e.elements_favorites fav WITH fav.user = :uid
171
         LEFT JOIN e.elements_favorites fav WITH fav.user = :uid
174
         JOIN e.owner o
172
         JOIN e.owner o