コード例 #1
0
ファイル: Index.php プロジェクト: rushvisilk/mage2-helloworld
 public function execute()
 {
     /**
      * When Magento get your model, it will generate a Factory class
      * for your model at var/generaton folder and we can get your
      * model by this way
      */
     $newsModel = $this->_modelManufacturerFactory->create();
     $newsCollection = $newsModel->getCollection();
     var_dump($newsCollection->getData());
 }
コード例 #2
0
 /**
  * Set news collection
  */
 protected function _construct()
 {
     parent::_construct();
     $collection = $this->_newsFactory->create()->getCollection()->setOrder('id', 'DESC');
     $this->setCollection($collection);
 }