Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a raw value function to return value from values array #465

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

sadashivdalvi
Copy link
Contributor

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.

as reported in https://www.drupal.org/project/civicrm_entity/issues/3420872

@civibot civibot bot added the 4.0.x label Feb 13, 2024
@sadashivdalvi
Copy link
Contributor Author

Any update on this, I want to deploy this change on production.

Thanks,
Sadashiv.

@jackrabbithanna
Copy link
Collaborator

This does no harm, will merge this.

@jackrabbithanna jackrabbithanna merged commit 613fcb8 into eileenmcnaughton:4.0.x Apr 19, 2024
puresyntax71 added a commit to puresyntax71/civicrm_entity that referenced this pull request Apr 19, 2024
* origin/4.0.x:
  4.0.x field mappings (eileenmcnaughton#430)
  Adding a raw value function to return value from values array (eileenmcnaughton#465)
  Add filter for state province. (eileenmcnaughton#453)
  Update default timezone handling for dates in CiviEntityStorage.php (eileenmcnaughton#461)
  fix testLoadContact birthdate assertion (eileenmcnaughton#472)
  port to 4.0.x from 436: Include dblocale table names in list of civicrm entity info (eileenmcnaughton#438)
  Ignore convert to UTC if custom field is date only (eileenmcnaughton#469)
  update contact entity referece field on contact merge (eileenmcnaughton#456)
  update test versions of Drupal 10.2 and CiviCRM 5.69 (eileenmcnaughton#468)
  Clean value on custom field for Float (Number) and Money field type (eileenmcnaughton#463)
  From eileenmcnaughton#378 for 4.0.x (eileenmcnaughton#466)
  Add reset to the file URLs generated. (eileenmcnaughton#458)
  fix Views field custom date field output for year only (eileenmcnaughton#439)
puresyntax71 added a commit to puresyntax71/civicrm_entity that referenced this pull request Apr 27, 2024
* origin/4.0.x: (41 commits)
  patch from issue 3420771 (eileenmcnaughton#475)
  only check for data in enabled components on module uninstall (eileenmcnaughton#476)
  Adds is Empty/NULL operators (eileenmcnaughton#423)
  Pathauto (eileenmcnaughton#470)
  fix test to use string instead of integer for zip code (eileenmcnaughton#474)
  4.0.x field mappings (eileenmcnaughton#430)
  Adding a raw value function to return value from values array (eileenmcnaughton#465)
  Add filter for state province. (eileenmcnaughton#453)
  Update default timezone handling for dates in CiviEntityStorage.php (eileenmcnaughton#461)
  fix testLoadContact birthdate assertion (eileenmcnaughton#472)
  port to 4.0.x from 436: Include dblocale table names in list of civicrm entity info (eileenmcnaughton#438)
  Ignore convert to UTC if custom field is date only (eileenmcnaughton#469)
  update contact entity referece field on contact merge (eileenmcnaughton#456)
  update test versions of Drupal 10.2 and CiviCRM 5.69 (eileenmcnaughton#468)
  Clean value on custom field for Float (Number) and Money field type (eileenmcnaughton#463)
  From eileenmcnaughton#378 for 4.0.x (eileenmcnaughton#466)
  Add reset to the file URLs generated. (eileenmcnaughton#458)
  fix Views field custom date field output for year only (eileenmcnaughton#439)
  update Add Contact to Group Views Bulk operations action plugin access handler (eileenmcnaughton#464)
  Readme update (eileenmcnaughton#457)
  ...
puresyntax71 added a commit to puresyntax71/civicrm_entity that referenced this pull request Apr 30, 2024
* origin/4.0.x:
  patch from issue 3420771 (eileenmcnaughton#475)
  only check for data in enabled components on module uninstall (eileenmcnaughton#476)
  Adds is Empty/NULL operators (eileenmcnaughton#423)
  Pathauto (eileenmcnaughton#470)
  fix test to use string instead of integer for zip code (eileenmcnaughton#474)
  4.0.x field mappings (eileenmcnaughton#430)
  Adding a raw value function to return value from values array (eileenmcnaughton#465)
  Add filter for state province. (eileenmcnaughton#453)
  Update default timezone handling for dates in CiviEntityStorage.php (eileenmcnaughton#461)
  fix testLoadContact birthdate assertion (eileenmcnaughton#472)
  port to 4.0.x from 436: Include dblocale table names in list of civicrm entity info (eileenmcnaughton#438)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants