Unable to display database table values on frontend in magento 2.1.7I just can't tell what is wrong with this Model code that save() is raising an exception.||Varien Data collection toOptionArray does not pass arguments to protected method?Magento 2: Duplicate key-sequence unique identity-constraint 'uniqueVirtualType' fatal error while di:compileCall to undefined method on custom collection Resource ModelModel class not found in …/magento/framework/ObjectManager/Factory/AbstractFactory.php:93Magento 2.1.6 Cannot save shipmentGet item collection by sku Magento 2Magento 2: toolbar url problems in custom module with custom routerMagento 2: How to override model resource configurable fileunable to solve the error in magento2
How would photo IDs work for shapeshifters?
Does a dangling wire really electrocute me if I'm standing in water?
What does 'script /dev/null' do?
What is the purpose of trimming the bottom corners of TLC plates?
Is Social Media Science Fiction?
Cannot send mail from command line, sasl authentication error
aging parents with no investments
Is it worth rebuilding a wheel myself to save money
Where to refill my bottle in India?
Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?
Is std::next for vector O(n) or O(1)?
What is GPS' 19 year rollover and does it present a cybersecurity issue?
Domain expired, GoDaddy holds it and is asking more money
Can I find out the caloric content of bread by dehydrating it?
Email Account under attack (really) - anything I can do?
Supports in 3d printing
Short story: alien planet where slow students are executed
Ideas for 3rd eye abilities
Why can Shazam fly?
Information to fellow intern about hiring?
Typesetting a double Over Dot on top of a symbol
Is domain driven design an anti-SQL pattern?
Poison Arrows Piercing damage reduced to 0, do you still get poisoned?
Is it possible to build an equivalent function just looking at the input and output of the original function?
Unable to display database table values on frontend in magento 2.1.7
I just can't tell what is wrong with this Model code that save() is raising an exception.||Varien Data collection toOptionArray does not pass arguments to protected method?Magento 2: Duplicate key-sequence unique identity-constraint 'uniqueVirtualType' fatal error while di:compileCall to undefined method on custom collection Resource ModelModel class not found in …/magento/framework/ObjectManager/Factory/AbstractFactory.php:93Magento 2.1.6 Cannot save shipmentGet item collection by sku Magento 2Magento 2: toolbar url problems in custom module with custom routerMagento 2: How to override model resource configurable fileunable to solve the error in magento2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am trying to fetch table on frontend but getting this error
Fatal error: Class 'CrudCrudatfrontendModelResourceModelPost' not
found in
D:xampphtdocsnewmagvendormagentoframeworkObjectManagerFactoryAbstractFactory.php
on line 93
app/code/Crud/Crudatfrontend/
├── Block
│ └── index.php
├── etc
│ └── module.xml
├── Model
│ ├── Post.php
│ ├── ResourceModel
│ │ ├── Post
│ │ │ └── Collection.php
│ │ └── Post.php
├── registration.php
├── Setup
│ └── InstallSchema.php
└── view
└── frontend
├── layout
│ └── crud_index_index.xml
├── templates
└── index.phtml
Here is my code,
Block/Index.php
<?php
namespace CrudCrudatfrontendBlock;
use MagentoFrameworkAppFilesystemDirectoryList;
class Index extends MagentoFrameworkViewElementTemplate
protected $_filesystem;
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
CrudCrudatfrontendModelPostFactory $postFactory
)
parent::__construct($context);
$this->_postFactory = $postFactory;
public function getResult()
$post = $this->_postFactory->create();
$collection = $post->getCollection();
return $collection;
Model/Post.php
<?php
namespace CrudCrudatfrontendModel;
class Post extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface
protected function _construct()
$this->_init('CrudCrudatfrontendModelResourceModelPost');
public function getIdentities()
return [self::CACHE_TAG . '_' . $this->getId()];
public function getDefaultValues()
$values = [];
return $values;
ModelResourceModelPost.php
<?php
namespace CrudCrudatfrontendModelResourceModel;
use MagentoFrameworkModelResourceModelDbAbstractDb;
class HelloWorld extends AbstractDb
/**
* Model initialization
*/
protected function _construct()
$this->_init('Crud_Crudatfrontend', 'post_id');
ModelResourceModelPostcollection.php
<?php
namespace CrudCrudatfrontendModelResourceModelPost;
class Collection extends MagentoFrameworkModelResourceModelDbCollectionAbstractCollection
/**
* Define resource model
*
* @return void
*/
protected function _construct()
$this->_init('CrudCrudatfrontendModelPost', 'CrudCrudatfrontendModelResourceModelPost');
database collection magento-2.1.7 resource-model
add a comment |
I am trying to fetch table on frontend but getting this error
Fatal error: Class 'CrudCrudatfrontendModelResourceModelPost' not
found in
D:xampphtdocsnewmagvendormagentoframeworkObjectManagerFactoryAbstractFactory.php
on line 93
app/code/Crud/Crudatfrontend/
├── Block
│ └── index.php
├── etc
│ └── module.xml
├── Model
│ ├── Post.php
│ ├── ResourceModel
│ │ ├── Post
│ │ │ └── Collection.php
│ │ └── Post.php
├── registration.php
├── Setup
│ └── InstallSchema.php
└── view
└── frontend
├── layout
│ └── crud_index_index.xml
├── templates
└── index.phtml
Here is my code,
Block/Index.php
<?php
namespace CrudCrudatfrontendBlock;
use MagentoFrameworkAppFilesystemDirectoryList;
class Index extends MagentoFrameworkViewElementTemplate
protected $_filesystem;
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
CrudCrudatfrontendModelPostFactory $postFactory
)
parent::__construct($context);
$this->_postFactory = $postFactory;
public function getResult()
$post = $this->_postFactory->create();
$collection = $post->getCollection();
return $collection;
Model/Post.php
<?php
namespace CrudCrudatfrontendModel;
class Post extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface
protected function _construct()
$this->_init('CrudCrudatfrontendModelResourceModelPost');
public function getIdentities()
return [self::CACHE_TAG . '_' . $this->getId()];
public function getDefaultValues()
$values = [];
return $values;
ModelResourceModelPost.php
<?php
namespace CrudCrudatfrontendModelResourceModel;
use MagentoFrameworkModelResourceModelDbAbstractDb;
class HelloWorld extends AbstractDb
/**
* Model initialization
*/
protected function _construct()
$this->_init('Crud_Crudatfrontend', 'post_id');
ModelResourceModelPostcollection.php
<?php
namespace CrudCrudatfrontendModelResourceModelPost;
class Collection extends MagentoFrameworkModelResourceModelDbCollectionAbstractCollection
/**
* Define resource model
*
* @return void
*/
protected function _construct()
$this->_init('CrudCrudatfrontendModelPost', 'CrudCrudatfrontendModelResourceModelPost');
database collection magento-2.1.7 resource-model
add a comment |
I am trying to fetch table on frontend but getting this error
Fatal error: Class 'CrudCrudatfrontendModelResourceModelPost' not
found in
D:xampphtdocsnewmagvendormagentoframeworkObjectManagerFactoryAbstractFactory.php
on line 93
app/code/Crud/Crudatfrontend/
├── Block
│ └── index.php
├── etc
│ └── module.xml
├── Model
│ ├── Post.php
│ ├── ResourceModel
│ │ ├── Post
│ │ │ └── Collection.php
│ │ └── Post.php
├── registration.php
├── Setup
│ └── InstallSchema.php
└── view
└── frontend
├── layout
│ └── crud_index_index.xml
├── templates
└── index.phtml
Here is my code,
Block/Index.php
<?php
namespace CrudCrudatfrontendBlock;
use MagentoFrameworkAppFilesystemDirectoryList;
class Index extends MagentoFrameworkViewElementTemplate
protected $_filesystem;
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
CrudCrudatfrontendModelPostFactory $postFactory
)
parent::__construct($context);
$this->_postFactory = $postFactory;
public function getResult()
$post = $this->_postFactory->create();
$collection = $post->getCollection();
return $collection;
Model/Post.php
<?php
namespace CrudCrudatfrontendModel;
class Post extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface
protected function _construct()
$this->_init('CrudCrudatfrontendModelResourceModelPost');
public function getIdentities()
return [self::CACHE_TAG . '_' . $this->getId()];
public function getDefaultValues()
$values = [];
return $values;
ModelResourceModelPost.php
<?php
namespace CrudCrudatfrontendModelResourceModel;
use MagentoFrameworkModelResourceModelDbAbstractDb;
class HelloWorld extends AbstractDb
/**
* Model initialization
*/
protected function _construct()
$this->_init('Crud_Crudatfrontend', 'post_id');
ModelResourceModelPostcollection.php
<?php
namespace CrudCrudatfrontendModelResourceModelPost;
class Collection extends MagentoFrameworkModelResourceModelDbCollectionAbstractCollection
/**
* Define resource model
*
* @return void
*/
protected function _construct()
$this->_init('CrudCrudatfrontendModelPost', 'CrudCrudatfrontendModelResourceModelPost');
database collection magento-2.1.7 resource-model
I am trying to fetch table on frontend but getting this error
Fatal error: Class 'CrudCrudatfrontendModelResourceModelPost' not
found in
D:xampphtdocsnewmagvendormagentoframeworkObjectManagerFactoryAbstractFactory.php
on line 93
app/code/Crud/Crudatfrontend/
├── Block
│ └── index.php
├── etc
│ └── module.xml
├── Model
│ ├── Post.php
│ ├── ResourceModel
│ │ ├── Post
│ │ │ └── Collection.php
│ │ └── Post.php
├── registration.php
├── Setup
│ └── InstallSchema.php
└── view
└── frontend
├── layout
│ └── crud_index_index.xml
├── templates
└── index.phtml
Here is my code,
Block/Index.php
<?php
namespace CrudCrudatfrontendBlock;
use MagentoFrameworkAppFilesystemDirectoryList;
class Index extends MagentoFrameworkViewElementTemplate
protected $_filesystem;
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
CrudCrudatfrontendModelPostFactory $postFactory
)
parent::__construct($context);
$this->_postFactory = $postFactory;
public function getResult()
$post = $this->_postFactory->create();
$collection = $post->getCollection();
return $collection;
Model/Post.php
<?php
namespace CrudCrudatfrontendModel;
class Post extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface
protected function _construct()
$this->_init('CrudCrudatfrontendModelResourceModelPost');
public function getIdentities()
return [self::CACHE_TAG . '_' . $this->getId()];
public function getDefaultValues()
$values = [];
return $values;
ModelResourceModelPost.php
<?php
namespace CrudCrudatfrontendModelResourceModel;
use MagentoFrameworkModelResourceModelDbAbstractDb;
class HelloWorld extends AbstractDb
/**
* Model initialization
*/
protected function _construct()
$this->_init('Crud_Crudatfrontend', 'post_id');
ModelResourceModelPostcollection.php
<?php
namespace CrudCrudatfrontendModelResourceModelPost;
class Collection extends MagentoFrameworkModelResourceModelDbCollectionAbstractCollection
/**
* Define resource model
*
* @return void
*/
protected function _construct()
$this->_init('CrudCrudatfrontendModelPost', 'CrudCrudatfrontendModelResourceModelPost');
database collection magento-2.1.7 resource-model
database collection magento-2.1.7 resource-model
asked 1 hour ago
bhakti thakkarbhakti thakkar
558114
558114
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Resources class name is wrong
class HelloWorld extends AbstractDb
it should be
class Post extends AbstractDb
Change it to ModelResourceModelPost.php
Ah, how can I miss this. Thanks
– bhakti thakkar
1 hour ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269353%2funable-to-display-database-table-values-on-frontend-in-magento-2-1-7%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Resources class name is wrong
class HelloWorld extends AbstractDb
it should be
class Post extends AbstractDb
Change it to ModelResourceModelPost.php
Ah, how can I miss this. Thanks
– bhakti thakkar
1 hour ago
add a comment |
Resources class name is wrong
class HelloWorld extends AbstractDb
it should be
class Post extends AbstractDb
Change it to ModelResourceModelPost.php
Ah, how can I miss this. Thanks
– bhakti thakkar
1 hour ago
add a comment |
Resources class name is wrong
class HelloWorld extends AbstractDb
it should be
class Post extends AbstractDb
Change it to ModelResourceModelPost.php
Resources class name is wrong
class HelloWorld extends AbstractDb
it should be
class Post extends AbstractDb
Change it to ModelResourceModelPost.php
answered 1 hour ago
Amit Bera♦Amit Bera
59.7k1676178
59.7k1676178
Ah, how can I miss this. Thanks
– bhakti thakkar
1 hour ago
add a comment |
Ah, how can I miss this. Thanks
– bhakti thakkar
1 hour ago
Ah, how can I miss this. Thanks
– bhakti thakkar
1 hour ago
Ah, how can I miss this. Thanks
– bhakti thakkar
1 hour ago
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269353%2funable-to-display-database-table-values-on-frontend-in-magento-2-1-7%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown