Magento 2.2.6 | Uncaught Error: Undefined class constant 'CACHE_TAG'Error in custom Admin menu controller - Magento 2Magento 2 Custom module admin controller errorMagento 2 Sending emails triggered by observerMagento2 (v2.2) Error Login Admin + FrontendUnable to synchronized app import configuration failedMagento 2.2 Fatal error: Uncaught ReflectionException: errorAdd to cart button freezes and nothing is put in basketMagento 2 Fatal Error on Setup pageMagento 2.2.3 CE unable to add/remove item from wishlist?Magento 2 Fatal error: Uncaught Error: Call to undefined method MagentoFrameworkSessionSaveHandlerNative::write()

French for 'It must be my imagination'?

Why does nature favour the Laplacian?

How to stop co-workers from teasing me because I know Russian?

What's the polite way to say "I need to urinate"?

How do Bards prepare spells?

How come there are so many candidates for the 2020 Democratic party presidential nomination?

A ​Note ​on ​N!

Why don't other Westeros houses use wildfire?

simple conditions equation

Was is really necessary for the Lunar module LM to have 2 stages?

What route did the Hindenburg take when traveling from Germany to the U.S.?

Examples of subgroups where it's nontrivial to show closure under multiplication?

Is there a way to get a compiler for the original B programming language?

How can the Zone of Truth spell be defeated without the caster knowing?

Critique of timeline aesthetic

Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?

Which big number is bigger?

US visa is under administrative processing, I need the passport back ASAP

Does the sign matter for proportionality?

A Strange Latex Symbol

Sci-fi novel series with instant travel between planets through gates. A river runs through the gates

How to solve constants out of the internal energy equation?

how to sum variables from file in bash

How to pronounce 'C++' in Spanish



Magento 2.2.6 | Uncaught Error: Undefined class constant 'CACHE_TAG'


Error in custom Admin menu controller - Magento 2Magento 2 Custom module admin controller errorMagento 2 Sending emails triggered by observerMagento2 (v2.2) Error Login Admin + FrontendUnable to synchronized app import configuration failedMagento 2.2 Fatal error: Uncaught ReflectionException: errorAdd to cart button freezes and nothing is put in basketMagento 2 Fatal Error on Setup pageMagento 2.2.3 CE unable to add/remove item from wishlist?Magento 2 Fatal error: Uncaught Error: Call to undefined method MagentoFrameworkSessionSaveHandlerNative::write()






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am very new to Magento, i created a CRUD custom module, when I input some data in form, and hit save button, I got an error like this:



Fatal error: Uncaught Error: Undefined class constant 'CACHE_TAG' in
C:xampphtdocstest-localappcodeTestingSimpleNewsModelNews.php:9
Stack trace: #0 C:xampphtdocstest-localvendormagentoframeworkAppCacheTagStrategyIdentifier.php(25):TestingSimpleNewModeNews->getIdentities()
#1 C:xampphtdocstest-localvendormagentoframeworkAppCacheTagResolver.php(43): MagentoFrameworkAppCacheTagStrategyIdentifier->getTags(Object(TestingSimpleNewsModelNews))
#2 C:xampphtdocstest-localvendormagentomodule-page-cacheObserverFlushCacheByTags.php(64): MagentoFrameworkAppCacheTagResolver->getTags(Object(TestingSimpleNewsModelNews))
#3 C:xampphtdocstest-localvendormagentoframeworkEventInvokerInvokerDefault.php(72): MagentoPageCacheObserverFlushCacheByTags->execute(Object(MagentoFrameworkEventObserver))
#4 C:xampphtdocstest-localvendormagentoframeworkEventInvokerInvokerDefault.php(60): MagentoFrameworkEventInvokerInvokerDefault->_callObserverMethod(Object(Magento in C:xampphtdocstest-localappcodeTestingSimpleNewsModelNews.php on line 9


This is my htdocstest-localappcodeTestingSimpleNewsModelNews.php code:



<?php

namespace TestingSimpleNewsModel;

class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

public function getIdentities()

return [self::CACHE_TAG . '_' . $this->getId()];


public function getDefaultValues()

$values = [];

return $values;


/**
* Define resource model
*/
protected function _construct()

$this->_init('TestingSimpleNewsModelResourceNews');











share|improve this question









