2 added 223 characters in body
source | link

The comment field doesn't contain the comments, it just contains settings and statistics (e.g. open or closed).

To get the comments, you need to do an entity query and get all comments that have point to your node of your type, load them and then calculate the average from them.

Also, see http://wizzlern.nl/drupal/drupal-8-entity-cheat-sheet on how to work with content entities and fields. kint() is highly misleading and confusing.

Update. Instead of having to load all comments and calculate the average yourself, you should be able to do an aggregate entity query and get the average value of your field directly: https://www.drupal.org/node/1918702

The comment field doesn't contain the comments, it just contains settings and statistics (e.g. open or closed).

To get the comments, you need to do an entity query and get all comments that have point to your node of your type, load them and then calculate the average from them.

Also, see http://wizzlern.nl/drupal/drupal-8-entity-cheat-sheet on how to work with content entities and fields. kint() is highly misleading and confusing.

The comment field doesn't contain the comments, it just contains settings and statistics (e.g. open or closed).

To get the comments, you need to do an entity query and get all comments that have point to your node of your type, load them and then calculate the average from them.

Also, see http://wizzlern.nl/drupal/drupal-8-entity-cheat-sheet on how to work with content entities and fields. kint() is highly misleading and confusing.

Update. Instead of having to load all comments and calculate the average yourself, you should be able to do an aggregate entity query and get the average value of your field directly: https://www.drupal.org/node/1918702

1
source | link

The comment field doesn't contain the comments, it just contains settings and statistics (e.g. open or closed).

To get the comments, you need to do an entity query and get all comments that have point to your node of your type, load them and then calculate the average from them.

Also, see http://wizzlern.nl/drupal/drupal-8-entity-cheat-sheet on how to work with content entities and fields. kint() is highly misleading and confusing.