Класс & quot; Gedmo \ Loggable \ Entity \ LogEntry & quot; Это не допустимый объект или сопоставленный суперкласс

Я пытаюсь использовать расширения Gedmo Loggable для Doctrine2, но у меня возникла ошибка, и я не понял, почему.

Я получил ошибку

Фатальная ошибка: Uncaught Doctrine \ ORM \ Mapping \ MappingException: Class
Подкласс «Gedmo \ Loggable \ Entity \ LogEntry»
«Gedmo \ Loggable \ Entity \ MappedSuperclass \ AbstractLogEntry» не является
действительный объект или сопоставленный суперкласс. в
C: \ Projects \ easyprod \ librairies \ доктрина \ ORM \ Lib \ Doctrine \ ORM \ Mapping \ MappingException.php
по линии 340

когда я бегу

$article = new \classeDoctrine\Article;
$article->setTitle('my title');
$oGestionnaireEntites->persist($article);
$oGestionnaireEntites->flush();

$article = $oGestionnaireEntites->find('\classeDoctrine\Article', 1);
$article->setTitle('my new title');
$oGestionnaireEntites->persist($article);
$oGestionnaireEntites->flush();

//$repo = $em->getRepository('Gedmo\Loggable\Entity\LogEntry');

$repo = $oGestionnaireEntites->getRepository('Gedmo\Loggable\Entity\LogEntry'); // we use default log entry class
$article = $oGestionnaireEntites->find('classeDoctrine\Article', 1);
$logs = $repo->getLogEntries($article);

// lets revert to first version
$repo->revert($article, 1);
// notice article is not persisted yet, you need to persist and flush it
echo $article->getTitle(); // prints "my title"$oGestionnaireEntites->persist($article);
$oGestionnaireEntites->flush();

конфигурационный файл-

use Doctrine\ORM\EntityManager,
Doctrine\ORM\Configuration,
Doctrine\ORM\Tools\Setup,
Doctrine\ORM\Proxy\Autoloader;
use Doctrine\Common\Annotations\AnnotationRegistry;

//charge l'autoload voir composer.json
require_once ROOT . "/librairies/autoload.php";

// First of all autoloading of vendors
$loader = require ROOT . "/librairies/autoload.php";
// gedmo extensions
$loader->add('Gedmo', ROOT . "/librairies/gedmo/doctrine-extensions/lib");

$tCheminEntites = array(
ROOT . '/class/doctrine',
ROOT . '/class/doctrine/entite/grilleResultat',
ROOT . '/class/doctrine/entite/analyse',
ROOT . '/class/doctrine/entite/matrice',
ROOT . '/class/doctrine/entite/test',
);

foreach ($tCheminEntites as $sCheminEntite) {
// autoloader for Entity namespace
$loader->add('classeDoctrine', $sCheminEntite);
}



//Paramètre de la base de données
$tBddParametres = array(
'driver' => 'pdo_mysql',
'user' => 'root',
'password' => '',
'dbname' => 'easyprod',
'charset' => 'UTF8'
);



Doctrine\Common\Annotations\AnnotationRegistry::registerFile(
ROOT . '/librairies/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php'
);


$bModeDeveloppement = true;
// globally used cache driver, in production use APC or memcached
$cache = new Doctrine\Common\Cache\ArrayCache;
// standard annotation reader
$annotationReader = new Doctrine\Common\Annotations\SimpleAnnotationReader();
$annotationReader->addNamespace('Doctrine\ORM\Mapping');
$cachedAnnotationReader = new Doctrine\Common\Annotations\CachedReader(
$annotationReader, // use reader
$cache // and a cache driver
);
// create a driver chain for metadata reading
$driverChain = new Doctrine\ORM\Mapping\Driver\DriverChain();
// load superclass metadata mapping only, into driver chain
// also registers Gedmo annotations.NOTE: you can personalize it
Gedmo\DoctrineExtensions::registerAbstractMappingIntoDriverChainORM(
$driverChain, // our metadata driver chain, to hook into
$cachedAnnotationReader // our cached annotation reader
);

// now we want to register our application entities,
// for that we need another metadata driver used for Entity namespace
$annotationDriver = new Doctrine\ORM\Mapping\Driver\AnnotationDriver(
$cachedAnnotationReader, // our cached annotation reader
$tCheminEntites// paths to look in
);



// NOTE: driver for application Entity can be different, Yaml, Xml or whatever
// register annotation driver for our application Entity namespace
$driverChain->addDriver($annotationDriver, 'classeDoctrine');



//$oDefaultAnnotationDriver = $config->newDefaultAnnotationDriver($tCheminEntites);
// NOTE: driver for application Entity can be different, Yaml, Xml or whatever
// register annotation driver for our application Entity fully qualified namespace
//$driverChain->addDriver($oDefaultAnnotationDriver, 'classeDoctrine');
// general ORM configuration
$config = new Doctrine\ORM\Configuration;
$config->setProxyDir(sys_get_temp_dir());
$config->setProxyNamespace('Proxy');
$config->setAutoGenerateProxyClasses(false); // this can be based on production config.
// register metadata driver
$config->setMetadataDriverImpl($driverChain);
// use our already initialized cache driver
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);






// create event manager and hook preferred extension listeners
$evm = new Doctrine\Common\EventManager();
// gedmo extension listeners, remove which are not used
// loggable, not used in example
$loggableListener = new Gedmo\Loggable\LoggableListener;
$loggableListener->setAnnotationReader($cachedAnnotationReader);
$evm->addEventSubscriber($loggableListener);


//Paramètre de la base de données
$tBddParametres = array(
'driver' => 'pdo_mysql',
'user' => 'root',
'password' => '',
'dbname' => 'easyprod',
'charset' => 'UTF8'
);

$oGestionnaireEntites = EntityManager::create($tBddParametres, $config, $evm);

$oGestionnaireEntites->getConfiguration()->addCustomHydrationMode('HydratorValeurSansNomColonne', 'boiteAOutils\HydratorValeurSansNomColonne');

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]