public function testGetOrDefault() { $object = new \DateTime(); $this->assertSame('foobar', Archive::getOrDefault($object, 'field1', 'foobar')); Archive::set($object, 'field2', 'ups'); $this->assertSame('ups', Archive::getOrDefault($object, 'field2', 'foobar')); }
/** * Returns the discriminator map. * * @return array|Boolean The discriminator map. * * @api */ public function getDiscriminatorMap() { return Archive::get($this, 'discriminatorMap'); }
/** * Returns the root and path of the embedded document. * * @return array An array with the root and path (root and path keys) or null if they do not exist. * * @api */ public function getRootAndPath() { return Archive::getOrDefault($this, 'root_and_path', null); }
protected function tearDown() { Archive::clear(); IdGeneratorContainer::reset(); TypeContainer::reset(); }
/** * Clear the query hashes. */ public function clearQueryHashes() { Archive::remove($this, 'query_hashes'); }
/** * Returns the saved data. * * @return array|null The saved data or null if it does not exist. */ public function getSavedData() { return Archive::getOrDefault($this, 'saved_data', null); }
/** * Returns the reference field. * * @return string The reference field. * * @api */ public function getField() { return Archive::get($this, 'field'); }
/** * Clears the remove queue of the group. * * @api */ public function clearRemove() { Archive::remove($this, 'remove'); }
/** * Returns the discriminator field. * * @return string The discriminator field. * * @api */ public function getDiscriminatorField() { return Archive::get($this, 'discriminatorField'); }
/** * Clear the embedded ones changed, that is, they will not be changed apart from here. * * @api */ public function clearEmbeddedsOneChanged() { if (isset($this->data['embeddedsOne'])) { foreach ($this->data['embeddedsOne'] as $name => $embedded) { Archive::remove($this, 'embedded_one.' . $name); } } }
/** * Returns the document class. * * @api */ public function getDocumentClass() { return Archive::get($this, 'document_class'); }