Function to get raw values of the entity

Created on 12 February 2024, 13 days ago
Updated 13 February 2024, 12 days 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

Needs review

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 https://api.contrib.social 0.61.6-2-g546bc20