src/Controller/EntityBasedMethods.php
protected function getEntity($entityId)
    {
        $entity = $this->getRepository()->get($entityId);
        if (!$entity instanceof EntityInterface) {
            throw new EntityNotFoundException(
                "There are no entities with provided entity ID."
            );
        }
        return $entity;
    }
protected function getEntity($entityId)
    {
        $entity = $this->getRepository()->get($entityId);
        if (!$entity instanceof EntityInterface) {
            throw new EntityNotFoundException(
                "There are no entities with provided entity ID."
            );
        }
        return $entity;
    }
protected function getEntity ( $ entityId ) { $ entity = $ this -> getRepository ( ) -> get ( $ entityId ) ; if ( ! $ entity instanceof EntityInterface ) { throw new EntityNotFoundException ( "There are no entities with provided entity ID." ) ; } return $ entity ; }
Gets entity with provided primary key

@param mixed $entityId

@return EntityInterface

@throws EntityNotFoundException If no entity was found with
provided primary key
Gets entity with provided primary key