Преглед на файлове

Renommage de ElementFactory en ElementManager

bastien преди 13 години
родител
ревизия
22f9645ea6
променени са 2 файла, в които са добавени 8 реда и са изтрити 6 реда
  1. 3 3
      src/Muzich/CoreBundle/Controller/CoreController.php
  2. 5 3
      src/Muzich/CoreBundle/ElementFactory/ElementManager.php

+ 3 - 3
src/Muzich/CoreBundle/Controller/CoreController.php Целия файл

8
 use Muzich\CoreBundle\Entity\FollowGroup;
8
 use Muzich\CoreBundle\Entity\FollowGroup;
9
 //use Doctrine\ORM\Query;
9
 //use Doctrine\ORM\Query;
10
 use Muzich\CoreBundle\Form\Element\ElementAddForm;
10
 use Muzich\CoreBundle\Form\Element\ElementAddForm;
11
-use Muzich\CoreBundle\ElementFactory\ElementFactory;
11
+use Muzich\CoreBundle\ElementFactory\ElementManager;
12
 use Muzich\CoreBundle\Entity\Element;
12
 use Muzich\CoreBundle\Entity\Element;
13
 
13
 
14
 class CoreController extends Controller
14
 class CoreController extends Controller
95
         $data = $form->getData();
95
         $data = $form->getData();
96
         $element = new Element();
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
         $em->persist($element);
101
         $em->persist($element);
102
         $em->flush();
102
         $em->flush();

src/Muzich/CoreBundle/ElementFactory/ElementFactory.php → src/Muzich/CoreBundle/ElementFactory/ElementManager.php Целия файл

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