我在wordpress-plugin中使用原則。但是,命令行工具無法正常工作。 它似乎忽略所有輸入或參數,並且只是不斷顯示默認的幫助文本,無論我輸入什麼內容。原則命令行忽略輸入
PHP版本是7.0.7。
我的CLI-配置(它坐落在供應商/ ORM /斌/配置)的內容是這樣的:
<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
require_once __DIR__ . '/../../../../../doctrine-bootstrap.php';
$spmm = new doctrineBootstrap();
$entityManager = $spmm->getEntityManager();
return ConsoleRunner::createHelperSet($entityManager);
?>
引導程序本身的內容:
<?php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
class doctrineBootstrap {
private $entityManager;
public function __construct() {
$this->initDoctrine();
}
private function initDoctrine() {
$paths = array("/model");
$isDevMode = false;
// the connection configuration
$dbParams = array(
'host' => 'XXXX',
'driver' => 'pdo_mysql',
'user' => 'XXXX',
'password' => 'XXXX',
'dbname' => 'XXXX',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$this->entityManager = EntityManager::create($dbParams, $config);
}
public function getEntityManager() {
return $this->entityManager;
}
}
命令本身不會輸出任何錯誤到控制檯,但在php錯誤日誌中出現此錯誤:
[26-Aug-2016 11:17:26 Europe/Berlin] PHP Notice: Undefined index: argv in /html/wordpress/wp-content/plugins/wp-openimmo/vendor/symfony/console/Input/ArgvInput.php on line 55
[26-Aug-2016 11:17:26 Europe/Berlin] PHP Warning: array_shift() expects parameter 1 to be array, null given in /html/wordpress/wp-content/plugins/wp-openimmo/vendor/symfony/console/Input/ArgvInput.php on line 59
[26-Aug-2016 11:17:26 Europe/Berlin] PHP Warning: Invalid argument supplied for foreach() in /html/wordpress/wp-content/plugins/wp-openimmo/vendor/symfony/console/Input/ArgvInput.php on line 276
[26-Aug-2016 11:17:26 Europe/Berlin] PHP Warning: Invalid argument supplied for foreach() in /html/wordpress/wp-content/plugins/wp-openimmo/vendor/symfony/console/Input/ArgvInput.php on line 276
[26-Aug-2016 11:17:26 Europe/Berlin] PHP Warning: Invalid argument supplied for foreach() in /html/wordpress/wp-content/plugins/wp-openimmo/vendor/symfony/console/Input/ArgvInput.php on line 276
我有點困惑,因爲關於這方面的文檔不太清楚。我如何得到它的工作?