- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2017
03:11 AM
07-06-2017
03:11 AM
Re: Select All in Block for Controller
@Antoine553 remove generation and di folder from var folder, then check it.
Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2017
04:11 AM
07-06-2017
04:11 AM
Re: Select All in Block for Controller
i found the solution
<?php namespace Mymodule\AdminPage\Block\Adminhtml; use Magento\Backend\Block\Template; class Contactslist extends \Magento\Backend\Block\Template { public function __construct( \Magento\Backend\Block\Template\Context $context, \Mymodule\AdminPage\Model\ContactFactory $contactFactory, \Magento\Framework\View\Result\PageFactory $resultPageFactory ) { parent::__construct($context); $this->contactFactory = $contactFactory; $this->resultPageFactory = $resultPageFactory; } public function mycustom(){ echo "test"; } /*public function getAll(){ $data = $this->_objectManager->create('Mymodule\AdminPage\Model\Contact')->getCollection(); foreach ($data as $d ) { echo $d->getToreplace(); echo $d->getReplaceby(); } }*/ }
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2017
04:40 AM
07-06-2017
04:40 AM
Issue was in your block file,
Original Class is
\Mymodule\AdminPage\Model\ContactFactory $contactFactory,
You have kept
\Mymodule\AdminPage\Model\Contact $contact,
So you have to keep Factory Object of your Model Class.
After Apply ModelFactory You must delete var/generation folder.
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial
Magento 2 Blogs/Tutorial
- « Previous
-
- 1
- 2
- Next »