3
respostas

Olá, estou com esse problema ao executar o vendor/bin/doctrine list estou utilizando linux

<?php

namespace Alura\helper;



use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Setup;



class EntityManagerFactory
{
    /**
     * @return EntityManagerInterface
     * @throws \Doctrine\ORM\ORMException
     */
    public function getEntityManagerFactory(): EntityManagerInterface
    {
        $rootDir = __DIR__ . '/../..';
        $config = Setup::createAnnotationMetadataConfiguration(
            [$rootDir . '/src'],
            true
        );
        $connection = [
            'driver' => 'pdo_sqlite',
            'path' => $rootDir . '/var/data/banco.sqlite'
        ];

        return EntityManager::create($connection, $config);
    }
}
cli-config.php
<?php

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

// replace with file to your own project bootstrap
require_once 'vendor/autoload.php';

// replace with mechanism to retrieve EntityManager in your app
     $entityManagerfactory = new EntityManagerFactory();
     $entityManager = $entityManagerfactory->getEntityManagerFactory();

return ConsoleRunner::createHelperSet($entityManager);

Erro que está apresentando

PHP Fatal error: Uncaught TypeError: mb_detect_encoding(): Argument #1 ($string) must be of type string, null given, called in /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Helper/Helper.php on line 48 and defined in /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/polyfill-mbstring/bootstrap80.php:48 Stack trace:

#0 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Helper/Helper.php(48): mb_detect_encoding()

#1 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Descriptor/TextDescriptor.php(327): Symfony\Component\Console\Helper\Helper::strlen()

#2 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Descriptor/TextDescriptor.php(97): Symfony\Component\Console\Descriptor\TextDescriptor->calculateTotalWidthForOptions()

#3 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Descriptor/TextDescriptor.php(195): Symfony\Component\Console\Descriptor\TextDescriptor->describeInputDefinition()

#4 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Descriptor/Descriptor.php(55): Symfony\Component\Console\Descriptor\TextDescriptor->describeApplication()

#5 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Helper/DescriptorHelper.php(65): Symfony\Component\Console\Descriptor\Descriptor->describe()

#6 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Command/ListCommand.php(70): Symfony\Component\Console\Helper\DescriptorHelper->describe()

#7 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Command/Command.php(255): Symfony\Component\Console\Command\ListCommand->execute()

#8 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Application.php(971): Symfony\Component\Console\Command\Command->run()

#9 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand()

#10 /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun()

#11 /home/clayton/Documentos/PHP/Doctrine/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/Console/ConsoleRunner.php(63): Symfony\Component\Console\Application->run()

#12 /home/clayton/Documentos/PHP/Doctrine/vendor/doctrine/orm/bin/doctrine.php(69): Doctrine\ORM\Tools\Console\ConsoleRunner::run()

#13 /home/clayton/Documentos/PHP/Doctrine/vendor/doctrine/orm/bin/doctrine(4): include('...')

#14 {main} thrown in /home/clayton/Documentos/PHP/Doctrine/vendor/symfony/polyfill-mbstring/bootstrap80.php on line 48

3 respostas

Clayton, você pode compartilhar seu projeto no GitHub pra eu dar uma olhada?

Tentou atualizar os pacotes (com composer update)?

Ok... Professor Vinícius muito obrigado pela atenção :) .

Não entendi. Atualizar resolveu o problema