Piszę sobie backend w php i chciałem w nim zastosować ORM Doctrine, jednak mam problem. Stworzyłem zgodnie z kursem na yt plik cli-config.php, ale po wpisaniu w konsole (PowerShell, Bash)
php vendor/bin/doctrine orm:schema-tool:update --force --dump-sql --sm-module:TestModel.php
otrzymuję taki oto kod zwrotny:
dir=$(cd "${0%[/\\]*}" > /dev/null; cd "../doctrine/orm/bin" && pwd)
if [ -d /proc/cygdrive ]; then
case $(which php) in
$(readlink -n /proc/cygdrive)/*)
# We are in Cygwin using Windows php, so the path must be translated
dir=$(cygpath -m "$dir");
;;
esac
fi
"${dir}/doctrine" "$@"
Plik cli-config.php
<?php
require_once __DIR__.'/vendor/autoload.php';
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$smModuleArg = false;
foreach ($_SERVER['argv'] as $key => $val) {
if (preg_match('/--sm-module/', $val)) {
$smModuleArg = $val;
unset( $_SERVER['argv'][$key] );
$_SERVER['argc'] = $_SERVER['argc']-1;
}
}
if ($smModuleArg) {
$paths = array(__DIR__ . '/app/models/' . explode(':', $smModuleArg)[1]);
} else {
$paths = array(__DIR__ . '/app/models/');
}
print_r($paths);
$isDevMode = true;
$dbParams = include(__DIR__ . '/config.php');
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams['database'], $config);
return ConsoleRunner::createHelperSet($entityManager);