Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. doctrine_mongodb:
  2. connections:
  3. default:
  4. server: mongodb://localhost:27017
  5. options:
  6. connect: true
  7. default_database: symfony2
  8. document_managers:
  9. default:
  10. auto_mapping: true
  11.  
  12. <?php
  13. namespace HALLHelloWorldBundleDocument;
  14. use FOSUserBundleDocumentUser as BaseUser;
  15. use DoctrineODMMongoDBMappingAnnotations as MongoDB;
  16.  
  17. /**
  18. * @MongoDBDocument
  19. */
  20. class User extends BaseUser
  21. {
  22. /** @MongoDBId(strategy="auto") */
  23. protected $id;
  24.  
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. // your own logic
  29. }
  30. }
  31.  
  32. php app/console doctrine:mongodb:generate:documents HALLHelloWorldBundle
  33.  
  34. AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php');
  35.  
  36. DoctrineODMMongoDBMappingDriverAnnotationDriver::registerAnnotationClasses();
  37.  
  38. use DoctrineODMMongoDBConfiguration;
  39.  
  40. .........
  41.  
  42. $configuration = new Configuration();
  43. $driver = $configuration->newDefaultAnnotationDriver($path_to_docs);
  44. $driver->registerAnnotationClasses();
  45.  
  46. <?php
  47.  
  48. use DoctrineCommonAnnotationsAnnotationRegistry;
  49. use DoctrineODMMongoDBMappingDriverAnnotationDriver; <-- add this line
  50.  
  51. $loader = require __DIR__.'/../vendor/autoload.php';
  52.  
  53. if (!function_exists('intl_get_error_code')) {
  54. require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
  55.  
  56. $loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
  57. }
  58.  
  59. AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
  60.  
  61. AnnotationDriver::registerAnnotationClasses(); <-- add this line
  62.  
  63. return $loader;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement