Exemple #1
0
 public function testHasGetSet()
 {
     $object1 = new \DateTime();
     $object2 = new \ArrayObject();
     $this->assertFalse(Archive::has($object1, 'field1'));
     $this->assertFalse(Archive::has($object1, 'field2'));
     $this->assertFalse(Archive::has($object2, 'field3'));
     Archive::set($object1, 'field1', 'foo');
     Archive::set($object1, 'field3', 'bar');
     Archive::set($object2, 'field2', 'ups');
     $this->assertTrue(Archive::has($object1, 'field1'));
     $this->assertFalse(Archive::has($object1, 'field2'));
     $this->assertTrue(Archive::has($object1, 'field3'));
     $this->assertFalse(Archive::has($object2, 'field1'));
     $this->assertTrue(Archive::has($object2, 'field2'));
     $this->assertFalse(Archive::has($object2, 'field3'));
     $this->assertSame('foo', Archive::get($object1, 'field1'));
     $this->assertSame('bar', Archive::get($object1, 'field3'));
     $this->assertSame('ups', Archive::get($object2, 'field2'));
     Archive::remove($object1, 'field1');
     $this->assertFalse(Archive::has($object1, 'field1'));
     $this->assertTrue(Archive::has($object1, 'field3'));
     $this->assertTrue(Archive::has($object2, 'field2'));
 }
Exemple #2
0
 /**
  * Clear the query hashes.
  */
 public function clearQueryHashes()
 {
     Archive::remove($this, 'query_hashes');
 }
Exemple #3
0
 /**
  * Clears the remove queue of the group.
  *
  * @api
  */
 public function clearRemove()
 {
     Archive::remove($this, 'remove');
 }
Exemple #4
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);
         }
     }
 }