-
Notifications
You must be signed in to change notification settings - Fork 19
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
Pass DimensionContentCollection to DataMapper services #182
Pass DimensionContentCollection to DataMapper services #182
Conversation
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 personally not so happy with the Preview Handling, but it was also not good before. I would atleast simulate the count: 2 and mark the PreviewCollection as internal so we can change it the way we need it in future.
/** | ||
* @implements \IteratorAggregate<DimensionContentInterface> | ||
*/ | ||
class PreviewDimensionContentCollection implements \IteratorAggregate, DimensionContentCollectionInterface |
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.
Not sure about this class. Can we mark it as @internal
at current state.
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.
👍
|
||
public function getDimensionAttributes(): array | ||
{ | ||
return ['locale' => $this->previewLocale]; |
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.
A DimensionCollection should always return all its DimensionAttributes
so we should array_merge()
them here with the getDefaultDimensionAttributes
.
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.
👍
public function count(): int | ||
{ | ||
return 1; | ||
} |
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.
Not really happy with this :(
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.
Not sure if we should return here 2
to simulate that we have a unlocalized and localizedObject.
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.
think i would not return 2 because that is misleading
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 could adjust the DimensionContentCollectionInterface
to not extend Countable
as described in #178 to get rid of the method 😇
ee772bc
to
75419a7
Compare
@alexander-schranz Not really happy about the preview handling too, but I dont have a better idea at the moment. Do you see a better alternative? |
This PR aadjust the
ContentDataMapper
service and theDataMapper
services to accept aDimensionContentCollection
parameter instead of aunlocalizedObject
and an optionallocalizedObject
parameter.This makes the interfaces more flexible and consistent to other parts of the bundle.