-
Notifications
You must be signed in to change notification settings - Fork 19
Node edit command #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- One edit command to rule them all - Will be able to edit entire nodes or single properties - Will use Serializer component to serialize nodes to and from different formats (YAML/XML f.e.)
/** | ||
* Encodes YAML data | ||
* | ||
* @author Sander Coolen <sander@jibber.nl> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. This is not me ..
|
||
if ($datum['type'] != $typeName) { | ||
throw new \InvalidArgumentException(sprintf( | ||
'Cannot currently change a properties type for property "%s" (trying to change from "%s" to "%s")', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think changes on node types are not something that was well planned for in jcr. jackrabbit does not even support to remove anything on a node type or remove a whole type / mixin. last i heard, their recommendation is to migrate the whole repository when this is needed...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well this is not necessarily about node-types, this could be a property on an nt:unstructured node. But there doesn't seem to be a setType
method on the PropertyInterface
.
Also.. I noticed that when saving "10" as a "Double" to jackrabbit, that it comes back as a "Long". Is that jackalope ignoring the specified type, or jackrabbit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry, did not read enough context. hm, in jcr you have not only Property but also Value. setting a Property to a different Value object would most likely change its type as well. maybe PHPCR is missing a method here, indeed. could you open an issue about this on phcpr?
the other thing should really not happen. https://github.com/phpcr/phpcr-api-tests/blob/master/tests/10_Writing/SetPropertyTypesTest.php tries out such cases. do we have the example you mention? is the problem also occuring with doctrine-dbal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, checked the JCR API and it behaves as you described, created:
For the other it is only for jackrabbit:
Need to handle BINARY properties - i.e. do not serialize them, but show a message in the comment section listing the BINARY properties that have been ommitted. |
for binary, something like writing into file / reading from file would be cool. but lets postpone to a separate PR i guess. |
This is a PR for a new command which enables nodes to be edited as a whole, and replaces the
node:property:edit
command (thenode:property:set
command still exists however).Example:
Will open an editor with the following:
It also supports a short syntax when creating nodes:
You can then edit, remove or add properties as required.