Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Doctrine - linha de comando

No Curso de Doctrine, apos executar o comando vendor\bin\doctrine.bat, o sistema pede para cirar um arquivo cli-config,. Seguindo passo a passo o que o professor passou e executando novamente, cai na mesma informação , pedindo para criar o arquivo e configurar,mesmo ja feito. Não aparece a lista de comandos do Doctrine e nem permite executar comando pela linha de comando.

<?php

use Alura\Doctrine\Helper\EntityManagerFactory;
use Doctrine\ORM\Tools\Console\ConsoleRunner;


require_once __DIR__ . '/vendor/autoload.php';

$entityManagerFactory = new EntityManagerFactory();
$entityManager = $entityManagerFactory->getEntityManager();

return ConsoleRunner::createHelperSet($entityManager);
3 respostas
solução!

Patchelli, beleza? Algumas sugestões:

Você esta rodando o comando na pasta raiz do projeto?

Poste para nós aqui o fonte do arquivo cli-config.php.

No meu caso o arquivo cli-config.php também esta na raiz do projeto.

Verifique a estrutura das pastas do projeto, no meu caso esta assim:

15/01/2020  17:51    <DIR>          .
15/01/2020  17:51    <DIR>          ..
29/12/2019  09:11    <DIR>          commands
29/12/2019  09:10    <DIR>          src
17/12/2019  09:25    <DIR>          var
18/12/2019  08:48    <DIR>          vendor
21/02/2019  14:57               270 teste.php
21/02/2019  16:48               191 composer.json
18/12/2019  08:48            57.017 composer.lock
21/02/2019  16:50               366 migrations.php
21/02/2019  15:57                21 .gitignore
21/02/2019  15:20               329 cli-config.php

Abaixo apenas como referência a saída do comando: vendor\bin\doctrine.bat

Doctrine Command Line Interface 2.7.0

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help                               Displays help for a command
  list                               Lists commands
 dbal
  dbal:import                        Import SQL file(s) directly to Database.
  dbal:reserved-words                Checks if the current database contains identifiers that are reserved.
  dbal:run-sql                       Executes arbitrary SQL directly from the command line.
 orm
  orm:clear-cache:metadata           Clear all metadata cache of the various cache drivers
  orm:clear-cache:query              Clear all query cache of the various cache drivers
  orm:clear-cache:region:collection  Clear a second-level cache collection region
  orm:clear-cache:region:entity      Clear a second-level cache entity region
  orm:clear-cache:region:query       Clear a second-level cache query region
  orm:clear-cache:result             Clear all result cache of the various cache drivers
  orm:convert-d1-schema              [orm:convert:d1-schema] Converts Doctrine 1.x schema into a Doctrine 2.x schema
  orm:convert-mapping                [orm:convert:mapping] Convert mapping information between supported formats
  orm:ensure-production-settings     Verify that Doctrine is properly configured for a production environment
  orm:generate-entities              [orm:generate:entities] Generate entity classes and method stubs from your mapping information
  orm:generate-proxies               [orm:generate:proxies] Generates proxy classes for entity classes
  orm:generate-repositories          [orm:generate:repositories] Generate repository classes from your mapping information
  orm:info                           Show basic information about all mapped entities
  orm:mapping:describe               Display information about mapped objects
  orm:run-dql                        Executes arbitrary DQL directly from the command line
  orm:schema-tool:create             Processes the schema and either create it directly on EntityManager Storage Connection or generate the SQL output
  orm:schema-tool:drop               Drop the complete database schema of EntityManager Storage Connection or generate the corresponding SQL output
  orm:schema-tool:update             Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata
  orm:validate-schema                Validate the mapping files
<?php

use Alura\Doctrine\Helper\EntityManagerFactory;
use Doctrine\ORM\Tools\Console\ConsoleRunner;


require_once __DIR__ . '/vendor/autoload.php';

$entityManagerFactory = new EntityManagerFactory();
$entityManager = $entityManagerFactory->getEntityManager();

return ConsoleRunner::createHelperSet($entityManager);

Opa Blz, Era justamente isso que você explicou. O arquivo cli-config.php nao estava no raiz do projeto Muito Obrigado pela ajuda.