diff --git a/Doctrine/SyncIndexWithObjectChangeListener.php b/Doctrine/SyncIndexWithObjectChangeListener.php index 955bf83..5751d9f 100644 --- a/Doctrine/SyncIndexWithObjectChangeListener.php +++ b/Doctrine/SyncIndexWithObjectChangeListener.php @@ -110,10 +110,11 @@ private function sendUpdateIndexMessage($action, $id) /** * @param $object * @return mixed + * @throws \ReflectionException */ private function extractId($object) { - $rp = new \ReflectionProperty($object, $this->config['model_id']); + $rp = (new \ReflectionClass($this->modelClass))->getProperty($this->config['model_id']); $rp->setAccessible(true); $id = $rp->getValue($object); $rp->setAccessible(false);