Forráskód Böngészése

Fix validator loader because of component upgrade

jmontoyaa 8 éve
szülő
commit
014617ee0d
1 módosított fájl, 18 hozzáadás és 3 törlés
  1. 18 3
      main/inc/lib/database.lib.php

+ 18 - 3
main/inc/lib/database.lib.php

@@ -157,9 +157,24 @@ class Database
         $sysPath = !empty($sysPath) ? $sysPath : api_get_path(SYS_PATH);
 
         // Registering Constraints
-        AnnotationRegistry::registerAutoloadNamespace(
-            'Symfony\Component\Validator\Constraint',
-            $sysPath."vendor/symfony/validator"
+        /*AnnotationRegistry::registerAutoloadNamespace(
+            'Symfony\Component',
+            $sysPath."vendor/"
+        );*/
+
+        AnnotationRegistry::registerLoader(
+            function ($class) use ($sysPath) {
+                $file = str_replace("\\", DIRECTORY_SEPARATOR, $class).".php";
+                $file = str_replace('Symfony/Component/Validator', '', $file);
+                $file = $sysPath.'vendor/symfony/validator'.$file;
+
+                if (file_exists($file)) {
+                    // file exists makes sure that the loader fails silently
+                    require_once $file;
+
+                    return true;
+                }
+            }
         );
 
         AnnotationRegistry::registerFile(