I've been trying to follow this tutorial on computed fields https://www.drupal.org/node/2112677 and I don't get why computed fields are added in the `bix_profile_entity_base_field_info` hook? Is this really necessary to do it in the hook or when adding the field to my own entity I can do it in the entity's `baseFieldDefinitions()` method?
I have tried both ways though and neither seems to be working on Drupal 8.2.0. When I go to canonical link of my entity in admin that uses the default entity view builder, the filed just does not appear there.
I define it like this:
$field = 'duration';
$fields[$field] = BaseFieldDefinition::create('string')
->setLabel(t('Duration'))
->setComputed(true)
->setClass(DurationField::class)
->setDisplayOptions('view', [
'type' => 'string',
'weight' => ++$weight,
])
->setDisplayOptions('form', array(
'type' => 'hidden',
'weight' => ++$weight,
));
`getValue()` (nor `__get()`) on the `DurationField` class does not get ever called either.