Beispiel #1
0
 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'));
 }
Beispiel #2
0
 /**
  * Returns the discriminator map.
  *
  * @return array|Boolean The discriminator map.
  *
  * @api
  */
 public function getDiscriminatorMap()
 {
     return Archive::get($this, 'discriminatorMap');
 }
Beispiel #3
0
 /**
  * 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);
 }
Beispiel #4
0
 protected function tearDown()
 {
     Archive::clear();
     IdGeneratorContainer::reset();
     TypeContainer::reset();
 }
Beispiel #5
0
 /**
  * Clear the query hashes.
  */
 public function clearQueryHashes()
 {
     Archive::remove($this, 'query_hashes');
 }
Beispiel #6
0
 /**
  * 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);
 }
Beispiel #7
0
 /**
  * Returns the reference field.
  *
  * @return string The reference field.
  *
  * @api
  */
 public function getField()
 {
     return Archive::get($this, 'field');
 }
Beispiel #8
0
 /**
  * Clears the remove queue of the group.
  *
  * @api
  */
 public function clearRemove()
 {
     Archive::remove($this, 'remove');
 }
Beispiel #9
0
 /**
  * Returns the discriminator field.
  *
  * @return string The discriminator field.
  *
  * @api
  */
 public function getDiscriminatorField()
 {
     return Archive::get($this, 'discriminatorField');
 }
Beispiel #10
0
 /**
  * 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);
         }
     }
 }
Beispiel #11
0
 /**
  * Returns the document class.
  *
  * @api
  */
 public function getDocumentClass()
 {
     return Archive::get($this, 'document_class');
 }