New contributor




Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    0















    I am very new to Magento, i created a CRUD custom module, when I input some data in form, and hit save button, I got an error like this:



    Fatal error: Uncaught Error: Undefined class constant 'CACHE_TAG' in
    C:xampphtdocstest-localappcodeTestingSimpleNewsModelNews.php:9
    Stack trace: #0 C:xampphtdocstest-localvendormagentoframeworkAppCacheTagStrategyIdentifier.php(25):TestingSimpleNewModeNews->getIdentities()
    #1 C:xampphtdocstest-localvendormagentoframeworkAppCacheTagResolver.php(43): MagentoFrameworkAppCacheTagStrategyIdentifier->getTags(Object(TestingSimpleNewsModelNews))
    #2 C:xampphtdocstest-localvendormagentomodule-page-cacheObserverFlushCacheByTags.php(64): MagentoFrameworkAppCacheTagResolver->getTags(Object(TestingSimpleNewsModelNews))
    #3 C:xampphtdocstest-localvendormagentoframeworkEventInvokerInvokerDefault.php(72): MagentoPageCacheObserverFlushCacheByTags->execute(Object(MagentoFrameworkEventObserver))
    #4 C:xampphtdocstest-localvendormagentoframeworkEventInvokerInvokerDefault.php(60): MagentoFrameworkEventInvokerInvokerDefault->_callObserverMethod(Object(Magento in C:xampphtdocstest-localappcodeTestingSimpleNewsModelNews.php on line 9


    This is my htdocstest-localappcodeTestingSimpleNewsModelNews.php code:



    <?php

    namespace TestingSimpleNewsModel;

    class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

    public function getIdentities()

    return [self::CACHE_TAG . '_' . $this->getId()];


    public function getDefaultValues()

    $values = [];

    return $values;


    /**
    * Define resource model
    */
    protected function _construct()

    $this->_init('TestingSimpleNewsModelResourceNews');











    share|improve this question









    New contributor




    Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      I am very new to Magento, i created a CRUD custom module, when I input some data in form, and hit save button, I got an error like this:



      Fatal error: Uncaught Error: Undefined class constant 'CACHE_TAG' in
      C:xampphtdocstest-localappcodeTestingSimpleNewsModelNews.php:9
      Stack trace: #0 C:xampphtdocstest-localvendormagentoframeworkAppCacheTagStrategyIdentifier.php(25):TestingSimpleNewModeNews->getIdentities()
      #1 C:xampphtdocstest-localvendormagentoframeworkAppCacheTagResolver.php(43): MagentoFrameworkAppCacheTagStrategyIdentifier->getTags(Object(TestingSimpleNewsModelNews))
      #2 C:xampphtdocstest-localvendormagentomodule-page-cacheObserverFlushCacheByTags.php(64): MagentoFrameworkAppCacheTagResolver->getTags(Object(TestingSimpleNewsModelNews))
      #3 C:xampphtdocstest-localvendormagentoframeworkEventInvokerInvokerDefault.php(72): MagentoPageCacheObserverFlushCacheByTags->execute(Object(MagentoFrameworkEventObserver))
      #4 C:xampphtdocstest-localvendormagentoframeworkEventInvokerInvokerDefault.php(60): MagentoFrameworkEventInvokerInvokerDefault->_callObserverMethod(Object(Magento in C:xampphtdocstest-localappcodeTestingSimpleNewsModelNews.php on line 9


      This is my htdocstest-localappcodeTestingSimpleNewsModelNews.php code:



      <?php

      namespace TestingSimpleNewsModel;

      class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

      public function getIdentities()

      return [self::CACHE_TAG . '_' . $this->getId()];


      public function getDefaultValues()

      $values = [];

      return $values;


      /**
      * Define resource model
      */
      protected function _construct()

      $this->_init('TestingSimpleNewsModelResourceNews');











      share|improve this question









      New contributor




      Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I am very new to Magento, i created a CRUD custom module, when I input some data in form, and hit save button, I got an error like this:



      Fatal error: Uncaught Error: Undefined class constant 'CACHE_TAG' in
      C:xampphtdocstest-localappcodeTestingSimpleNewsModelNews.php:9
      Stack trace: #0 C:xampphtdocstest-localvendormagentoframeworkAppCacheTagStrategyIdentifier.php(25):TestingSimpleNewModeNews->getIdentities()
      #1 C:xampphtdocstest-localvendormagentoframeworkAppCacheTagResolver.php(43): MagentoFrameworkAppCacheTagStrategyIdentifier->getTags(Object(TestingSimpleNewsModelNews))
      #2 C:xampphtdocstest-localvendormagentomodule-page-cacheObserverFlushCacheByTags.php(64): MagentoFrameworkAppCacheTagResolver->getTags(Object(TestingSimpleNewsModelNews))
      #3 C:xampphtdocstest-localvendormagentoframeworkEventInvokerInvokerDefault.php(72): MagentoPageCacheObserverFlushCacheByTags->execute(Object(MagentoFrameworkEventObserver))
      #4 C:xampphtdocstest-localvendormagentoframeworkEventInvokerInvokerDefault.php(60): MagentoFrameworkEventInvokerInvokerDefault->_callObserverMethod(Object(Magento in C:xampphtdocstest-localappcodeTestingSimpleNewsModelNews.php on line 9


      This is my htdocstest-localappcodeTestingSimpleNewsModelNews.php code:



      <?php

      namespace TestingSimpleNewsModel;

      class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

      public function getIdentities()

      return [self::CACHE_TAG . '_' . $this->getId()];


      public function getDefaultValues()

      $values = [];

      return $values;


      /**
      * Define resource model
      */
      protected function _construct()

      $this->_init('TestingSimpleNewsModelResourceNews');








      magento2 magento2.2.6 crud






      share|improve this question









      New contributor




      Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Apr 24 at 16:13









      Yann Martel

      11716




      11716






      New contributor




      Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Apr 24 at 15:49









      Saif ZakirSaif Zakir

      32




      32




      New contributor




      Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Saif Zakir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          0














          In the function getIdentities() in your class you can see that the class constant CACHE_TAG is being used. You can read all about class constants here:



          I would suggest defining it at the top of your class, this cache tag let's magento know where to store cached data. An example would be:



          namespace TestingSimpleNewsModel;

          class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

          const CACHE_TAG = 'TESTING_SIMPLE_NEWS';

          public function getIdentities()

          return [self::CACHE_TAG . '_' . $this->getId()];


          public function getDefaultValues()

          $values = [];

          return $values;


          /**
          * Define resource model
          */
          protected function _construct()

          $this->_init('TestingSimpleNewsModelResourceNews');







          share|improve this answer

























            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
            );



            );






            Saif Zakir is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272321%2fmagento-2-2-6-uncaught-error-undefined-class-constant-cache-tag%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









            0














            In the function getIdentities() in your class you can see that the class constant CACHE_TAG is being used. You can read all about class constants here:



            I would suggest defining it at the top of your class, this cache tag let's magento know where to store cached data. An example would be:



            namespace TestingSimpleNewsModel;

            class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

            const CACHE_TAG = 'TESTING_SIMPLE_NEWS';

            public function getIdentities()

            return [self::CACHE_TAG . '_' . $this->getId()];


            public function getDefaultValues()

            $values = [];

            return $values;


            /**
            * Define resource model
            */
            protected function _construct()

            $this->_init('TestingSimpleNewsModelResourceNews');







            share|improve this answer





























              0














              In the function getIdentities() in your class you can see that the class constant CACHE_TAG is being used. You can read all about class constants here:



              I would suggest defining it at the top of your class, this cache tag let's magento know where to store cached data. An example would be:



              namespace TestingSimpleNewsModel;

              class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

              const CACHE_TAG = 'TESTING_SIMPLE_NEWS';

              public function getIdentities()

              return [self::CACHE_TAG . '_' . $this->getId()];


              public function getDefaultValues()

              $values = [];

              return $values;


              /**
              * Define resource model
              */
              protected function _construct()

              $this->_init('TestingSimpleNewsModelResourceNews');







              share|improve this answer



























                0












                0








                0







                In the function getIdentities() in your class you can see that the class constant CACHE_TAG is being used. You can read all about class constants here:



                I would suggest defining it at the top of your class, this cache tag let's magento know where to store cached data. An example would be:



                namespace TestingSimpleNewsModel;

                class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

                const CACHE_TAG = 'TESTING_SIMPLE_NEWS';

                public function getIdentities()

                return [self::CACHE_TAG . '_' . $this->getId()];


                public function getDefaultValues()

                $values = [];

                return $values;


                /**
                * Define resource model
                */
                protected function _construct()

                $this->_init('TestingSimpleNewsModelResourceNews');







                share|improve this answer















                In the function getIdentities() in your class you can see that the class constant CACHE_TAG is being used. You can read all about class constants here:



                I would suggest defining it at the top of your class, this cache tag let's magento know where to store cached data. An example would be:



                namespace TestingSimpleNewsModel;

                class News extends MagentoFrameworkModelAbstractModel implements MagentoFrameworkDataObjectIdentityInterface

                const CACHE_TAG = 'TESTING_SIMPLE_NEWS';

                public function getIdentities()

                return [self::CACHE_TAG . '_' . $this->getId()];


                public function getDefaultValues()

                $values = [];

                return $values;


                /**
                * Define resource model
                */
                protected function _construct()

                $this->_init('TestingSimpleNewsModelResourceNews');








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 24 at 16:50









                Yann Martel

                11716




                11716










                answered Apr 24 at 16:01









                smentinksmentink

                162




                162




















                    Saif Zakir is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    Saif Zakir is a new contributor. Be nice, and check out our Code of Conduct.












                    Saif Zakir is a new contributor. Be nice, and check out our Code of Conduct.











                    Saif Zakir is a new contributor. Be nice, and check out our Code of Conduct.














                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272321%2fmagento-2-2-6-uncaught-error-undefined-class-constant-cache-tag%23new-answer', 'question_page');

                    );

                    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







                    Popular posts from this blog

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?