Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doctrine 2 Console Tool says: You are missing a "cli-config.php" or "config/cli-config.php"

I ran doctrine console tool:

$ php vendor/doctrine/orm/bin/doctrine orm:schema-tool:create --dump-sql

I got this instead of expected functionality:

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);

Issues:

  • I am on ZF2, and there is no file called bootstrap.php
  • I am new to ZF2, so I don't know what my entityManager is and what I should put for GetEntityManager

How do I make this work?

like image 827
Dennis Avatar asked Nov 22 '13 14:11

Dennis


1 Answers

The Easy Way

Use Doctrine Module:

vendor/bin/doctrine-module orm:schema-tool:create --dump-sql

Note: this answer may be specific to these frameworks:

  • Zend Framework
  • Zend Expressive
  • Laminas
  • Mezzio
like image 86
Dennis Avatar answered Sep 19 '22 23:09

Dennis