I'm trying to retrieve a value from a Node object. It looks like the value is there, when debugging and checking out the object. But somehow it cannot be accessed.
Trying to get the field:
// $this->entityManager is an instance of EntityTypeManagerInterface
$node = $this->entityManager->getStorage('node')->load($nodeId);
// hasField always returns FALSE
$node->hasField('field_google_hire_identifier');
// $node->get('field_google_hire_identifier'); returns unknown field error
Debugging $node->hasField, looking inside getFieldDefinition:
public function getFieldDefinition($name) {
if (!isset($this->fieldDefinitions)) {
$this->getFieldDefinitions();
}
if (isset($this->fieldDefinitions[$name])) {
// This code should be executed, but it is not.
return $this->fieldDefinitions[$name];
}
}
The second if statement content is not executed, with my understanding it should be.
The node was created with migrate.
I disabled APC and Opcache.