From 8231fb2c68392b737c8f508bc9b594de6064b83b Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sat, 9 Jun 2012 10:48:58 +0200 Subject: [PATCH] Adding support for various composer autoload file locations, making composer optional --- bin/doctrine.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/doctrine.php b/bin/doctrine.php index 7de4bfcdf..6cc40f978 100644 --- a/bin/doctrine.php +++ b/bin/doctrine.php @@ -17,11 +17,12 @@ * . */ -if (!@include __DIR__ . '/../../../autoload.php') { - die(<<<'EOT' -This command can only be run when Doctrine is installed through Composer. -EOT - ); +$previousDir = null; +$currentDir = __DIR__; + +while ($previousDir !== $currentDir && !@include_once($currentDir . '/vendor/autoload.php')) { + $previousDir = $currentDir; + $currentDir = dirname($currentDir); } $configFile = getcwd() . DIRECTORY_SEPARATOR . 'cli-config.php';