I am trying to get data from database table, my code of index.php
<?php
namespace DemoHelloworldControllerPost;
class Index extends MagentoFrameworkAppActionAction
{
protected $_postFactory;
public function __construct(
MagentoFrameworkAppActionContext $context,
MagentoFrameworkViewResultPageFactory $pageFactory,
PixelproHelloworldModelPostFactory $postFactory
)
{
$this->_pageFactory = $pageFactory;
$this->_postFactory = $postFactory;
return parent::__construct($context);
}
public function execute()
{
$post = $this->_postFactory->create();
$collection = $post->getCollection();
foreach($collection as $item){
echo "<pre>";
print_r($item->getData());
echo "</pre>";
}
}
}
I tried to run these commands but error still appears
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
the error :
1 exception(s):
Exception #0 (ReflectionException): Class DemoHelloworldControllerPostindexInterceptor does not exist
Exception #0 (ReflectionException): Class DemoHelloworldControllerPostindexInterceptor does not exist#1 MagentoFrameworkCodeReaderClassReader->getConstructor() called at [vendor/magento/framework/ObjectManager/Definition/Runtime.php:54]