I've noticed a possible bug (but probable user error :D) when trying to get all the versions of a document.
It seems that once I call $manager->getAllLinearVersions(), the result doesn't change, even if there are further checkpoints made in the same PHP script:
/** TestDocument class **/
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
use Doctrine\ODM\PHPCR\Document\Generic;
/**
* @PHPCRODM\Document(referenceable=true, versionable="full")
*/
class TestDocument extends Generic
{
}
/** Code from my test command **/
// Setup
$manager = $this->getApplication()->getKernel()->getContainer()->get('doctrine_phpcr.odm.document_manager');
$rootNode = $manager->find(null, '/');
// Start with a blank slate each time
$document = $manager->find(null, '/test');
if (null !== $document) {
$manager->remove($document);
$manager->flush();
}
// Create a test document
$document = new TestDocument();
$document->setNodename('test');
$document->setParent($rootNode);
$manager->persist($document);
$manager->flush();
// Create a version
$manager->checkpoint($document);
$manager->flush();
// Comment me out to see the result of the var_dump below change
// Gives "2" as expected
var_dump(count($manager->getAllLinearVersions($document)));
// Create a version
$manager->checkpoint($document);
$manager->flush();
// This should give 3, but gives 2 if the above call to getAllLinearVersions runs
var_dump(count($manager->getAllLinearVersions($document)));
// Try to reset everything
$manager->clear();
$document = $manager->find(null, '/test');
// This is still stuck on the result of the first call :(
var_dump(count($manager->getAllLinearVersions($document)));
Is there anything I can do to 'reset' the getAllLinearVersions() result, or is this a bug?
Lars.