Skip to content
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

#2542 Add taxonomy delete command. #2543

Merged
merged 4 commits into from
Oct 14, 2016

Conversation

twhiston
Copy link
Contributor

Added a command to delete all terms in a taxonomy. Deletion routine is a trait so can be re-used in other taxonomy deletion situations.

@twhiston
Copy link
Contributor Author

added an additional delete all command, though very similar it is a separate command as deleting every term for every taxonomy should be an explicit command due to high risk level


use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command as BaseCommand;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@twhiston There is no longer need to register this alias. Please update this line

use Symfony\Component\Console\Command\Command as BaseCommand;

as this

+use Symfony\Component\Console\Command\Command;

@jmolivas jmolivas modified the milestone: 1.0.0-rc1 Aug 2, 2016
@jmolivas
Copy link
Member

jmolivas commented Aug 2, 2016

@twhiston and the last missing piece is:

Register command class as a service at config/services/taxonomy.yml

taxonomy_delete:
   class: Drupal\Console\Command\Taxonomy\DeleteCommand
    tags:
      - { name: console.command }

@jmolivas
Copy link
Member

jmolivas commented Aug 2, 2016

@twhiston how about instead of having two commands, why not only have one command and execute as:

  • taxonomy:delete VID_VALUE - delete all terms on taxonomy with VID_VALUE.
  • taxonomy:delete all - delete terms in all taxonomies.

Having to pass all as argument can mitigate the high risk of removing all of the terms.

Tom Whiston added 2 commits September 21, 2016 08:33
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
…nd, refactor and change command to taxonomy:term:delete to make clear that this does not delete the taxonomy itself.
@twhiston
Copy link
Contributor Author

Sorry this took a while to do, but it should be ok now.
I made it into one command that can take all to delete all terms, i refactored as requested above and I changed the command name to taxonomy:term:delete to make it clear that it does not delete the taxonomy itself but only the terms therein. Hope this is ok for you

@twhiston
Copy link
Contributor Author

twhiston commented Oct 4, 2016

any update on this PR? can it be included?

@jmolivas
Copy link
Member

jmolivas commented Oct 4, 2016

@twhiston Now that we have the RC releases running I will be able to check and test this PR.

@jmolivas jmolivas modified the milestones: 1.0.0-rc5, 1.0.0-rc6 Oct 6, 2016
@jmolivas jmolivas merged commit a131ac1 into hechoendrupal:master Oct 14, 2016
@jmolivas
Copy link
Member

@twhiston Thanks for your contribution, your PR was merged. This will be included on the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants