/**
  * Create service with name
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @param string $name
  * @param string $requestedName
  * @return StorageInterface
  */
 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     $config = $this->getConfig($serviceLocator)[$requestedName];
     /** @var $mongoDb \MongoDB */
     $mongoDb = $serviceLocator->get($config['database']);
     $mongoCollection = new \MongoCollection($mongoDb, $config['collection']);
     $adapter = new MongoAdapter();
     if (isset($config['identifier'])) {
         $adapter->setIdentifierName($config['identifier']);
     }
     return $adapter->setMongoCollection($mongoCollection);
 }
Example #2
0
 public function testMongoAdapterUpdate()
 {
     $this->assertTrue($this->adapter->updateImage('id', $this->image));
 }