jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Buchmann <da...@liip.ch>
Subject Re: Trying to understand and use version cascade
Date Sat, 02 Mar 2013 12:55:42 GMT
hi,

i don't fully grasp things, but after another hunt through the jcr doc,
i think your cnd is not correct. there is an on-parent-version or
onParentVersion attribute that controls if children are versioned along.
best try to read this chapter:
http://www.day.com/specs/jcr/2.0/15_Versioning.html
it will mostly shorten the feature to OPV - maybe this helps?

     [phpcr:versionCascade] > nt:unstructured
         + * multiple copy

i think the "multiple" here means there may be same-name siblings (which
you should not need to explicitly allow as its the default. and in the
context of jackalope and phpcr-odm, its actually not working at all.
i don't know what the "copy" stands for, but i think you need an
onParentVersion attribute set somewhere.

btw,
> The nt:unstructured type I'm inheriting from comes from part of the
> PHPCR project, I believe it uses this:

nt:unstructured is not a PHPCR specific thing but part of JCR too.

cheers,
david



Am 28.02.2013 16:55, schrieb Lars Janssen:
> Hi all,
> 
> I'm new to the list, but did have a good look through the archives. :)
> 
> My problem: I have nodes representing pages and blocks (of content) in a
> CMS. Pages can contain pages or blocks. I'm looking to add page versioning
> capability, such that if I create a checkpoint (version) on a page, the
> same is done for all child blocks (although to keep this simple, I'm
> initially just trying to let it happen for all children).
> 
> I'm using Jackrabbit 2.4.3 and PHP Content
> Repository[1]/Jackalope-Jackrabbit[2] to connect my PHP application to it.
> 
> Here's the CND for the node type I'm using:
> 
>     [phpcr:versionCascade] > nt:unstructured
>         + * multiple copy
> 
> The nt:unstructured type I'm inheriting from comes from part of the PHPCR
> project, I believe it uses this:
> 
>     [nt:unstructured]
>       ORDERABLE
>       - * (UNDEFINED) MULTIPLE
>       - * (UNDEFINED)
>       + * (nt:base) = nt:unstructured SNS VERSION
> 
> If you don't mind looking at some PHP code, you can see what I'm trying to
> do in my Github tests pull request[3][4] otherwise, here are the steps in
> mostly pseudo-code:
> 
>     create parent/child nodes:
>          /tests_version_base/versioned    (with property foo = something)
>          /tests_version_base/versioned/version_child    (with property
> foo_c = something_c)
>     checkpoint('/tests_version_base/versioned')
>     node->setProperty('foo', 'bar')
>     childNode->setProperty('foo_c', 'bar_c')
>     session->save()
>     checkin('/tests_version_base/versioned')
> 
> What I'm hoping to see at this point is that both the nodes (parent and
> child) have a corresponding frozen node, even though I only did a
> checkpoint on the parent. What I actually see is a frozen node for the
> parent (as expected) but not for the child.
> 
> I suspect my understanding of how this works is not right. Should child
> nodes automatically be versioned like this, or is there another way to get
> something like this behaviour?
> 
> Thanks,
> 
> Lars.
> 
> References:
> [1] https://github.com/phpcr/phpcr
> [2] https://github.com/jackalope/jackalope-jackrabbit
> [3]
> https://github.com/fazy/phpcr-api-tests/blob/c7cd60c7bfaf9bdb2211e8c8676344a58fa38a9b/tests/15_Versioning/VersionTest.php#L20
> [4]
> https://github.com/fazy/phpcr-api-tests/blob/c7cd60c7bfaf9bdb2211e8c8676344a58fa38a9b/tests/15_Versioning/VersionTest.php#L91
> 

-- 
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch

Mime
View raw message