Answer the question
In order to leave comments, you need to log in
How to work with Doctrine ORM on the command line, or what should cli-config.php look like?
Windows 8.1, ZendFramework 2
Hi I'm running
com. Windows line, go to the zf2 project directory. From the root of the directory I run the command: php ./vendor/doctrine/orm/bin/doctrine orm:*
- instead of an asterisk, a command understandable by Doctrine (validate/create, etc.).
The result of running the command above is:
F:\Server\domains\zf2-skeleton>php ./vendor/doctrine/orm/bin/doctrine orm:valida
te-schema
You are missing a "cli-config.php" or "config/cli-config.php" file in your
project, which is required to get the Doctrine Console working. You can use the
following sample as a template:
<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
// replace with file to your own project bootstrap
require_once 'bootstrap.php';
// replace with mechanism to retrieve EntityManager in your app
$entityManager = GetEntityManager();
return ConsoleRunner::createHelperSet($entityManager);
config/cli-config.php
with the appropriate content:<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
// replace with file to your own project bootstrap
require_once 'bootstrap.php';
// replace with mechanism to retrieve EntityManager in your app
$entityManager = GetEntityManager();
return ConsoleRunner::createHelperSet($entityManager);
bootstrap.php
to our own. Do I understand correctly that in zf2 the autoloader (bootstrap) is a file init_autoloader.php
in the root of the project? I have installed it for now, but there is one more problem anyway. $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
php vendor\bin\doctrine-module orm:validate-schema
<?
require_once __DIR__ . '/src/MyZfcAdmin/Module.php';
PHP Fatal error: Uncaught exception 'Zend\ModuleManager\Exception\RuntimeException' with message 'Module (MyZfcAdmin) could not be initialized.' in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php:189
Stack trace:
#0 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(163): Zend\ModuleManager\ModuleManager->loadModuleByName(Object(Zend\ModuleManager\ModuleEvent))
#1 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php(90): Zend\ModuleManager\ModuleManager->loadModule('MyZfcAdmin')
#2 [internal function]: Zend\ModuleManager\ModuleManager->onLoadModules(Object(Zend\ModuleManager\ModuleEvent))
#3 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\ModuleManager\ModuleEvent))
#4 F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\Ev in F:\Server\domains\zf2-skeleton\vendor\zendframework\zendframework\library\Zend\ModuleManager\ModuleManager.php on line 189
php vendor\bin\doctrine-module orm:validate-schema
, and not making a crutch? Answer the question
In order to leave comments, you need to log in
There is a module for zf, official.
https://github.com/doctrine/DoctrineORMModule
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question