/** * Override parent to forbid recursive hydration of objects * * Without this we could write an object graph covering the entire database * without any access right check * @param string $target * @param mixed $value */ protected function toOne($target, $value) { // Only keep id of subobject, drop all other fields if (is_array($value)) { $value = $value['id']; } return parent::toOne($target, $value); }