You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
Very good with everyone, please could you help me with this error that appears to me, already tried of everything but I do not get to solve.
Fatal error: Uncaught exception 'Doctrine\ODM\CouchDB\Mapping\MappingException' with message 'Class Documents\Article is not a valid document or mapped super class.' in C:\xampp\htdocs\CouchDoctrineODM\lib\Doctrine\ODM\CouchDB\Mapping\MappingException.php:23
Stack trace:
#0 C:\xampp\htdocs\CouchDoctrineODM\lib\Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver.php(62): Doctrine\ODM\CouchDB\Mapping\MappingException::classIsNotAValidDocument('Documents\Artic...') #1 C:\xampp\htdocs\CouchDoctrineODM\lib\Doctrine\ODM\CouchDB\Mapping\ClassMetadataFactory.php(71): Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver->loadMetadataForClass('Documents\Artic...', Object(Doctrine\ODM\CouchDB\Mapping\ClassMetadata)) #2 C:\xampp\htdocs\CouchDoctrineODM\lib\vendor\doctrine-common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(302): Doctrine\ODM\CouchDB\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ODM\CouchDB\Mapping\ClassMetadata), NULL, false, Array) #3 C:\xampp\htdocs\CouchDoctrineODM\lib in C:\xampp\htdocs\CouchDoctrineODM\lib\Doctrine\ODM\CouchDB\Mapping\MappingException.php on line 23
This is my file Documents\Article.php
created = new \DateTime("now");
}
public function getId()
{
return $this->id;
}
public function getTitle()
{
return $this->title;
}
public function setTitle($title)
{
$this->title = $title;
}
public function getBody()
{
return $this->body;
}
public function setBody($body)
{
$this->body = $body;
}
public function getCreated()
{
return $this->created;
}
}
And this is my file boostrap.php.
register();
$loader = new \Doctrine\Common\ClassLoader("Doctrine", __DIR__ . "/lib");
$loader->register();
$loader = new \Doctrine\Common\ClassLoader("Symfony", __DIR__ . "/lib/vendor");
$loader->register();
$loader = new \Doctrine\Common\ClassLoader("Documents", __DIR__);
$loader->register();
$database = "doctrine_sandbox";
$httpClient = new \Doctrine\CouchDB\HTTP\SocketClient();
// create database if not existing
$resp = $httpClient->request('PUT', '/' . $database);
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$paths = __DIR__ . "/Documents";
$metaDriver = new \Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver($reader, $paths);
$config = new \Doctrine\ODM\CouchDB\Configuration();
$config->setProxyDir(\sys_get_temp_dir());
$config->setMetadataDriverImpl($metaDriver);
$config->newDefaultAnnotationDriver(array("/Documents"));
$config->setLuceneHandlerName('_fti');
$couchClient = new \Doctrine\CouchDB\CouchDBClient($httpClient, $database);
$dm = \Doctrine\ODM\CouchDB\DocumentManager::create($couchClient, $config);
$article1 = new \Documents\Article();
$article1->setTitle("Who is John Galt?");
$article1->setBody("Find out!");
$dm->persist($article1);
$dm->flush();
**********************************************************************************************
If you get to create the database, the error is in the mapping.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Very good with everyone, please could you help me with this error that appears to me, already tried of everything but I do not get to solve.
Fatal error: Uncaught exception 'Doctrine\ODM\CouchDB\Mapping\MappingException' with message 'Class Documents\Article is not a valid document or mapped super class.' in C:\xampp\htdocs\CouchDoctrineODM\lib\Doctrine\ODM\CouchDB\Mapping\MappingException.php:23
Stack trace:
#0 C:\xampp\htdocs\CouchDoctrineODM\lib\Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver.php(62): Doctrine\ODM\CouchDB\Mapping\MappingException::classIsNotAValidDocument('Documents\Artic...')
#1 C:\xampp\htdocs\CouchDoctrineODM\lib\Doctrine\ODM\CouchDB\Mapping\ClassMetadataFactory.php(71): Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver->loadMetadataForClass('Documents\Artic...', Object(Doctrine\ODM\CouchDB\Mapping\ClassMetadata))
#2 C:\xampp\htdocs\CouchDoctrineODM\lib\vendor\doctrine-common\lib\Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory.php(302): Doctrine\ODM\CouchDB\Mapping\ClassMetadataFactory->doLoadMetadata(Object(Doctrine\ODM\CouchDB\Mapping\ClassMetadata), NULL, false, Array)
#3 C:\xampp\htdocs\CouchDoctrineODM\lib in C:\xampp\htdocs\CouchDoctrineODM\lib\Doctrine\ODM\CouchDB\Mapping\MappingException.php on line 23
This is my file Documents\Article.php
created = new \DateTime("now"); } public function getId() { return $this->id; } public function getTitle() { return $this->title; } public function setTitle($title) { $this->title = $title; } public function getBody() { return $this->body; } public function setBody($body) { $this->body = $body; } public function getCreated() { return $this->created; } } And this is my file boostrap.php. register(); $loader = new \Doctrine\Common\ClassLoader("Doctrine", __DIR__ . "/lib"); $loader->register(); $loader = new \Doctrine\Common\ClassLoader("Symfony", __DIR__ . "/lib/vendor"); $loader->register(); $loader = new \Doctrine\Common\ClassLoader("Documents", __DIR__); $loader->register(); $database = "doctrine_sandbox"; $httpClient = new \Doctrine\CouchDB\HTTP\SocketClient(); // create database if not existing $resp = $httpClient->request('PUT', '/' . $database); $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $paths = __DIR__ . "/Documents"; $metaDriver = new \Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver($reader, $paths); $config = new \Doctrine\ODM\CouchDB\Configuration(); $config->setProxyDir(\sys_get_temp_dir()); $config->setMetadataDriverImpl($metaDriver); $config->newDefaultAnnotationDriver(array("/Documents")); $config->setLuceneHandlerName('_fti'); $couchClient = new \Doctrine\CouchDB\CouchDBClient($httpClient, $database); $dm = \Doctrine\ODM\CouchDB\DocumentManager::create($couchClient, $config); $article1 = new \Documents\Article(); $article1->setTitle("Who is John Galt?"); $article1->setBody("Find out!"); $dm->persist($article1); $dm->flush(); ********************************************************************************************** If you get to create the database, the error is in the mapping.The text was updated successfully, but these errors were encountered: