Exemplo n.º 1
0
 /**
  * Get item from queue as Structure if array put into queue
  * 
  * @return mixed|\Sokil\Mongo\Structure
  */
 public function dequeue()
 {
     $value = $this->dequeuePlain();
     if (!is_array($value)) {
         return $value;
     }
     $structure = new Structure();
     $structure->mergeUnmodified($value);
     return $structure;
 }
Exemplo n.º 2
0
 public function testPushStructure()
 {
     // create document
     $doc = $this->collection->createDocument(array('some' => 'some'));
     $structure = new Structure();
     $structure->mergeUnmodified(array('param' => 'value'));
     $doc->push('field', $structure);
     $doc->push('field', $structure);
     $this->assertEquals(array(array('param' => 'value'), array('param' => 'value')), $doc->get('field'));
 }
Exemplo n.º 3
0
 public function testLoad_setUnmodifiedWithoutDots()
 {
     $structure = new Structure();
     $structure->mergeUnmodified(array('param' => 'value'));
     $this->assertEquals('value', $structure->get('param'));
     $this->assertFalse($structure->isModified('param'));
 }