code: public function getIdentity($object)
      {
          $id = $this->metadata->getIdentifierValues($object);
          if (count($id) === 1) {
              $id = reset($id);
          }
  
          return $id;
      }
docs: {@inheritdoc}