-
Notifications
You must be signed in to change notification settings - Fork 5
Node type documentation #9
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
As an example we will define the node types required by a canonical blog | ||
application. | ||
|
||
.. configuration-block:: |
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 thought it would be cool to list the examples in all the available formats, as with the Symfony documentation. But I have some questions:
- Is it practical to list PHP examples? Is it possible to define a node type (with property and child node definitions) in a single PHP file - or would we have to list a class for each definition? This would be far too verbose.
- Are there any other formats that can be readily used with PHPCR other than CND? Such as XML?
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 like the idea.
I'm not sure about the PHP version, but I think its doable.
The XML version is doable as well but does get a quit verbose. I got an
example on my blog:
http://blog.willem-jan.net/2014/01/18/creating-custom-nodetypes/
On 12 Jul 2014 17:17, "dantleech" notifications@github.com wrote:
In book/node_types.rst:
+define which items (properties or child nodes) a node may or may not have. It
+allows you to apply constraints to these items and to specify if items should
+be automatically created when the node is created.
+
+Node types can be defined as classes or as CND files. CND is an abbreviation
+for Compact Namespace and Node Type Definition, and is part of the JCR-283
+specification. This tutorial will show examples using both the class and CND
+formats.
+
+An Example
+----------
+
+As an example we will define the node types required by a canonical blog
+application.
+
+.. configuration-block::I thought it would be cool to list the examples in all the available
formats, as with the Symfony documentation. But I have some questions:
- Is it practical to list PHP examples? Is it possible to define a
node type (with property and child node definitions) in a single PHP file -
or would we have to list a class for each definition? This would be far too
verbose.- Are there any other formats that can be readily used with PHPCR
other than CND? Such as XML?@dbu https://github.com/dbu @lsmith77 https://github.com/lsmith77
@wjzijderveld https://github.com/wjzijderveld—
Reply to this email directly or view it on GitHub
https://github.com/phpcr/phpcr-docs/pull/9/files#r14853616.
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.. the XML seems to be Jackalope specific
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.
Is there any reason we can't move the XML|array converter to PHPCR Utils?
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, didn't check that, just assumed it was a general thing.
But I'm not sure this is something that PHPCR should have. It seems logical
to have this kind of thing in the implementation.
On 13 Jul 2014 08:44, "dantleech" notifications@github.com wrote:
In book/node_types.rst:
+define which items (properties or child nodes) a node may or may not have. It
+allows you to apply constraints to these items and to specify if items should
+be automatically created when the node is created.
+
+Node types can be defined as classes or as CND files. CND is an abbreviation
+for Compact Namespace and Node Type Definition, and is part of the JCR-283
+specification. This tutorial will show examples using both the class and CND
+formats.
+
+An Example
+----------
+
+As an example we will define the node types required by a canonical blog
+application.
+
+.. configuration-block::Is there any reason we can't move the XML|array converter to PHPCR Utils?
—
Reply to this email directly or view it on GitHub
https://github.com/phpcr/phpcr-docs/pull/9/files#r14856962.
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.
But then why should each implementation invent its own XML node type definition language? Thats just counter-productive :) And it would be in phpcr-utils
so it would just be "available" not required.
But maybe it would just be simpler to have only CND
if there is a good xml schema for the node type definition format, we could use it in phpcr-utils i think. the xml completion would make it more convenient to write correct definitions. as for php: sure, you can just define a fragment of interacting with the methods to create node types. |
oh, regarding specifity to jackrabbit: cnd is also specific to jackrabbit. only the code api is part of the official standard. |
Hmm, but then there is the https://github.com/phpcr/phpcr/blob/master/src/PHPCR/NodeType/NodeTypeManagerInterface.php#L247 |
i think in phpcr we said we just support cnd even though its not part of jcr. because only being able to write node definitions in the very verbose api format sucks. and you usually have just a config file with your ndoetype. |
@dantleech this needs a rebase now. would love to wrap it up too. lets merge even if its just an introduction and no full reference. |
ping |
Updated. |
Started expanding the node type chapter.