Created
September 5, 2024 13:37
-
-
Save kelvysmoura/4352a9ff0d02ddc48de2d757ffee2e4c to your computer and use it in GitHub Desktop.
Magento 2 POC File
This file contains 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
<?php | |
require __DIR__ . '/app/bootstrap.php'; | |
use Magento\Framework\App\Bootstrap; | |
use Magento\Framework\App\State; | |
use Magento\Framework\Registry; | |
$bootstrap = Bootstrap::create(BP, $_SERVER); | |
$objectManager = $bootstrap->getObjectManager(); | |
$execute = function (array $nsList, callable $callable) use ($objectManager) { | |
$objects = array_map(fn($ns) => $objectManager->get($ns), $nsList); | |
$callable(...$objects); | |
}; | |
$execute([ | |
State::class, | |
Registy::class | |
], function($state, $registry){ | |
// your code here... | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment