php - Configuring Symfony DoctrineCouchDBBundle -
i'm new symfony 2 , having difficulty setting doctrine. i'm getting following error when try persist model: class 'foo' not found in chain configured namespaces.
i have bootstrap file requires composer autoloader , registers loader annotationregistry
use doctrine\common\annotations\annotationregistry; $loader = require "vendor/autoload.php"; annotationregistry::registerloader(array($loader, "loadclass"));
i have couchdb configured in config.yml
doctrine_couch_db: client: connections: default: dbname: foo host: data.foo port: 5984 odm: document_managers: default: connection: default
my model tagged annotations
use doctrine\odm\couchdb\mapping\annotations odm; /** * model object foo data. * @odm\document */ class foo { ... }
i've got containerawarecommand use doctrine objectmanager
$dm = $this->getcontainer()->get("doctrine_couchdb.odm.default_document_manager");
but when try persist
$dm->persist(new foo());
i error
the class 'foo' not found in chain configured namespaces
edit: upon further investigation, mappingdriverchain empty. there no defaultdriver , no values in drivers array. don't know how gets populated, seems root problem.
basically took me 2 hours problem solved myself. have put entities not entity folder couchdocument folder autoload.
second needed add bundle manager configuration follows:
doctrine_couch_db: client: dbname: sddb odm: document_managers: default: mappings: sddbbundle: type: annotation auto_mapping: true
namespace document looks like:
namespace sddb\sddbbundle\couchdocument;
sometimes documentation no best... cause no 1 tells in fast , dirty start example
Comments
Post a Comment