Using your own document entity was currently not possible in the case where the entity was not manually defined in the index (using entityClass).
For instance, when using index 'ArticlesIndex' the entityClass function would resolve the document name to 'ArticlesI' instead of just Articles (notice the letter I) and then singularize it resulting in always faling back to the default Document class. Weird that this small bug wasn't noticed before?
Added registry alias on the Index class
There was no proper implementation of a registry alias resulting in document context's to not work properly when using plugin indexes for example.
Document's created in the Index are passed the alias as source instead of the registryAlias which breaks document context in plugin cases because the entity could not resulve to the index class. We could work around this by passing the 'type' param to the context settings in FormHelper but thats a bit meh ?
Added setLogger()/getLogger() to Connection and deprecate logger()
Plugins like debug_kit already use the setLogger method in the SqlLogPanel, Elastica\Client has its own setLogger method that conflicts and throws an exception because it only accepts in instance of Psr\Log\LoggerInterface, overriding this method makes everything play nice and is more in line with cake 3.6
Wrote some tests for the first two, can someone validate if these are sufficient ?
This PR fixes 3 issues:
Fix resolving of Document entities
Using your own document entity was currently not possible in the case where the entity was not manually defined in the index (using entityClass).
For instance, when using index 'ArticlesIndex' the entityClass function would resolve the document name to 'ArticlesI' instead of just Articles (notice the letter I) and then singularize it resulting in always faling back to the default Document class. Weird that this small bug wasn't noticed before?
Added registry alias on the Index class
There was no proper implementation of a registry alias resulting in document context's to not work properly when using plugin indexes for example.
Document's created in the Index are passed the alias as source instead of the registryAlias which breaks document context in plugin cases because the entity could not resulve to the index class. We could work around this by passing the 'type' param to the context settings in FormHelper but thats a bit meh ?
Added setLogger()/getLogger() to Connection and deprecate logger()
Plugins like debug_kit already use the setLogger method in the SqlLogPanel, Elastica\Client has its own setLogger method that conflicts and throws an exception because it only accepts in instance of Psr\Log\LoggerInterface, overriding this method makes everything play nice and is more in line with cake 3.6
Wrote some tests for the first two, can someone validate if these are sufficient ?