Ao executar o comando ORM:INFO, ocorreu o seguinte erro:
In MappingException.php line 50:
File mapping drivers must have a valid directory path, however the given path [1] seems to be incorrect!
Classe Aluno:
<?php
namespace Alura\Doctrine\Entity;
/**
* @Entity
*/
class Aluno
{
/**
* @Id
* @GeneratedValue
* @Column(type="integer")
*/
private $id;
/**
* @Column(type="string")
*/
private $nome;
public function getNome() : string
{
return $this->nome;
}
public function setNome($nome) : self
{
$this->nome = $nome;
return $this;
}
public function getId() : int
{
return $this->id;
}
}
Classe EntityManagerFactory:
<?php
namespace Alura\Doctrine\Helper;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Setup;
class EntityManagerFactory
{
/**
* @return EntityManagerInterface
* @throws \Doctrine\ORM\ORMException
*/
public function getEntityManager() : EntityManagerInterface
{
$rootDir = __DIR__ . '/../..';
$config = Setup::createAnnotationMetadataConfiguration([
$rootDir . '/src',
true
]);
$connection = [
'driver' => 'pdo_sqlite',
'path' => $rootDir . '/var/data/banco.sqlite'
];
return EntityManager::create($connection, $config);
}
}
Obs: Estou usando o Visual Studio Code, e a versão instalada do PHP é: 7.4.0