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

[generate:entity:content] Improve command options #3371

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

derhasi
Copy link
Contributor

@derhasi derhasi commented Jul 3, 2017

In the current drupal generate:entity:content command there are some problems, so you could not generate an entity without any manual confirmation step. The base-path set via --base-path="..." currently only is set as default for the question displayed after running the command. With the options has-bundles, is-translatable and revisionable there is the problem of not beeing able to disable those settings via the command line.

With the given PR I try to fix those problems, so a command like below, will run without the need of any manual confirmations:

drupal generate:entity:content --module=kswertung --entity-class=ResultEntity --entity-name=ksresult --label="Result" --base-path="/kswertung" --revisionable --has-bundles=0 --is-translatable=false

The PR adds the possibility to disable an option by setting it to 0 or false.

@jmolivas jmolivas modified the milestone: RC-24 Jul 3, 2017
@jmolivas
Copy link
Member

jmolivas commented Jul 5, 2017

@derhasi thanks for the PR.

By setting an option as VALUE_NONE if not passed value is false.

Not sure if we should ask for those options on the interactive mode, can we just used them as false.

@derhasi
Copy link
Contributor Author

derhasi commented Jul 6, 2017

@jmolivas I think the option always should be asked for interactively, when it was not explicitly set in the command line.

But as you cannot pass a value to an option that is set to VALUE_NONE, I chose to use VALUE_OPTIONAL. With hasOption() you can check if the option is used in the command line and otherwise ask for a value interactively.

@derhasi
Copy link
Contributor Author

derhasi commented Jul 6, 2017

The implementation of this PR would result in ...

  • drupal generate:entity:content => ❓ interactive mode
  • drupal generate:entity:content --revisionable => ✅ revision enabled
  • drupal generate:entity:content --revisionable=0 => ❌ revision disabled
  • drupal generate:entity:content --revisionable=false => ❌ revision disabled
  • drupal generate:entity:content --revisionable=Baum => ✅ revision enabled

@jmolivas jmolivas modified the milestones: RC-24, RC-25, RC-26 Jul 14, 2017
@jmolivas jmolivas modified the milestones: RC-26, 1.0.0-fixes Jul 28, 2017
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