enh(TextProcessing): Allow providers and task types to declare a dynamic ID instead of using className#41088
Conversation
…mic ID instead of using className this allows AppAPI to register anonymous classes as TextProcessing providers and task types Signed-off-by: Marcel Klehr <[email protected]>
|
(I'm sort of sad about the loss of beauty with this, but alas) |
Signed-off-by: Marcel Klehr <[email protected]>
|
@marcelklehr What did we decide to do with settings (I mean adjust it to check for new interface with ID), is there any concerns to not do it the same as for Speech-to-Text? |
|
It's not as straightforward as with the STT API, because we need to be able to instantiate task types from their id. When we are using the class name as ID it works fine, but if we're using a getId() method we need to register task types as well. I'm not sure how we can do this in a backward-compatible way. |
Signed-off-by: Marcel Klehr <[email protected]>
|
Decided with @julien-nc not to have task types implementable by ExApps. Then we can keep the class names for TaskTypes and this whole thing gets a lot easier. |
Signed-off-by: Marcel Klehr <[email protected]>
Signed-off-by: Marcel Klehr <[email protected]>
Signed-off-by: Marcel Klehr <[email protected]>
|
Please review |
| $provider = current(array_values(array_filter($providers, function ($provider) use ($preferences, $task) { | ||
| if ($provider instanceof IProviderWithId) { | ||
| return $provider->getId() === $preferences[$task->getType()]; | ||
| } | ||
| $provider::class === $preferences[$task->getType()]; | ||
| }))); |
juliusknorr
left a comment
There was a problem hiding this comment.
Small indent issue, otherwise looks good 👍
Signed-off-by: Marcel Klehr <[email protected]>
Signed-off-by: Marcel Klehr <[email protected]>
this allows AppAPI to register anonymous classes as TextProcessing providers and task types
Checklist