Doctrine\ODM\CouchDB\DocumentManager::clear PHP Method

clear() public method

Clears the ObjectManager. All objects that are currently managed by this ObjectManager become detached.
public clear ( string $objectName = null )
$objectName string if given, only objects of this type will get detached
    public function clear($objectName = null)
    {
        if ($objectName === null) {
            // Todo: Do a real delegated clear?
            $this->unitOfWork = new UnitOfWork($this);
        } else {
            //TODO
            throw new CouchDBException("DocumentManager#clear(\$objectName) not yet implemented.");
        }
    }

Usage Example

 public function testLoadingMappedsuperclass()
 {
     $document = new ExtendingClass();
     $document->topic = 'Superclass test';
     $document->headline = 'test test test';
     $this->dm->persist($document);
     $this->dm->flush();
     $id = $document->id;
     $this->dm->clear();
     $doc = $this->dm->find('Doctrine\\Tests\\Models\\Mapping\\ExtendingClass', $id);
     $this->assertInstanceOf('\\Doctrine\\Tests\\Models\\Mapping\\ExtendingClass', $doc);
     $this->assertEquals('test test test', $doc->headline);
     $this->assertEquals('Superclass test', $doc->topic);
 }