Skip to content

main.CRITICAL: Class block does not exist error in log files but extension works?

I have a working extension that show reviews, but sometimes there’s an error in the system.log file, and I don’t know why?

var/log/system.log:

[2023-10-26T11:20:42.925466+00:00] main.CRITICAL: Class "CompanyAllReviewsBlockAllReviews" does not exist [] []

The extension resides in:

appcodeCompanyReviewsBlockAllReviews.php
appcodeCompanyReviewsBlockReviews.php

The file AllReviews.php ( allreviews.phtml) shows all reviews, and Reviews.php (reviews.phtml) only shows the 25 latest reviews.

Layout file:

appdesignfrontendSmartwavecompany_defaultMagento_Reviewlayoutdefault.xml


<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="reviews">
        <block class="CompanyReviewsBlockReviews" template="magento_review::reviews.phtml" />
    </referenceBlock>
    <referenceBlock name="allreviews">
        <block class="CompanyReviewsBlockAllReviews" template="magento_review::allreviews.phtml" />
    </referenceBlock>
</body>
</page>

Template files location:

appdesignfrontendSmartwavecompany_defaultMagento_Reviewtemplatesallreviews.phtml
appdesignfrontendSmartwavecompany_defaultMagento_Reviewtemplatesreviews.phtml