Overview of General Principle of Prototype and TypoScript2 in Neos?

Hello,
I lack the understanding of

  • how «Prototypes« are working in context of path (like: page.content.main from Docu), also
  • why the missing of «body» in path-definition doesn’t harm, and
  • what the possibilities and limitations are in combination with root.ts2.
  • Perhaps a lot more other things

Maybe it is super-simple and easy to understand. But I have really problems to get the point with Prototypes and definition possibilities in path-structure or in the combination with.
Hope someone could help to find a simple and easy to understand documentation about the right structure in root.ts2 and the logical interaction from prototypes within.

###Why:

I tried to define the @cache-advice in the prototype of my nodeType like:

## SmarterCollector.ts2

prototype(Vendor.Site:SmarterCollector) < prototype(TYPO3.Neos:Content) {
    @cache {
        mode = 'uncached'        
    }
    ...
}

wich throws an error.
I tried the sample (like in doc explained) directly in root.ts2

## roots.ts2

# Include TypoScript (also SmarterCollector.ts2)
include: NodeTypes/*

page = Page {
    ...
    body {
        ...
        }        
        content {
            prototype(Vendor.Site:SmarterCollector) {
                @cache {
                    mode = 'uncached'
                    context {
                        1 = 'node'
                        2 = 'documentNode'
                    }
                }
            }
            ....
    }
}

No error throwing -> later on I realized: it was the missing context-property. So I changed the code in SmarterCollector.ts2 and > also with the cache-advice therein -> NO error throwing.
So at the end, all looks good and is working! (I guess)

##But:
In conclusion, I don’t know, why the new definition of prototype(Vendor.Site:SmarterCollector) in the intermediate step used directly in root.ts2, does not overwrite the hole in SmarterCollector.ts2 beforehand defined «same named» prototype.
It seems, I miss the «Basic knowledge about prototypes» and also the «Basic knowledge about the hierarchical principles and ways of working with ts2-files».

Is there somewhere a good and easy to understand docu or tut about? I know the hitchhiker’s from learn-neos.com and also the E-Book-Stuff from Mittwald.

###Question:
- Does anyone knows a good «Overview of the General Principle of Prototype and TypoScript2 in Neos»?

Basically an uncached TS path is rendered on every request, by bypassing the content cache. But the TS runtime need to know the context of this path required to render this path. For a normal path (without specific cache configuration), the context is build by the TS runtime by evaluation from the root path down to your TS path. So with the context configuration, an uncached path must render the full page, just to have a proper context for rendering your path. This make the uncached … really not efficiant, the performance will be the same if your full page is uncached (so pretty bad).

So if you path just need to current node or documentNode, configure the context carefully.

In your sample code Vendor.Site:SmarterCollector has an invalid cache configuration like the exception shows. On the second snippet you override the cache configuration for your prototype in the path page.body.content, so know the TS prototype has valid cache configuration, but only in the path and bellow. I don’t think you need to override the TS prototype, just add the context configuration in your original TS prototype declaration.

Not sure if understand the first question … and about the path in the documentation, it’s right that the body path is missing, and it’s plain wrong. Here you can review an small PR for the documentation:

@dfeyer thank you. Maybe I will someday find enough detailed knowledge to do PR’s. At least to assist in the documentation.

Is there a way to see visually what is stored, when and how? If not visually with a tool, maybe in analysis the particular page-cache? How I could identify the belonging cache-file (identifier printout with TS)?
Or do I have to understand plainly what will happen, if I change some cache-logic?


Maybe this is my basic problem. I din’t have understand the difference really.

  • «without path»: for me, it is the definition for my own prototypes.
    Those I explain to me like:
  • This kind of prototypes are the logic part beyond own nodeTypes.
  • I declare this in divided files under directory «NodeTypes» like «ownNodeType.ts2».
  • All will included in root.ts2 with first line (Otherwise I would have to declare it further above in root.ts2).
// Include TypoScript
include: NodeTypes/*
  • «with path»: is like in my second snipped. Maybe with your response I can find an explanation for me.

So, now I would explain for me:

  • «declaration of prototype with path» => prototype listed like in second snippet,
  • I can access my before (in e.G. ownNodeType.ts2) declared prototype
  • and extend / specialize this in root.ts2. So,
  • this modification will only be effective for this particular very specific context / path.
  • In all other paths the original declared prototype is potent.

Would this explained reasonably correctly?

So I can say:

  • «the TS prototype» is the path’ed prototype for particular paths in root.ts2 => something like the modification declaration of declared protoypes.
  • «your original TS prototype declaration» is this base declaration further above in root.ts2 or including with first line outsourced prototype-definition-files like ownNodeType.ts2?

Would this description hit about?