ResultRow.php 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Drupal\views;
  3. /**
  4. * A class representing a view result row.
  5. */
  6. class ResultRow {
  7. /**
  8. * The entity for this result.
  9. *
  10. * @var \Drupal\Core\Entity\EntityInterface
  11. */
  12. public $_entity = NULL;
  13. /**
  14. * An array of relationship entities.
  15. *
  16. * @var \Drupal\Core\Entity\EntityInterface[]
  17. */
  18. public $_relationship_entities = [];
  19. /**
  20. * An incremental number which represents the row in the entire result.
  21. *
  22. * @var int
  23. */
  24. public $index;
  25. /**
  26. * Constructs a ResultRow object.
  27. *
  28. * @param array $values
  29. * (optional) An array of values to add as properties on the object.
  30. */
  31. public function __construct(array $values = []) {
  32. foreach ($values as $key => $value) {
  33. $this->{$key} = $value;
  34. }
  35. }
  36. /**
  37. * Resets the _entity and _relationship_entities properties.
  38. */
  39. public function resetEntityData() {
  40. $this->_entity = NULL;
  41. $this->_relationship_entities = [];
  42. }
  43. }