-
Notifications
You must be signed in to change notification settings - Fork 188
6.0 major version upgrade #840
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
Here's some sneak peak for the configuration:
|
I have some idea also to make configuration as less as possible. In that case, maybe would make sense to set an index name in the |
…n't tested PHP 7.4 and 8.0 yet. (#858)
* fixed php 7.3 compatibility * allow php 7.3
/** | ||
* Manager class. | ||
*/ | ||
class Manager |
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.
@saimaz this is a big change is this really needed for ES6? This will make it impossible to support ES5 and ES6 at the same time.
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.
@alexander-schranz I wrote a comment in the PR regarding this and all the changes.
It's a prototype. With the 6th version and further development, I don't see the benefits of keeping bc with the 5th version and sf 3. There are so many changes in the symfony and elastic. The only downside is in the project you have to upgrade it. During the time and using this bundle I learned a lot and found some logic mistakes which I want to fix. Also, the intention for these changes is related to two other very useful bundle development and new major version support, the FilterManagerBundle and RouterBundle. |
As index name likes database name mostly come from the parameters.yml or env variable I think this is not a good idea to move the index_name to the Document Annotation. At least a index_prefix_name should be configureable in the configuration.
For a project its always easy to upgrade as you can make there breaking changes but for a reusable bundle its not. |
* Fix profiler view for symfony 4 * Fix travis.yml * Fix tests and add var folder to ignore in travis
@saimaz If we don't have a manager how do we choose where to index a document if you look at our current configuration we are indexing the same document into 2 indexes (based on some business logic its not always indexed in live index). How I could achieve this without having manager as normally you get the correct repository from the manager. |
The thing is that from the 6th version there is no need to have a manager anymore. The manager was to support the index with more than one type. From now on every type is an index. I don't want to introduce BC changes so will keep the manager with the existing functions, but will mark it as deprecated and will remove later on in 7th or 8th version. For the configuration, I imagine that BC can be kept as well. With some additional checks should be everything fine. But later on also will be removed and everything would be great to keep as clean as possible. This will let to work more easily with Symfony auto wiring and other new features. |
How you can index the same document in 2 different indexes based on business logic then? Example configuration:
So there need to be a index service or a paramter on the repository in which index the document should be stored? |
The repository would be index representation. So you simply persist to the specific repository which works only with the one index. |
* remove collection * update composer dependencies * upgrade tests for v6 elastic * added app kernel auto loading for the tests * improve the container loading * add ignore for the test cache * introducing index annotation and service * introducing index configuration, still experimental * marking the deprecations * update index service by adding more functions * update changelog * expand event variables * mark deprecations * remove deprecated service naming, use namespaces instead * mark deprecations * update * file reader included * changed events and improved mapping pass * cleanup * introduce new metadata collector for the index * starto to work with the object conversion * make first test run * finished index document metadata loading and index service loading * making dependency injection layer for the bundle more stable * index creation * index creation with analysis data works * simple document insert and find works * add more test cases to test iteration and find methods * introduce custom normalizer to support embedded objects in the document * added embedded objects lazy loading * make almost everything working again * fixed code style issues * add clover coverage to the ignore list * missing trailing slash in the beginning * update travis build requirement for version matrix
@saimaz can you give us a short update on the state of this PR? thx |
This PR will be closed in favor of #868. It was my experimental version of what it could be and to ask community suggestions. You can check the 6.0-dev branch and functional tests on how the usage has been changed. There are not so many changes but rather complexity reduces. Full documentation, change list and bc changes, upgrade info are coming :) I didn't write it in a first place since I want to fully test the prototype which I released as an early 6.0.0-beta. |
[$repositoryDetails['namespace']] | ||
); | ||
$repositoryDefinition->setPublic(true); | ||
$defaultIndex = $defaultIndex ?? array_shift(array_keys($indexes)); |
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.
If no index is present (f.e. in a new environment) array_shift(array_keys($indexes))
is invalid.
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.
That is completely true. Thanks for the notice.
{ | ||
$result = $this->reader->getPropertyAnnotation($property, self::EMBEDDED_ANNOTATION); | ||
$class = new \ReflectionClass($namespace); |
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.
We should catch ReflectionException
here. Filenames / Classes do not always match.
try {
$class = new \ReflectionClass($namespace);
} catch (\ReflectionException $e) {
return [];
}
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.
Well if filenames and classes (namespaces) won't match it will break PSR-4, and composer will throw an exception. Anyway, thanks for the insight, will think about how to improve this place.
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.
No. You are iterating over the users project dir. You don't know whats hidden in there ;)
In my case it was a wrong defined test namespace. This isn't a static analysis tool.
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.
Ok, I misunderstood for the first time. The idea behind this is to iterate through the src directory and collect the files which have @Index
annotation which indicates that is an ElasticSearch index. THen it grabs the namespace from that file and loads the reflection class. I agree that the exception has to be thrown if it cannot load it.
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 saw that, yes. I wonder if there's another way which might be a bit more performant?
Do you think it might be too complicated for the users to just allow a specific folder like Document
?
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 was thinking about a more performant way to get the mapping. But it will be executed once on warmup and then cached. So not a big deal if it will take 1-second longer IMO.
Regarding the additional categories, I already have introduced a specific parameter for that.
Take a look at the #869 It's the latest state there and potential RC version which most likely won't change drastically.
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.
Sorry the Document
folder thing was related to the performance. I meant to require all Documents to be inside a Document
folder. This way not all classes are checked. But as long as it's really just a second - I think you're right.
I'm closing this branch in favor of #868 and v6.0.0-beta release. Will open a pull request to the master from 6.0-dev where currently is the latest state of a 6th major version upgrade. If you anyone noticed something wrong or have any idea to improve any place, please comment it out there. |
No description provided.