Skip to content

Create persisters/map classes to cleanup the UoW #497

@ElectricMaxxx

Description

@ElectricMaxxx

As the result of #493 we came to the conclusion to do some cleanup inside of the UoW. First step would be to move all code that handles the session to a so called persister as the ORM still does. I know that the session is a kind of a persister abstraction but not the same.
I still struggle with two thinks:

  • how many code around those typical $this->session->getNode() should go into that new classes
  • how to inject the array that contains the documents like scheduledForUpdate, identityMap, ...

I will have a longer train drive on sunday to create a plan for the first issue.

Even if i know that the UnitOfWork's main task is to create a communication between those arrays and the persistence layer, i would like to suggest to create some mini-container, like little UnitOfWork with common entries and a common interface like:

interface ScheduledContainerInterface
{
  public function register(ScheduledItemInterface $item);

  public function unregister(ScheduledItemInterface $item);

  public function getByIdentifier($id);

  ...
}

We would be able create a ScheduledForUpdates class with that interface and are able to inject it into an UpdatePersister for example:

$this->getPersister('update')->execute($this->scheduledForUpdates);

I do not really know if that would have some performance issues, but we would get a clear way of injecting scheduled/mapped objects into the persister. We will be able to handle the id<->uuid questions inside those classes tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions