* @return \Drupal\Core\Entity\EntityInterface
   *   Returns the entity matching the values.
   */
  public function getEntity(ResultRow $values);

Looking at the code for the implementation, this can also return NULL.

Comments

joachim created an issue. See original summary.

jhodgdon’s picture

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

vinod_kc’s picture

Assigned: Unassigned » vinod_kc
pushpinderchauhan’s picture

Assigned: vinod_kc » Unassigned
Status: Active » Needs review
StatusFileSize
new784 bytes

Please review.

jhodgdon’s picture

Status: Needs review » Needs work
Issue tags: -needs backport to 8.0.x

Thanks for the patch!

+++ b/core/modules/views/src/Plugin/views/field/FieldHandlerInterface.php
@@ -116,8 +116,8 @@ public function elementWrapperClasses($row_index = NULL);
+   *   Returns the entity matching the values, otherwise NULL.

This wording seems a bit odd to me. Maybe at the end something like:

or NULL if there is no matching entity.

would be clearer?

pushpinderchauhan’s picture

Status: Needs work » Needs review
StatusFileSize
new815 bytes

Thank you! Updated your suggestion in this patch.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

That looks better to me. Thanks!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

I think the null typehint should be at the end - it is the less common case.

Committed a9d0778 and pushed to 8.1.x and 8.2.x. Thanks!

  • alexpott committed a9d0778 on 8.1.x
    Issue #2657826 by er.pushpinderrana: FieldHandlerInterface::getEntity()...

  • alexpott committed 322e96f on 8.2.x
    Issue #2657826 by er.pushpinderrana: FieldHandlerInterface::getEntity()...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.