Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Error appears when Aggregation is used and trying to use aggregation on field with reference (entity reference) to taxonomy entity.
Fatal error: __clone method called on non-object in /core/modules/views/src/Plugin/views/field/Field.php on line 855
Because of some reasons in protected function createEntityForGroupBy(EntityInterface $entity, ResultRow $row) $entity == NULL.
Comments
Comment #2
sinn CreditAttribution: sinn at Adyax commentedComment #3
sinn CreditAttribution: sinn at Adyax commentedPatch is attached
Comment #5
ozinHi @sinn, great work! Just fixed patch paths.
Comment #6
sinn CreditAttribution: sinn at Adyax commentedActually patch #3 doesn't resolve error:
New patch is attached.
Comment #8
sinn CreditAttribution: sinn at Adyax commentedSorry, updated paths in a patch
Comment #10
sinn CreditAttribution: sinn at Adyax commentedUpdated
Comment #11
LendudeSince NULL is a valid return value for getEntity, adding a check for it sounds good.
getEntity either returns an object implementing \Drupal\Core\Entity\EntityInterface or null, so i'd just do
if ($original_entity) {
, either way you know you are dealing with one or the other.Also, this needs tests.
Comment #12
dawehnerAccording to the documentation of
getEntity
we returnEntityInterface|null
, so we could simplify this a bit more here:if ($entity = $this->getEntity($values)) { $entity = $this-> ...
and skip the else completely.Comment #13
subson CreditAttribution: subson commentedbased on dawehner comments, trying another patch.
Comment #16
das-peter CreditAttribution: das-peter at Cando commentedI think this is obsolete for 8.3.x as following code is used in
Drupal\views\Plugin\views\field\EntityField
(successor ofDrupal\views\Plugin\views\field\Field
):Comment #17
kristiaanvandeneyndeYup, fixed in #2666166: View with not required relationship and aggregation enabled fails to execute. You guys should get credit in that issue.