-
-
Save erikhansen/bb3d5986f613aa746e8e3b65263fd92f to your computer and use it in GitHub Desktop.
Magento 2 Sandbox Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Magento 2 Sandbox Snippet - You can copy and paste into any shell in a Magento root directory | |
# Extended: https://docs.classyllama.net/disciplines/engineering/magento/sandbox-file-m2 | |
set +H # disable history expansion | |
PHP_CODE=$(cat <<'PHP_CODE' | |
<?php | |
header('Content-type: text/plain'); | |
require __DIR__ . '/app/bootstrap.php'; | |
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); | |
class TeamClassyLlama | |
extends \Magento\Framework\App\Http | |
implements \Magento\Framework\AppInterface { | |
public function launch() | |
{ | |
//sandbox code goes here | |
$exampleMagentoClassInstance = $this->_objectManager->create('\Magento\Catalog\Api\ProductRepositoryInterface'); | |
echo get_class($exampleMagentoClassInstance) . "\n"; | |
//the method must end with this line | |
return $this->_response; | |
} | |
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception) | |
{ | |
return false; | |
} | |
} | |
/** @var \Magento\Framework\App\Http $app */ | |
$app = $bootstrap->createApplication('TeamClassyLlama'); | |
$bootstrap->run($app); | |
PHP_CODE | |
) | |
set -H # re-enable history expansion | |
echo "${PHP_CODE}" | php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment