Laravel 4 拉维公司;Couchdb ODM-注释@条令\ODM\CouchDB\Mapping\Annotations\Document“;不存在,或无法自动加载
我想在Laravel4.2中使用couchdb odm,但我不断地出错。最后一点是: [语义错误]IO\Documents\Article类中的批注“@Doctrine\ODM\CouchDB\Mapping\Annotations\Document”不存在,或无法自动加载 我主要复制了sandbox/bootstrap.php,并尝试了来自同一问题先前答案的一些建议。以下是我目前拥有的: My composer.json具有:Laravel 4 拉维公司;Couchdb ODM-注释@条令\ODM\CouchDB\Mapping\Annotations\Document“;不存在,或无法自动加载,laravel-4,couchdb,Laravel 4,Couchdb,我想在Laravel4.2中使用couchdb odm,但我不断地出错。最后一点是: [语义错误]IO\Documents\Article类中的批注“@Doctrine\ODM\CouchDB\Mapping\Annotations\Document”不存在,或无法自动加载 我主要复制了sandbox/bootstrap.php,并尝试了来自同一问题先前答案的一些建议。以下是我目前拥有的: My composer.json具有: "require": { "laravel/framewo
"require": {
"laravel/framework": "4.2.*",
"symfony/console": ">=2.0",
"doctrine/dbal": "2.5.*@dev",
"doctrine/migrations": "1.0.*@dev",
"doctrine/common": "2.4.*",
"doctrine/couchdb": "@dev",
"doctrine/couchdb-odm": "dev-master"
},
我还试图把条令/普通放在自动加载部分,但这并没有真正起到任何作用
文章类别:
namespace IO\Documents;
use Doctrine\ODM\CouchDB\Mapping\Annotations\Document;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Document(indexed=true)
*/
class Article {}
<?php
namespace IO\Documents;
use Doctrine\ODM\CouchDB\Mapping\Annotations as CouchDB;
/**
* @Document
*/
class Article ()
我的控制器:
$database = "test";
$httpClient = new \Doctrine\CouchDB\HTTP\SocketClient();
$resp = $httpClient->request('PUT', '/' . $database);
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
// doesn't exist so I comment out
// $reader->registerAnnotationClasses('Doctrine\ODM\CouchDB\Mapping\\');
$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->setLuceneHandlerName('_fti');
$couchClient = new \Doctrine\CouchDB\CouchDBClient($httpClient, $database);
$dm = \Doctrine\ODM\CouchDB\DocumentManager::create($couchClient, $config);
$article1 = new Article();
$article1->setTitle("Who is John Galt?");
$article1->setBody("Find out!");
$dm->persist($article1);
$dm->flush();
$dm->clear();
$annotationNs = 'Doctrine\\ODM\\CouchDB\\Mapping\\Annotations';
$couchPath = '/path/to/vendor/doctrine/couchdb-odm/lib';
\Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace($annotationNs, $couchPath);
$databaseName = "test";
$documentPaths = array("IO\Documents");
$httpClient = new \Doctrine\CouchDB\HTTP\SocketClient();
$dbClient = new \Doctrine\CouchDB\CouchDBClient($httpClient, $databaseName);
$config = new \Doctrine\ODM\CouchDB\Configuration();
$metadataDriver = $config->newDefaultAnnotationDriver($documentPaths);
$config->setProxyDir(__DIR__ . "/proxies");
$config->setMetadataDriverImpl($metadataDriver);
$dm = new \Doctrine\ODM\CouchDB\DocumentManager($dbClient, $config);
$article1 = new Article();
$article1->setTitle("Who is John Galt?");
$article1->setBody("Find out!");
$dm->persist($article1);
$dm->flush($article1);
我仍然是couchdb的初学者,所以这会让我感到困惑。composer dump autoload成功了 此外,以下是我的控制器的更新:
$database = "test";
$httpClient = new \Doctrine\CouchDB\HTTP\SocketClient();
$resp = $httpClient->request('PUT', '/' . $database);
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
// doesn't exist so I comment out
// $reader->registerAnnotationClasses('Doctrine\ODM\CouchDB\Mapping\\');
$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->setLuceneHandlerName('_fti');
$couchClient = new \Doctrine\CouchDB\CouchDBClient($httpClient, $database);
$dm = \Doctrine\ODM\CouchDB\DocumentManager::create($couchClient, $config);
$article1 = new Article();
$article1->setTitle("Who is John Galt?");
$article1->setBody("Find out!");
$dm->persist($article1);
$dm->flush();
$dm->clear();
$annotationNs = 'Doctrine\\ODM\\CouchDB\\Mapping\\Annotations';
$couchPath = '/path/to/vendor/doctrine/couchdb-odm/lib';
\Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace($annotationNs, $couchPath);
$databaseName = "test";
$documentPaths = array("IO\Documents");
$httpClient = new \Doctrine\CouchDB\HTTP\SocketClient();
$dbClient = new \Doctrine\CouchDB\CouchDBClient($httpClient, $databaseName);
$config = new \Doctrine\ODM\CouchDB\Configuration();
$metadataDriver = $config->newDefaultAnnotationDriver($documentPaths);
$config->setProxyDir(__DIR__ . "/proxies");
$config->setMetadataDriverImpl($metadataDriver);
$dm = new \Doctrine\ODM\CouchDB\DocumentManager($dbClient, $config);
$article1 = new Article();
$article1->setTitle("Who is John Galt?");
$article1->setBody("Find out!");
$dm->persist($article1);
$dm->flush($article1);
我的文章类别:
namespace IO\Documents;
use Doctrine\ODM\CouchDB\Mapping\Annotations\Document;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @Document(indexed=true)
*/
class Article {}
<?php
namespace IO\Documents;
use Doctrine\ODM\CouchDB\Mapping\Annotations as CouchDB;
/**
* @Document
*/
class Article ()
真管用!谢谢,伙计!我认为问题在于我缺少$couchPath='/path/to/vendor/doctrine/couchdb odm/lib'