Jelajahi Sumber

Merge pull request #1957 from schmunk42/master

fixes autoload problem with commands for just installed packages
Jordi Boggiano 11 tahun lalu
induk
melakukan
57f60fd538
1 mengubah file dengan 7 tambahan dan 5 penghapusan
  1. 7 5
      src/Composer/Command/CreateProjectCommand.php

+ 7 - 5
src/Composer/Command/CreateProjectCommand.php

@@ -164,11 +164,6 @@ EOT
             return 1;
         }
 
-        if ($noScripts === false) {
-            // dispatch event
-            $this->getComposer()->getEventDispatcher()->dispatchCommandEvent(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
-        }
-
         $hasVcs = $installedFromVcs;
         if (!$keepVcs && $installedFromVcs
             && (
@@ -211,6 +206,13 @@ EOT
             }
         }
 
+        if ($noScripts === false) {
+            // TODO: improve autoloader refreshing
+            require($this->getComposer()->getConfig()->get('vendor-dir').'/autoload.php');
+            // dispatch event
+            $this->getComposer()->getEventDispatcher()->dispatchCommandEvent(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
+        }
+
         return 0;
     }