/** * 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; }
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')); }
public function testLoad_setUnmodifiedWithoutDots() { $structure = new Structure(); $structure->mergeUnmodified(array('param' => 'value')); $this->assertEquals('value', $structure->get('param')); $this->assertFalse($structure->isModified('param')); }