Skip to content

Commit

Permalink
support both git clone (development) and composer way autoload locations
Browse files Browse the repository at this point in the history
  • Loading branch information
connorhu committed Apr 4, 2024
1 parent 56ed8b2 commit bb1bdb8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/command/cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@
* file that was distributed with this source code.
*/

require_once __DIR__.'/../../vendor/autoload.php';
$composerAutoloadLocations = [
__DIR__.'/../../../../autoload.php',
__DIR__.'/../../vendor/autoload.php',
];

// Try autoloading using composer if available.
if (!file_exists($autoload = __DIR__.'/../../../../autoload.php')) {
$autoload = __DIR__.'/../../autoload.php';
}

// Fall back to classic Symfony loading
if (!file_exists($autoload)) {
sfCoreAutoload::register();
} else {
require_once $autoload;
foreach ($composerAutoloadLocations as $composerAutoloadLocation) {
if (file_exists($composerAutoloadLocation) && is_readable($composerAutoloadLocation)) {
require_once $composerAutoloadLocation;
}
}

try {
Expand Down

0 comments on commit bb1bdb8

Please sign in to comment.