Browse Source

Renommage de ElementFactory en ElementManager

bastien 13 years ago
parent
commit
22f9645ea6

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

@@ -8,7 +8,7 @@ use Muzich\CoreBundle\Entity\FollowUser;
8 8
 use Muzich\CoreBundle\Entity\FollowGroup;
9 9
 //use Doctrine\ORM\Query;
10 10
 use Muzich\CoreBundle\Form\Element\ElementAddForm;
11
-use Muzich\CoreBundle\ElementFactory\ElementFactory;
11
+use Muzich\CoreBundle\ElementFactory\ElementManager;
12 12
 use Muzich\CoreBundle\Entity\Element;
13 13
 
14 14
 class CoreController extends Controller
@@ -95,8 +95,8 @@ class CoreController extends Controller
95 95
         $data = $form->getData();
96 96
         $element = new Element();
97 97
         
98
-        $factory = new ElementFactory($element, $em, $this->container);
99
-        $factory->proceed($data, $user);
98
+        $factory = new ElementManager($element, $em, $this->container);
99
+        $factory->proceedFill($data, $user);
100 100
         
101 101
         $em->persist($element);
102 102
         $em->flush();

src/Muzich/CoreBundle/ElementFactory/ElementFactory.php → src/Muzich/CoreBundle/ElementFactory/ElementManager.php View File

@@ -14,7 +14,7 @@ use Muzich\CoreBundle\ElementFactory\Site\YoutubeFactory;
14 14
  *
15 15
  * @author bux
16 16
  */
17
-class ElementFactory
17
+class ElementManager
18 18
 {
19 19
   
20 20
   protected $types = array(
@@ -66,7 +66,7 @@ class ElementFactory
66 66
    * @param User $owner
67 67
    * @return Element 
68 68
    */
69
-  public function proceed($params, User $owner)
69
+  public function proceedFill($params, User $owner)
70 70
   {
71 71
     $this->element->setName($params['name']);
72 72
     $this->element->setUrl($params['url']);
@@ -87,7 +87,9 @@ class ElementFactory
87 87
     preg_match("/[^\.\/]+\.[^\.\/]+$/",$host,$chaines);
88 88
     
89 89
     $type = null;
90
-    if (array_key_exists($chaines[0], $this->types))
90
+    
91
+    
92
+    if (in_array($chaines[0], $this->types))
91 93
     {
92 94
       $type = $this->em->getRepository('MuzichCoreBundle:ElementType')->find($chaines[0]);
93 95
     }