I want to get the collection's count by using this method :
public function getCount()
{
$connection = $this->getConnection();
$select = $connection->select();
$select->from($this->getEntityTable(), 'COUNT(*)');
$result = (int)$connection->fetchOne($select);
return $result;
}
in the file Vendor\Module\Model\ResourceModel\Item\Collection.php
I have the following error :
Fatal error: Uncaught Error: Call to undefined method Vendor\Module\Model\ResourceModel\Item\Collection::getEntityTable() in C:\xampp\htdocs\magento2\app\code\Vendor\Module\Model\ResourceModel\Item\Collection.php:31 Stack trace: #0 C:\xampp\htdocs\magento2\app\code\Vendor\Module\Block\Crud.php(43)
Am I missing something in the constructor ?