Skip to content
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

Simplify data mapper with unlocalized and localized dimension content #205

Merged

Conversation

alexander-schranz
Copy link
Member

@alexander-schranz alexander-schranz commented Oct 6, 2021

For making the mapper easier to handle and avoid check for localized and unlocalized dimension I for changing the interface to the following way.

TODO:

  • UPGRADE.md DataMapperInterface

@alexander-schranz alexander-schranz force-pushed the feature/simplify-data-mapper branch 3 times, most recently from e5387c3 to 6b646ae Compare October 7, 2021 19:23
@alexander-schranz alexander-schranz changed the title Simplify data maper with unlocalized and localized dimension content Simplify data mapper with unlocalized and localized dimension content Oct 7, 2021
@alexander-schranz alexander-schranz force-pushed the feature/simplify-data-mapper branch 4 times, most recently from d5f1c27 to 082fb0a Compare October 7, 2021 20:22
@alexander-schranz alexander-schranz added the DX Only affecting the end developer label Oct 7, 2021
@@ -147,44 +135,43 @@ public function map(
}

if (null === $entityClass || null === $routeSchema) {
// TODO FIXME add test case for this
return; // @codeCoverageIgnore
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

i think this is most likely an error (eg forget to add configuration). i think i would throw an exception here too?

@@ -136,6 +136,10 @@ public function postAction(Request $request): Response
{
$example = new Example();

$this->entityManager->persist($example);
// FIXME This flush is needed for RoutableMapper and should in future note longer be required
Copy link
Contributor

Choose a reason for hiding this comment

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

why was this not needed before? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

We did skip when no ResourceId was given, should we readd this?

Copy link
Contributor

Choose a reason for hiding this comment

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

okay i see 🙂 i am not sure..
routes for pages are created only when they are published - maybe we should do that here too?

Copy link
Contributor

Choose a reason for hiding this comment

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

but i dont have a strong opinion on this, we dont need to change it now

Copy link
Member Author

Choose a reason for hiding this comment

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

You are definitly right we currently have bug in the RoutableDataMapper after the entity is once published. The draft route edit is directly editing without ever being published.

$title = $this->getTitle();

if ($title) {
$data['title'] = $title;
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason for doing this? 🤔
i think the api for pages returns null values too

Copy link
Member Author

Choose a reason for hiding this comment

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

Would make most tests confusing when its always returned here.

Copy link
Contributor

Choose a reason for hiding this comment

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

what test cases? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Testcases using like Routablemapper using getTemplateData() but don't have and title in there mapping.

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the handling here by writing the 'title' into the TemplateData in the setTemplateData and the only way to set the title is now setTemplateData.

Copy link
Member Author

Choose a reason for hiding this comment

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

So getTemplateData will only return a title when it really did set a title and not magically return a title when never was set.

UPGRADE.md Outdated Show resolved Hide resolved
UPGRADE.md Outdated Show resolved Hide resolved
@@ -80,6 +80,10 @@ public function map(
throw new \RuntimeException('LocalizedDimensionContent needs to extend the TemplateInterface.');
}

if (DimensionContentInterface::STAGE_LIVE !== $localizedDimensionContent->getStage()) {
// return;
Copy link
Contributor

Choose a reason for hiding this comment

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

this condition does not do anything anymore - is okay for me to merge it like this as we decided to refactor this part of the code in a second pull request 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in #206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Only affecting the end developer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants