code: private function entityToString(EntityInterface $entity)
      {
          if (method_exists($entity, '__toString')) {
              return $entity->__toString();
          }
  
          $str = get_class($entity);
  
          if ($entity instanceof \Core\Entity\IdentifiableEntityInterface) {
              $str .= '( ' . $entity->getId() . ' )';
          }
  
          return $str;
      }
docs: Get a string representation from an entity.
  
  Uses the entitys' __toString method, if available.
  Otherwise just returns the class name and if available, the ID.
  
  @param EntityInterface $entity
  
  @return string