Estoy intentando generar repositorios entidad y conseguir dichos mensajesDoctrina 2 - Clases No hay metadatos para procesar por ORM: generate-repositorios
ClasesNo hay metadatos para procesar
que había rastreado por ese uso de
use Doctrine \ ORM \ Mapping as ORM; y @ORM \ Table no funciona correctamente.
Si cambio todo @ORM \ Table a simplemente @Table (y otras anotaciones) - comienza a funcionar, pero realmente no quiero que sea así ya que debería funcionar con la anotación @ORM.
Seguí las instrucciones de la página siguiente sin suerte. Sé que estoy cerca pero me falta algo con las rutas de archivos o los espacios de nombres. Por favor ayuda.
http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/annotations.html
¿Alguien tenía tal problema? ¿Qué me falta?
cli-config,
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
require_once 'Doctrine/Common/ClassLoader.php';
define('APPLICATION_ENV', "development");
error_reporting(E_ALL);
//AnnotationRegistry::registerFile("Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
//AnnotationRegistry::registerAutoloadNamespace("Symfony\Component\Validator\Constraint", "Doctrine/Symfony");
//AnnotationRegistry::registerAutoloadNamespace("Annotations", "/Users/ivv/workspaceShipipal/shipipal/codebase/application/persistent/");
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine');
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__ . '/application/');
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__ . '/application/persistent');
$classLoader->register();
$config = new \Doctrine\ORM\Configuration();
$config->setProxyDir(__DIR__ . '/application/persistent/Proxies');
$config->setProxyNamespace('Proxies');
$config->setAutoGenerateProxyClasses((APPLICATION_ENV == "development"));
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__ . "/application/persistent/Entities"));
$config->setMetadataDriverImpl($driverImpl);
if (APPLICATION_ENV == "development") {
$cache = new \Doctrine\Common\Cache\ArrayCache();
} else {
$cache = new \Doctrine\Common\Cache\ApcCache();
}
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
$connectionOptions = array(
'driver' => 'pdo_mysql',
'host' => '127.0.0.1',
'dbname' => 'mydb',
'user' => 'root',
'password' => ''
);
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
$platform = $em->getConnection()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
User.php (versión de trabajo, en un principio que era como se describe, @Table era @ORM \ Mesa y otras anotaciones similar había @ORM \ parte como @ORM \ Columna etc)
<?php
namespace Entities;
use Doctrine\Mapping as ORM;
/**
* User
*
* @Table(name="user")
* @Entity(repositoryClass="Repository\User")
*/
class User
{
/**
* @var integer $id
*
* @Column(name="id", type="integer", nullable=false)
* @Id
* @GeneratedValue
*/
private $id;
/**
* @var string $userName
*
* @Column(name="userName", type="string", length=45, nullable=false)
*/
private $userName;
/**
* @var string $email
*
* @Column(name="email", type="string", length=45, nullable=false)
*/
private $email;
/**
* @var text $bio
*
* @Column(name="bio", type="text", nullable=true)
*/
private $bio;
public function __construct()
{
}
}
I'm having the same issue just now. I'll post an answer if I can find a solution. – Gohn67
posting the code of the entity and reader, and directory structure might help getting an accurate answer. –
added sourcec code for cli config and User.php – waney