Skip to content

[!!!][FEATURE] Use DTO for record representation and identity#77

Merged
mabolek merged 33 commits intomasterfrom
record-representation
Sep 23, 2022
Merged

[!!!][FEATURE] Use DTO for record representation and identity#77
mabolek merged 33 commits intomasterfrom
record-representation

Conversation

@mabolek
Copy link
Copy Markdown
Contributor

@mabolek mabolek commented Sep 22, 2022

This internal change does not affect any external APIs, but improves the way record data and identities are handled. This fixes and issue that made multilingual operations impossible, as well as making it easier to work with record data and identities.

  • \Pixelant\Interest\Domain\Model\Dto\RecordRepresentation represents a record state, and includes data as well as a RecordInstanceIdentifier object.
  • \Pixelant\Interest\Domain\Model\Dto\RecordInstanceIdentifier represents a record's identity: table, UID, language, workspace, and remote ID. It can output both the remote ID as it is seen from the outside (which is only unique when combined with language and workspace) and the internal, so-called "aspected", remote ID, which is unique for each language and workspace combination.

pixelmatseriks and others added 27 commits July 13, 2022 15:03
Adds two classes, changes params used in *RecordOperation and *RecordRequestHandler,
but just sets same properties in RecordOperation classes as before but
based on RecordRepresentation and RecordInstanceIdentifier for now.
The functionality had disappeared during refactoring.
It's already set in the fixtures
A condition was missing a bracket, which led to the condition being interpreted with wrong precedence, resulting in PID being set to zero at the wrong time.
Was only accepting `internal_type` as "db", but `allowed` can also indicate a database relation.
@mabolek mabolek changed the title [FEATURE] Use DTO for record representation and identity [!!!][FEATURE] Use DTO for record representation and identity Sep 23, 2022
Copy link
Copy Markdown
Contributor

@MattiasNilsson MattiasNilsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice one, make the data structure more readable! I have some small comments.

$settings['persistence.']['storagePid.'] ?? []
);

if ($pid === '') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also cover the null check not only empty string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exchanging this condition with empty($pid).

$this->table = strtolower($table);
$this->remoteId = $remoteId;
$this->workspace = $workspace;
$this->language = $this->resolveLanguage((string)$language);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need to typecast this as it already is a string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a string or null, so by casting null to string we get an empty string. The question would be if this conversion should happen earlier.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed this now.

Copy link
Copy Markdown
Contributor

@MattiasNilsson MattiasNilsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 👍

@mabolek mabolek merged commit 44a99b4 into master Sep 23, 2022
@mabolek mabolek deleted the record-representation branch September 23, 2022 11:02
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.

3 participants