Magento 2.2.6 | Uncaught Error: Undefined class constant 'CACHE_TAG' Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?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()

What is this word supposed to be?

Determining the ideals of a quotient ring

Co-worker works way more than he should

Trumpet valves, lengths, and pitch

How long after the last departure shall the airport stay open for an emergency return?

Mistake in years of experience in resume?

Do you need a weapon for Thunderous Smite, and the other 'Smite' spells?

Is Bran literally the world's memory?

Check if a string is entirely made of the same substring

How would this chord from "Rocket Man" be analyzed?

Why is this method for solving linear equations systems using determinants works?

How to keep bees out of canned beverages?

Can you stand up from being prone using Skirmisher outside of your turn?

Has a Nobel Peace laureate ever been accused of war crimes?

Could moose/elk survive in the Amazon forest?

Will I lose my paid in full property

How would I use different systems of magic when they are capable of the same effects?

401(k) cost basis

All ASCII characters with a given bit count

What is "leading note" and what does it mean to "raise a note"?

Where did Arya get these scars?

What is ls Largest Number Formed by only moving two sticks in 508?

What units are pgfphysicalheight and pgfphysicalwidth defined in?

Identify story/novel: Tribe on colonized planet, not aware of this. "Taboo," altitude sickness, robot guardian (60s? Young Adult?)



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



Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?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 5 hours ago









      Yann Martel

      10716




      10716






      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 5 hours ago









      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 4 hours ago









                Yann Martel

                10716




                10716










                answered 5 hours ago









                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

                    六本木駅

                    Integral that is continuous and looks like it converges to a geometric seriesTesting if a geometric series converges by taking limit to infinitySummation of arithmetic-geometric series of higher orderGeometric series with polynomial exponentHow to Recognize a Geometric SeriesShowing an integral equality with series over the integersDiscontinuity of a series of continuous functionsReasons why a Series ConvergesSum of infinite geometric series with two terms in summationUsing geometric series for computing IntegralsLimit of geometric series sum when $r = 1$

                    Joseph Lister