Skip to content

setMixins fails with referenced nodes #137

@danrot

Description

@danrot

I have a node type called sulu:page, which inherits from the mix:referenceable node type. I have a node which has the mix:referencebale node type and is already referenced by some other nodes.

Now I would like to change the node to only have the sulu:page mixins and not the mix:referenceable mixin. So I call $node->setMixins(['sulu:page']), but when saving the data in the session to jackrabbit I get an error message like this:

{http://www.jcp.org/jcr/mix/1.0}referenceable can not be removed: the node is being referenced through at least one property of type REFERENCE

I have checked the curl request which is being sent, and there are two relevant parts, which I'll show in the following snippet:

--716fd5cc8a3f81528673d2a9af259887
Content-Disposition: form-data; name="/cmf/microlife/contents/a/jcr:mixinTypes"
Content-Type: jcr-value/name; charset=UTF-8
Content-Transfer-Encoding: 8bit

sulu:page

Some more data, and quite at the bottom I see a line like this:

^/cmf/microlife/contents/a/jcr:mixinTypes : []

It looks to me like it is resetting the mixinTypes before setting the new value, which causes some references to break.

Is there any reason this is built like that? Can we fix that? If I get a hint I would create a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions