-
-
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: Remove SerializedCommandInterface
again and use `RebasableToO…
#5355
TASK: Remove SerializedCommandInterface
again and use `RebasableToO…
#5355
Conversation
…therWorkspaceInterface` directly
I was looking in a similar direction earlier and I like the signatures a lot more this way. But I find then RebasableToOtherWorkspace is probably the wrong name as it is a functional interface in that it actually declares an API and also says nothing about commands. Also this implies that all "internal" commands must be rebasable and I am not sure we can make that assumption for the future? |
Yep, makes a lot of sense, thanks!
I think we can, because the Personally I don't really care about the But I'm wondering: Do we really need to rename the |
This comment was marked as duplicate.
This comment was marked as duplicate.
i did it because now now every command implements it ... and i would be fine with naming it though as said earlier, it should not leak to the neos ui right? |
I don't understand this could still be CommandInterface and be implemented by every command. which actually would make sense... |
Just to put everything together: This is an adjustment pr for #5348 because i didnt want to push the changes directly, it should be merged into the other. Bastians pr introduces a separation of public Do i get this correct that the question is to introduce a |
Okay so naming is obviously hard again (as always) so before doing any renames, to reduce diff and stuff and also walk problems out of the way like: If we rename the interface to neos-development-collection/Neos.ContentRepository.Core/Classes/Feature/RebaseableCommand.php Line 19 in e9d576b
I would just suggest to move on with the essence of the change. Ill revert the lets just get this done and focus on more important parts. |
fd1c8fc
to
e9d576b
Compare
so in the end i like to have the following structure (regarding the naming of things i have no preference) /**
* Common (marker) interface for all public api commands of the content repository
*
* Note that this interface does not mark all commands.
* Complex public commands will not be serializable on its own and are required to be serialized into a {@see RebasableToOtherWorkspaceInterface}
*
* @internal sealed interface. Custom commands cannot be handled and are no extension point!
*/
interface CommandInterface
{
} /**
* Common (marker) interface for all **commands** that need to be serialized for rebasing to other workspaces
*
* If the api command {@see CommandInterface} is serializable on its own it will directly implement this interface.
* For complex commands a serialized counterpart - which is not api - will be build which implements this interface.
*
* During a rebase, the command (either the original {@see CommandInterface} or its serialized counterpart) will be deserialized
* from array {@see RebasableToOtherWorkspaceInterface::fromArray()} and reapplied via the {@see CommandSimulator}
*
* Reminder: a rebase can fail, because the target content stream might contain conflicting changes.
*
* @internal used internally for the rebasing mechanism of content streams
*/
interface RebasableCommandInterface extends \JsonSerializable
{
public function createCopyForWorkspace(
WorkspaceName $targetWorkspaceName,
): self;
/**
* called during deserialization from metadata
* @param array<string,mixed> $array
*/
public static function fromArray(array $array): self;
} And for a followup (yet to be done finished in #5356) we will introduce a And with the TASK: Centralise RebaseableCommand::enrichWithCommand <?php
declare(strict_types=1);
namespace Neos\ContentRepository\Core\CommandHandler;
use Neos\ContentRepository\Core\Feature\Common\RebasableToOtherWorkspaceInterface;
/**
* Optional interface for all content repository command serializer
*
* See {@see RebasableToOtherWorkspaceInterface} for more details regarding serialized commands.
*
* @internal no public API, because commands are no extension points of the CR
*/
interface CommandSerializerInterface
{
public function canSerialize(CommandInterface $command): bool;
public function serialize(CommandInterface $command, CommandHandlingDependencies $commandHandlingDependencies): RebasableToOtherWorkspaceInterface;
} edit, not so easy after all: #5356 (comment) the |
…therWorkspaceInterface` directly
Review for #5348
hmm why not CommandInterface|RebasableToOtherWorkspaceInterface :D
The SerializedCommandInterface doesnt add anything actually
its the same as if a command would not extend CommandInterface but only implements RebasableToOtherWorkspaceInterface
id say CommandInterface should be PublicCommandInterface or sth and then we have the RebasableToOtherWorkspaceInterface commands too which are not handlebar from outside
Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions