Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
Fixed identify command
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjaap committed Nov 27, 2021
1 parent e92ee70 commit 01917fc
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 12 deletions.
9 changes: 6 additions & 3 deletions src/Elgentos/Masquerade/Console/IdentifyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Illuminate\Database\Capsule\Manager as Capsule;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Yaml\Yaml;

class IdentifyCommand extends Command
Expand Down Expand Up @@ -133,14 +134,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
foreach ($candidates as $candidate) {
list($table, $column, $formatter, $examples) = $candidate;
$helper = $this->getHelper('question');
$filename = 'src/config/' . $this->platformName . '/' . $table . '.yaml';
if (empty($examples)) {
$examples = 'None';
}
$question = new ConfirmationQuestion(sprintf("<comment>Example values: %s</comment>\nDo you want to add <options=bold>%s</> with formatter <options=bold>%s</> to <options=bold>%s</>?</question> <info>[Y/n]</info> ", print_r($examples, true), $table . '.' . $column, $formatter, $filename), true);
$question = new ConfirmationQuestion(sprintf("<comment>Example values: %s</comment>\nDo you want to add <options=bold>%s</> with formatter <options=bold>%s</>?</question> <info>[Y/n]</info> ", print_r($examples, true), $table . '.' . $column, $formatter), true);

if ($helper->ask($input, $output, $question)) {
$yamls[$filename][$table]['columns'][$column]['formatter'] = $formatter;
$question = new Question(sprintf('What group do you want to add it to? <info>[%s]</> ', $table), $table);
$group = $helper->ask($input, $output, $question);
$filename = 'src/config/' . $this->platformName . '/' . $group . '.yaml';
$yamls[$filename][$group][$table][$column]['formatter'] = $formatter;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/config/shopware6/cart.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion src/config/shopware6/customer.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
customer:
columns: { first_name: { formatter: first_name }, last_name: { formatter: last_name }, company: { formatter: company }, email: { formatter: email }, remote_address: { formatter: address } }
customer: { first_name: { formatter: first_name }, last_name: { formatter: last_name }, company: { formatter: company }, email: { formatter: email }, remote_address: { formatter: address } }
2 changes: 1 addition & 1 deletion src/config/shopware6/customer_address.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
customer_address:
columns: { country_id: { formatter: country }, country_state_id: { formatter: state }, company: { formatter: company }, first_name: { formatter: first_name }, last_name: { formatter: last_name }, street: { formatter: street }, zipcode: { formatter: zipcode }, city: { formatter: city }, phone_number: { formatter: phone } }
customer_address: { company: { formatter: company }, first_name: { formatter: first_name }, last_name: { formatter: last_name }, street: { formatter: street }, zipcode: { formatter: zipcode }, city: { formatter: city }, phone_number: { formatter: phone } }
2 changes: 1 addition & 1 deletion src/config/shopware6/newsletter_recipient.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
newsletter_recipient:
columns: { email: { formatter: email }, first_name: { formatter: first_name }, last_name: { formatter: last_name }, city: { formatter: city }, street: { formatter: street } }
newsletter_recipient: { email: { formatter: email }, first_name: { formatter: first_name }, last_name: { formatter: last_name }, city: { formatter: city }, street: { formatter: street } }
2 changes: 1 addition & 1 deletion src/config/shopware6/order_address.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
order_address:
columns: { country_id: { formatter: country }, company: { formatter: company }, first_name: { formatter: first_name }, last_name: { formatter: last_name }, street: { formatter: street }, zipcode: { formatter: zipcode }, city: { formatter: city }, phone_number: { formatter: phone } }
order_address: { company: { formatter: company }, first_name: { formatter: first_name }, last_name: { formatter: last_name }, street: { formatter: street }, zipcode: { formatter: zipcode }, city: { formatter: city }, phone_number: { formatter: phone } }
2 changes: 1 addition & 1 deletion src/config/shopware6/order_customer.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
order_customer:
columns: { email: { formatter: email }, first_name: { formatter: first_name }, last_name: { formatter: last_name }, company: { formatter: company }, remote_address: { formatter: address } }
order_customer: { email: { formatter: email }, first_name: { formatter: first_name }, last_name: { formatter: last_name }, company: { formatter: company }, remote_address: { formatter: address } }
2 changes: 1 addition & 1 deletion src/config/shopware6/product_review.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
product_review:
columns: { external_email: { formatter: email } }
product_review: { external_email: { formatter: email } }
2 changes: 1 addition & 1 deletion src/config/shopware6/user.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
user:
columns: { first_name: { formatter: first_name }, last_name: { formatter: last_name }, email: { formatter: email } }
user: { first_name: { formatter: first_name }, last_name: { formatter: last_name }, email: { formatter: email } }

0 comments on commit 01917fc

Please sign in to comment.