-
Notifications
You must be signed in to change notification settings - Fork 33
Option to listen to postRemove event #96
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
Conversation
Now I remember: the thing is that doctrine before dispatching
|
Also I've forgot about rollbacked transactions :) but that probably should follow in another PR. |
There are currently no tests for listening and then acting on the events coming from Doctrine. I'll add some to catch these kind of errors. |
Thanks for your PR @codedge, request me as reviewer when you think this is finished! 🙂 |
d88ea37
to
7cc5a35
Compare
After some digging this is the result:
|
My primary concern was to have at least integration with messenger by adding but the problem is that |
I see :D Well, then we all learned a bit about Doctrine :D :D @curquiza |
Changes in this PR are only pointing towards testing, code style (strict typings, format). PHPstanI added https://github.com/phpstan/phpstan for checking the coding regarding type juggling. The current level is I already added this to be a check for every PR. See my changes to the test.yml. Separating testsI felt like some tests are more like unit testing, most are integration tests. That's why I split them into a Further the unit tests can rely on the default Code styleI added the new PHP CS Fixer rule Doctrine events tests & coverageThere are now doctrine event subscriber tests. The overall test coverage is about 85%. Obosolete filesI found two files that are obsolete and used nowhere. All the changes should be non-breaking. If you checked @curquiza feel free to merge. |
src/Engine.php
Outdated
@@ -80,7 +80,7 @@ public function remove($searchableEntities): array | |||
/** @var SearchableEntity $entity */ | |||
foreach ($searchableEntities as $entity) { | |||
$searchableArray = $entity->getSearchableArray(); | |||
if (null === $searchableArray || 0 === \count($searchableArray)) { | |||
if (null == $searchableArray || 0 == \count($searchableArray)) { |
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.
Why this change? :)
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.
This change came from PHPstan stating that this comparison is always null
. I prepared an example in the PHPstan playground: https://phpstan.org/r/07c0aa63-1a31-4a24-b6af-c14dffa92dc5
In the end I adjusted the code now:
$entity->getSearchableArray()
always returns an array- The check of
null
is removed now
From time to time I am opting for PHPstan level 6, so there might be changes added that focus towards level 6.
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.
Thank you a lot everyone!!
And sorry for the delay!
bors merge
🚀
96: Option to listen to postRemove event r=curquiza a=codedge This PR adds the option to listen to Doctrines `postRemove`. This is a result of the discussion in #62, a first step. You can know specify in `meili_search.yml`: ``` meili_search: # One, or multiple of postPersist, postUpdate, preRemove, postRemove doctrineSubscribedEvents: ['postPersist', 'postUpdate', 'preRemove', 'postRemove'] ``` @curquiza When merging this, we need to update the [wiki - Indexing automaticlly via ...](https://github.com/meilisearch/meilisearch-symfony/wiki/index-data-into-meilisearch#indexing-automatically-via-doctrine-events) Co-authored-by: Holger Lösken <[email protected]>
Timed out. |
I merge without bors then, because I'm on holiday in few minutes during a month and I don't want to wait 😇 |
This PR adds the option to listen to Doctrines
postRemove
. This is a result of the discussion in #62, a first step.You can know specify in
meili_search.yml
:@curquiza When merging this, we need to update the wiki - Indexing automaticlly via ...