The past few days I've been really interested in PHPCR
and how it could be used to track versions of Documents
. Unfortunately it seems I can't manage to get the versioning to work with Doctrine
in PostgreSQL
for some reason.
According to the documentation of phpcr and doctrine, simpleVersioning
should be working just fine, but when I try to create a checkpoint
I receive the following exception:
Transport does not support versioning
in vendor/jackalope/jackalope/src/Jackalope/Workspace.php at line 294
I'm kind of confused what seems to be the problem here and why this is failing? Here is my document:
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
/**
* @PHPCR\Document(versionable="simple")
*/
class Task {
/**
* @PHPCR\Id()
*/
protected $id;
/**
* @PHPCR\String()
*/
protected $description;
/**
* @PHPCR\Boolean()
*/
protected $done = false;
/**
* @PHPCR\ParentDocument()
*/
protected $parentDocument;
/**
* @PHPCR\VersionName()
*/
private $versionName;
/**
* @PHPCR\VersionCreated()
*/
private $versionCreated;
/* Getters and setters for all fields... */
}
And here is the code I'm using in a controller:
/**
* @var DocumentManager $dm
*/
$dm = $this->get('doctrine_phpcr')->getManager();
$rootTask = $dm->find(null, '/tasks');
$task = new Task();
$task->setDescription('Finish CMF project');
$task->setParentDocument($rootTask);
$dm->persist($task);
$dm->flush();
$dm->checkpoint($task);
$task->setDescription("Some new description");
$dm->persist($task);
$dm->flush();