Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refac: remove duplicate code from AbstractQuery #8831

Closed
wants to merge 1 commit into from
Closed

refac: remove duplicate code from AbstractQuery #8831

wants to merge 1 commit into from

Conversation

gimler
Copy link
Contributor

@gimler gimler commented Jul 6, 2021

AbstractQuery::getSingleResult is 90% the same code as AbstractQuery::getOneOrNullResult the only different is that AbstractQuery::getOneOrNullResult catch the NoResultException and return null.

`AbstractQuery::getSingleResult` is 90% the same code as `AbstractQuery::getOneOrNullResult` the only different is that `AbstractQuery::getOneOrNullResult` catch the `NoResultException` and return null.
} catch (NoResultException $e) {
return null;
}

if ($this->_hydrationMode !== self::HYDRATE_SINGLE_SCALAR && ! $result) {
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getSingleResult throws an exception here instead of returning null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SenseException yes the new code catch the NoResultException and return null same as before.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants