-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Customize artisan command scout:import how? #156
Comments
Not sure I understand the issue. Have you tried this?
|
It's not a problem to remove |
Thank you for your reply. |
Yeah the same command not possible as I remember. I thought about it and didn't find any reason to fight with it. I think new name is fine. But of course your feedback is preferable) |
A new name (of the command Making the class not final anymore would be the easiest, but we also could make it a bit more extensible. (Or is it already?) With Events for example. With an event before and after the process of importing a single searchable model, people could have some control over it. What do you think? |
Another thing: why we need to own the But there is a lot extra going on, like a progress bar etc., that all has to be maintained as well. This pattern brings this packages perhaps too much isolated on it's own. Instead it could rely on what already is functional in Scout itself. In Laravel there is this extension mechanism coming from |
When we would use the original Scout import command, extend it to our needs with Macroable, perhaps the next issue is solved as well? |
Agree about new signature |
I'm not big fan of macroable but maybe. |
excusez moi for my late response. My work is taking all my energie now. I've been thinking about the idea of the new signature for the command. I think I agree too! With a new signature, the two would be separated into the native Scout command and the Matchish Elastichsearch import command. This is much better to maintain. |
Thanks for yours review. As understand you're too busy now so if anyone want to implement the wrapper feel free to send pr. |
I could not see a reason to remove the final from the class. This command overwrites the Scout import command. So, you can create a separate command, and you can overwrite the library provided ImportCommand, too. ImportCommand of this library has different parameters from ImportCommand of Scout. So, as a result, even if we can remove the final but this will be meaningless in the end. |
Dear community, looking at this after a long time I think it looks like nobody really needs this. And with all due respect, I also don't need it anymore. So this can be closed. |
laravel-scout-elasticsearch/src/Console/Commands/ImportCommand.php
Line 15 in d7d530a
I would like to customize the
scout:import
artisan command to import only a subset of chosen models. That is because I have a few models that live in multiple projects and only one project 'owns' a given model. In the other projects, the scout import command must not work for that particularly model.My first idea was to just extend the
ImportCommand
from this package, but that is not possible because it is afinal class
.My next idea was to call the command by Programmatically Executing Commands (https://laravel.com/docs/5.8/artisan#programmatically-executing-commands) But I don't see how a class can be executed, only a command how it is defined, like
scout:import
.Do you know perhaps how your command can be executed programmatically?
The text was updated successfully, but these errors were encountered: