Skip to content

Instantly share code, notes, and snippets.

@shiftenterdev
Created September 26, 2020 18:51
Show Gist options
  • Save shiftenterdev/141038abea60e0f2326b6c1301f08ee7 to your computer and use it in GitHub Desktop.
Save shiftenterdev/141038abea60e0f2326b6c1301f08ee7 to your computer and use it in GitHub Desktop.
Magento Play ground
<?php
/**
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @author Iftakharul Alam Bappa <info@shiftenter.dev> 
*/
require __DIR__ . '/app/bootstrap.php';
class Playground extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface
{
public function launch()
{
//$product = $this->_objectManager->get(\Magento\Catalog\Model\ProductFactory::class)->create();
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
$collection = $this->_objectManager->get(\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class)->create();
$product = $collection->addFieldToFilter('entity_id', ['in'=> [1,2,3,5,7,8]])
->addAttributeToSelect(['id','name','sku'])
->addAttributeToSort('sku', 'desc')
->load();
//echo $product->fetchItem();
var_dump($product->getColumnValues('sku'));
//$product->load(1);
//var_dump($product->getData()[0]);
//echo $product[0]->getData('name') . "\n";
echo "\n";
return $this->_response;
}
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception): bool
{
return false;
}
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$app = $bootstrap->createApplication(Playground::class);
$bootstrap->run($app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment