Silverstripe 4.1:
Hi!
I don’t use ExtraMeta field in Page to store Extra Meta Tags but I use it to store some information in json format, so I disabled it with
public function updateCMSFields(FieldList $fields) {
$meta_description = $fields->dataFieldByName("MetaDescription");
$fields->removeFieldsFromTab("Root.Main", array("Metadata"));
[...]
}
then I “override” ExtraMeta field in private static $db:
private static $db = array(
"ExtraMeta" => JSONText::class,
);
I have no problem at the database level: the information is correctly recorded in the database every time I make changes from the CMS. But when I want to get the property ExtraMeta with
$this->owner->ExtraMeta
in Page Extension, I get the old value (it will be update only when I update other property of the page, like Description, Content, Title, etc).
It seems that the object $this is cached, so much so that even the property “LastEdited” remains unchanged.
How can I solve this problem? How can I invalidate the fields cache when I use the setField method to write on the database?
Thanks for the attention!