-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
!!! TASK: Introduce first level content repository projection #5272
Conversation
Neos.ContentRepository.Core/Classes/Projection/ProjectionsAndCatchUpHooks.php
Outdated
Show resolved
Hide resolved
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.
Nice one and it's a good idea to move the countNodes()
hack to the higher level interface.
I already added a couple of comments even though this is just a draft yet
Neos.ContentRepository.Core/Classes/ContentRepositoryReadModel.php
Outdated
Show resolved
Hide resolved
Neos.ContentRepository.TestSuite/Classes/Behavior/Features/Bootstrap/CRTestSuiteTrait.php
Show resolved
Hide resolved
A ContentRepository cannot exist without this projection
Previously if called with `ProjectionStateInterface::class` it would return the first state which will then not be callable again by its fqn. Now only fqn are allowed. Initially the interface logic was needed for interchangeable cr readmodel projection states
…ound to a workspace but cross content stream Also since its internal and only used for the tests it a good to be hidden in the low level `ContentRepositoryReadModel` next to other low level methods
f11e713
to
fb56a07
Compare
Neos.ContentRepository.Core/Classes/Projection/ContentRepositoryReadModelProjection.php
Outdated
Show resolved
Hide resolved
Neos.ContentRepository.Core/Classes/ContentRepositoryReadModel.php
Outdated
Show resolved
Hide resolved
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.
@mhsdesign This is a great start already, but I'm not yet super happy with the split in the CR core.
I have some rough ideas I would like to discuss with you at some point
Neos.ContentRepository.Core/Classes/CommandHandlingDependencies.php
Outdated
Show resolved
Hide resolved
Neos.ContentRepository.Core/Classes/Projection/ProjectionsAndCatchUpHooks.php
Outdated
Show resolved
Hide resolved
The name `ContentRepositoryProjectionInterface` doesnt specify what makes it different to `ProjectionInterface` and indeed its a graph that has to be implemented by the adapter
Neos.ContentRepositoryRegistry/Classes/ContentRepositoryRegistry.php
Outdated
Show resolved
Hide resolved
Neos.ContentRepository.Core/Classes/Factory/ProjectionsAndCatchUpHooksFactory.php
Outdated
Show resolved
Hide resolved
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.
First set of comments, looking great already.
What puzzles me is the distinction between contentRepositoryProjection (in configuration etc) but contentGraphReadModel
Neos.ContentGraph.DoctrineDbalAdapter/src/ContentGraphReadModelAdapter.php
Show resolved
Hide resolved
if (in_array(ContentGraphReadModelInterface::class, class_implements($projectionStateClassName), true)) { | ||
throw new \InvalidArgumentException(sprintf('Accessing the internal content repository projection state via %s(%s) is not allowed. Please use the API on the content repository instead.', __FUNCTION__, $projectionStateClassName), 1729338679); |
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.
nitpick: why not move this check to the top and keep the rest like before?
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.
then it would be more expensive imo as we call class_implements
always and here its just to improve the error message ;)
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.
as said above I would just allow it and thrash the check. it's a projectionstate after all, just one with better API to reach it.
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.
We will have to disallow this with the CR Privileges because they enforce the constraints on the CR instance
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.
right, ok fair enough. Then this place is fine for me.
if (!isset($this->projectionStateCache)) { | ||
foreach ($this->projectionsAndCatchUpHooks->projections as $projection) { | ||
if ($projection instanceof ContentGraphProjectionInterface) { | ||
continue; | ||
} | ||
$projectionState = $projection->getState(); | ||
$this->projectionStateCache[$projectionState::class] = $projectionState; | ||
} | ||
} |
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 don't completely get the implications of this, but why do we build up the runtime cache for all projections once any state is retrieved?
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.
because we did so previously almost as well just that we break on the first match, by building it once its more easy to grasp
Neos.ContentRepository.Core/Classes/Projection/ProjectionStatuses.php
Outdated
Show resolved
Hide resolved
@@ -141,18 +143,24 @@ public function handle(CommandInterface $command): void | |||
*/ | |||
public function projectionState(string $projectionStateClassName): ProjectionStateInterface | |||
{ | |||
if (!isset($this->projectionStateCache)) { | |||
foreach ($this->projectionsAndCatchUpHooks->projections as $projection) { | |||
if ($projection instanceof ContentGraphProjectionInterface) { |
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.
So but that means you cannot get the CG projection here anymore? not sure that is good?!
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 that's a good thing (see comment above re PR privileges)
Replaces the quirky
ContentRepositoryReadModelAdapterInterface
with a newContentGraphReadModelInterface
that is a 1st level dependency to theContentRepository
.This simplifies code flow and prevents CR instances without its main projection to be created.
Note
This is a breaking change because it changes the configuration format for the
ContentRepositoryRegistry
package fromto