Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
XigenDominic committed May 5, 2020
1 parent c3c8f8b commit e41ac63
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 16 deletions.
14 changes: 12 additions & 2 deletions Console/Command/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class Category extends Command
*/
protected $categoryHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;

/**
* Category constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -81,11 +91,11 @@ protected function execute(
(string) __('You are about to generate fake category data. Are you sure? [y/N]'),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}

$this->output->writeln('[' . $this->dateTime->gmtDate() . '] Start');

$progress = new ProgressBar($this->output, $limit);
Expand Down
11 changes: 10 additions & 1 deletion Console/Command/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ class Customer extends Command
*/
protected $customerHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;
/**
* Customer constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -81,7 +90,7 @@ protected function execute(
(string) __('You are about to generate fake customer data. Are you sure? [y/N]'),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}
Expand Down
14 changes: 12 additions & 2 deletions Console/Command/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class Order extends Command
*/
protected $orderHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;

/**
* Order constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -81,11 +91,11 @@ protected function execute(
(string) __('You are about to generate fake order data. Are you sure? [y/N]'),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}

$this->output->writeln('[' . $this->dateTime->gmtDate() . '] Start');

$progress = new ProgressBar($this->output, $limit);
Expand Down
18 changes: 14 additions & 4 deletions Console/Command/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Xigen\Faker\Console\Command;

use Magento\Catalog\Model\Product\Type;
use Magento\Framework\App\Area;
use Magento\Framework\Console\Cli;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
Expand All @@ -10,8 +12,6 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Magento\Catalog\Model\Product\Type;
use Magento\Framework\App\Area;

/**
* Product Console
Expand Down Expand Up @@ -44,6 +44,16 @@ class Product extends Command
*/
protected $productHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;

/**
* Product constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -82,7 +92,7 @@ protected function execute(

if ($generate) {
$helper = $this->getHelper('question');

$question = new ConfirmationQuestion(
(string) __(
'You are about to generate fake product data%1. Are you sure? [y/N]',
Expand All @@ -94,7 +104,7 @@ protected function execute(
if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}

$this->output->writeln('[' . $this->dateTime->gmtDate() . '] Start');

$progress = new ProgressBar($this->output, $limit);
Expand Down
14 changes: 12 additions & 2 deletions Console/Command/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class Review extends Command
*/
protected $reviewHelper;

/**
* @var InputInterface
*/
protected $input;

/**
* @var OutputInterface
*/
protected $output;

/**
* Review constructor.
* @param \Psr\Log\LoggerInterface $logger
Expand Down Expand Up @@ -77,12 +87,12 @@ protected function execute(

if ($generate) {
$helper = $this->getHelper('question');

$question = new ConfirmationQuestion(
(string) __('You are about to generate fake review data. Are you sure? [y/N]'),
false
);

if (!$helper->ask($this->input, $this->output, $question) && $this->input->isInteractive()) {
return Cli::RETURN_FAILURE;
}
Expand Down
15 changes: 15 additions & 0 deletions Helper/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ class Order extends AbstractHelper
*/
protected $stockItem;

/**
* @var \Magento\Framework\App\ObjectManager
*/
protected $_objectManager;

/**
* @var Magento\Quote\Api\CartManagementInterface
*/
protected $cartManagementInterface;

/**
* @var Magento\Sales\Model\Service\InvoiceService
*/
protected $invoiceService;

/**
* Order constructor.
* @param \Magento\Framework\App\Helper\Context $context
Expand Down
3 changes: 1 addition & 2 deletions Helper/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Xigen\Faker\Helper;

use Magento\Framework\App\Helper\AbstractHelper;
use Magento\Catalog\Model\Product\Type;

/**
* Product helper
Expand Down Expand Up @@ -317,7 +316,7 @@ public function getRandomProduct($limit = 1, $inStockOnly = false, $simpleOnly =
if ($simpleOnly) {
$collection->addAttributeToFilter('type_id', ['eq' => \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE]);
}

if ($inStockOnly) {
$this->stockFilter->addInStockFilterToCollection($collection);
}
Expand Down
10 changes: 10 additions & 0 deletions Helper/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ class Review extends AbstractHelper
*/
protected $reviewFactory;

/**
* @var \Xigen\Faker\Helper\Customer
*/
protected $customerHelper;

/**
* @var \Xigen\Faker\Helper\Product
*/
protected $productHelper;

/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Console based fake data generator - just generate what you need",
"type": "magento2-module",
"license": "proprietary",
"version": "1.1.10",
"version": "1.1.11",
"authors": [
{
"name": "Dominic Xigen",
Expand All @@ -21,7 +21,10 @@
"fzaninotto/faker": "*",
"magento/framework": "*",
"php": "~5.6.0||~7.0.0||~7.1.0||~7.2.0||~7.3.0",
"symfony/console": "*"
"symfony/console": "*",
"magento/module-catalog": "*",
"magento/module-quote": "*",
"magento/module-shipping": "*"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Xigen_Faker" setup_version="1.1.10"/>
<module name="Xigen_Faker" setup_version="1.1.11"/>
</config>

0 comments on commit e41ac63

Please sign in to comment.