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()
Protagonist's race is hidden - should I reveal it?
"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"
What is "leading note" and what does it mean to "raise a note"?
All ASCII characters with a given bit count
Is there any hidden 'W' sound after 'comment' in : Comment est-elle?
How to open locks without disable device?
How to not starve gigantic beasts
FullSimplify a trigonometric expression doesn't work as expected
How to find the right literary agent in the USA?
Is accepting an invalid credit card number a security issue?
"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?
Check if a string is entirely made of the same substring
What is the term for a person whose job is to place products on shelves in stores?
How to translate "red flag" into Spanish?
Retract an already submitted recommendation letter (written for an undergrad student)
c++ diamond problem - How to call base method only once
What is a 'Key' in computer science?
Is it acceptable to use working hours to read general interest books?
My admission is revoked after accepting the admission offer
Split coins into combinations of different denominations
Are these square matrices always diagonalisable?
Additive group of local rings
Are all CP/M-80 implementations binary compatible?
Trumpet valves, lengths, and pitch
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;
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
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.
add a comment |
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
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.
add a comment |
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
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
magento2 magento2.2.6 crud
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.
edited 4 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.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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');
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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');
add a comment |
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');
add a comment |
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');
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');
edited 4 hours ago
Yann Martel
10716
10716
answered 5 hours ago
smentinksmentink
162
162
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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