Function to get raw values of the entity

Created on 12 February 2024, 11 months ago
Updated 9 May 2024, 8 months ago

Problem/Motivation

I was working on a custom field handler and I got ResultRow class from views where I can access _entity which then has $values which has raw values of the entity fields, the entity I am working on had a contact reference field so the $values has the referred contact id and that is what I wanted, but as the $values is a protected variable I can't access it outside the class and there is no option to get the value in it. I tried using the $row->_entity->toArray() but that returns the display_name or label of the contact and not the id, I also tried civicrmApiNormalize function but the result is same.

Proposed resolution

We can add a function which acts like a getter to fetch value from the $values array.

Feature request
Status

Fixed

Version

4.0

Component

Code

Created by

🇮🇳India sadashiv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024