Skip to content

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

Merged
merged 3 commits into from
Feb 4, 2015
Merged

Node type documentation #9

merged 3 commits into from
Feb 4, 2015

Conversation

dantleech
Copy link
Member

Started expanding the node type chapter.

As an example we will define the node types required by a canonical blog
application.

.. configuration-block::
Copy link
Member Author

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?

@dbu @lsmith77 @wjzijderveld

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.

Copy link
Member Author

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

Copy link
Member Author

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?

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.

Copy link
Member Author

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

@dbu
Copy link
Member

dbu commented Jul 14, 2014

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.

@dbu
Copy link
Member

dbu commented Jul 14, 2014

oh, regarding specifity to jackrabbit: cnd is also specific to jackrabbit. only the code api is part of the official standard.

@dantleech
Copy link
Member Author

Hmm, but then there is the registerNodeTypeCND method in the NodeTypeMager:

https://github.com/phpcr/phpcr/blob/master/src/PHPCR/NodeType/NodeTypeManagerInterface.php#L247

@dbu
Copy link
Member

dbu commented Jul 14, 2014

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.

@dbu
Copy link
Member

dbu commented Jan 22, 2015

@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.

@lsmith77
Copy link
Member

lsmith77 commented Feb 4, 2015

ping

@dantleech
Copy link
Member Author

Updated.

lsmith77 added a commit that referenced this pull request Feb 4, 2015
@lsmith77 lsmith77 merged commit 34efb26 into master Feb 4, 2015
@lsmith77 lsmith77 deleted the node_types branch February 4, 2015 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants