Skip to content

Commit

Permalink
Refactored category creation script
Browse files Browse the repository at this point in the history
  • Loading branch information
convenient committed Aug 2, 2015
1 parent 99b944e commit 236c34b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 4 additions & 1 deletion scripts/abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Magento\Framework\App\AreaList as AreaList;
use Magento\Framework\App\State as State;

class AbstractApp implements AppInterface
abstract class AbstractApp implements AppInterface
{
public function __construct(
\Magento\Framework\ObjectManagerInterface $objectManager,
Expand All @@ -36,9 +36,12 @@ public function __construct(

public function launch()
{
$this->run();
return $this->_response;
}

abstract public function run();

public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
{
return false;
Expand Down
6 changes: 2 additions & 4 deletions scripts/create-categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
class CreateCategoriesApp extends AbstractApp
{

public function launch()
public function run()
{
$this->_objectManager->get('Magento\Framework\Registry')
->register('isSecureArea', true);

for ($i=0; $i<200; ++$i) {
for ($i=0; $i<2500; ++$i) {
$newCategoryName = 'Performance Category ' .$i;

/** @var Magento\Catalog\Model\Category\Interceptor $newCategory */
Expand All @@ -35,8 +35,6 @@ public function launch()
echo "Deleting\t" . $newCategoryName . PHP_EOL;
}
}

return parent::launch();
}
}

Expand Down

0 comments on commit 236c34b

Please sign in to comment.