Quando executo o teste.php da esse erro, copiei o codigo do video e tals mas não funciona
EntityManagerFactory.php`<?php
namespace php\Doctrine\Helper;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Setup;
class EntityManagerFactory{
public function getEntityManager()
{
$rootDir = __DIR__ . '/../..';
$config = Setup::createAnnotationMetadataConfiguration(
[$rootDir . '/src'],
true
);
$connection = [
'driver' => 'pdo_sqlite',
'path' => $rootDir . '/var/data/banco.sqlite'
];
return EntityManager::create($connection, $config);
}
}
?> `
teste.php
<?php
use php\Doctrine\Helper\EntityManagerFactory;
require_once __DIR__ . '/vendor/autoload.php';
$entityManagerFactory = new EntityManagerFactory();
$entityManager = $entityManagerFactory->getEntityManager();
var_dump($entityManager->getConnection());
?>
PHP Fatal error: Uncaught RuntimeException: Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library. in C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php:184 Stack trace:
#0 C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(160): Doctrine\ORM\Tools\Setup::createCacheInstance(true, NULL)
#1 C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(139): Doctrine\ORM\Tools\Setup::createCacheConfiguration(true, 'C:\Users\pheli\...', NULL)
#2 C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(87): Doctrine\ORM\Tools\Setup::createConfiguration(true, 'C:\Users\pheli\...', NULL)
#3 C:\Users\pheli\OneDrive\Documentos\php\Doctrine\src\Helper\EntityManagerFactory.php(16): Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(Array, true)
#4 C:\Users\phe in C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php on line 184
Fatal error: Uncaught RuntimeException: Setup tool cannot configure caches without doctrine/cache 1.11 or symfony/cache. Please add an explicit dependency to either library. in C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php:184 Stack trace:
#0 C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(160): Doctrine\ORM\Tools\Setup::createCacheInstance(true, NULL)
#1 C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(139): Doctrine\ORM\Tools\Setup::createCacheConfiguration(true, 'C:\Users\pheli\...', NULL)
#2 C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php(87): Doctrine\ORM\Tools\Setup::createConfiguration(true, 'C:\Users\pheli\...', NULL)
#3 C:\Users\pheli\OneDrive\Documentos\php\Doctrine\src\Helper\EntityManagerFactory.php(16): Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(Array, true)
#4 C:\Users\phe in C:\Users\pheli\OneDrive\Documentos\php\Doctrine\vendor\doctrine\orm\lib\Doctrine\ORM\Tools\Setup.php on line 184