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

Ability to customize which identifiers to enqueue #5

Closed
mmenozzi opened this issue Jan 29, 2020 · 5 comments · Fixed by #172
Closed

Ability to customize which identifiers to enqueue #5

mmenozzi opened this issue Jan 29, 2020 · 5 comments · Fixed by #172
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@mmenozzi
Copy link
Member

Currently the responsibility to find which are the identifiers to enqueue is given to the importer which have to implement the method \Webgriffe\SyliusAkeneoPlugin\ImporterInterface::getIdentifiersModifiedSince().

So if one wants to customize that logic (for example adding some kind of filter) he needs to replace the entire importer.

So I suggest to isolate the responsibility of finding identifiers that have been modified since a given date to a dedicated interface.

@mmenozzi mmenozzi added enhancement New feature or request help wanted Extra attention is needed labels Jan 29, 2020
@mmenozzi
Copy link
Member Author

mmenozzi commented May 5, 2021

A quick but not so clean way to do this is to dispatch an event in the \Webgriffe\SyliusAkeneoPlugin\ApiClient::findProductsModifiedSince() method. Then subscribers/listener may customize the default provided filters that will be used to actually perform the search products API call.

@webgriffe/wg-devs @aleho what do you think?

@aleho
Copy link
Contributor

aleho commented May 5, 2021

This would certainly be a quick win without having to BC break the importer / API client.

On the other hand using the official API client is much more fun and should prove a stable investment in the long run.
Any ideas on that front?

(I personally don't really enjoy using too many event handlers because that tends to get very messy and needs tidy documentation and developers.)

@mmenozzi
Copy link
Member Author

mmenozzi commented May 5, 2021

Hi @aleho I agree that switching to the official would be much better and we already have it ready in the #20 PR.

Anyway it brings too many BC breaks and we can merge it in 2.0 only.

I also agree that events are messy especially when debugging, anyway they are good for providing extension points which is the goal of the issue.

@mmenozzi mmenozzi self-assigned this May 7, 2021
@mmenozzi
Copy link
Member Author

mmenozzi commented May 7, 2021

Adding the event dispatcher to the ApiClient sounds too messy. Moreover it's very hard to test this behavior.

After thinking about this I figured that it's better to wait the 2.0. In 1.x users can still decorate the ApiClient to customize the filter.

@mmenozzi mmenozzi added this to the 2.0 milestone May 7, 2021
@mmenozzi mmenozzi removed their assignment May 7, 2021
@lruozzi9 lruozzi9 added this to To do in Release 2.0.0 via automation Sep 19, 2022
@mmenozzi
Copy link
Member Author

Now that we have the official Akeneo API client we decided to dispatch an event in \Webgriffe\SyliusAkeneoPlugin\Product\Importer::getIdentifiersModifiedSince allowing subcribers to customize the SearchBuilder object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants