Tag.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Muzich\CoreBundle\Mining\Tag;
  3. use Doctrine\ORM\EntityManager;
  4. use Doctrine\Bundle\MongoDBBundle\ManagerRegistry as MongoManagerRegistry;
  5. use Doctrine\ODM\MongoDB\DocumentRepository;
  6. use Doctrine\ODM\MongoDB\DocumentManager;
  7. class Tag
  8. {
  9. protected $doctrine_entity_manager;
  10. protected $mongo_manager_registry;
  11. public function __construct(EntityManager $doctrine_entity_manager, MongoManagerRegistry $mongo_manager_registry)
  12. {
  13. $this->doctrine_entity_manager = $doctrine_entity_manager;
  14. $this->mongo_manager_registry = $mongo_manager_registry;
  15. }
  16. /** @return EntityManager */
  17. protected function getDoctrineEntityManager()
  18. {
  19. return $this->doctrine_entity_manager;
  20. }
  21. /** @return DocumentRepository */
  22. protected function getMongoRepository($repository)
  23. {
  24. return $this->mongo_manager_registry->getRepository($repository);
  25. }
  26. /** @return DocumentManager */
  27. protected function getMongoManager()
  28. {
  29. return $this->mongo_manager_registry->getManager();
  30. }
  31. }