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

[stable21] Add DB exception '@throws' tag to QBMapper PHPDoc #27121

Merged
merged 1 commit into from
May 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions lib/public/AppFramework/Db/QBMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,12 @@ public function getTableName(): string {

/**
* Deletes an entity from the table
*
* @param Entity $entity the entity that should be deleted
* @psalm-param T $entity the entity that should be deleted
* @return Entity the deleted entity
* @psalm-return T the deleted entity
* @throws Exception
* @since 14.0.0
*/
public function delete(Entity $entity): Entity {
Expand All @@ -108,10 +110,12 @@ public function delete(Entity $entity): Entity {

/**
* Creates a new entry in the db from an entity
*
* @param Entity $entity the entity that should be created
* @psalm-param T $entity the entity that should be created
* @return Entity the saved entity with the set id
* @psalm-return T the saved entity with the set id
* @throws Exception
* @since 14.0.0
*/
public function insert(Entity $entity): Entity {
Expand Down Expand Up @@ -151,6 +155,7 @@ public function insert(Entity $entity): Entity {
* @psalm-param T $entity the entity that should be created/updated
* @return Entity the saved entity with the (new) id
* @psalm-return T the saved entity with the (new) id
* @throws Exception
* @throws \InvalidArgumentException if entity has no id
* @since 15.0.0
*/
Expand All @@ -167,11 +172,13 @@ public function insertOrUpdate(Entity $entity): Entity {

/**
* Updates an entry in the db from an entity
* @throws \InvalidArgumentException if entity has no id
*
* @param Entity $entity the entity that should be created
* @psalm-param T $entity the entity that should be created
* @return Entity the saved entity with the set id
* @psalm-return T the saved entity with the set id
* @throws Exception
* @throws \InvalidArgumentException if entity has no id
* @since 14.0.0
*/
public function update(Entity $entity): Entity {
Expand Down Expand Up @@ -253,12 +260,13 @@ protected function getParameterTypeForProperty(Entity $entity, string $property)
* Returns an db result and throws exceptions when there are more or less
* results
*
* @see findEntity
*
* @param IQueryBuilder $query
* @throws DoesNotExistException if the item does not exist
* @throws MultipleObjectsReturnedException if more than one item exist
* @return array the result as row
* @throws Exception
* @throws MultipleObjectsReturnedException if more than one item exist
* @throws DoesNotExistException if the item does not exist
* @see findEntity
*
* @since 14.0.0
*/
protected function findOneQuery(IQueryBuilder $query): array {
Expand Down Expand Up @@ -317,6 +325,7 @@ protected function mapRowToEntity(array $row): Entity {
* @param IQueryBuilder $query
* @return Entity[] all fetched entities
* @psalm-return T[] all fetched entities
* @throws Exception
* @since 14.0.0
*/
protected function findEntities(IQueryBuilder $query): array {
Expand All @@ -339,10 +348,11 @@ protected function findEntities(IQueryBuilder $query): array {
* results
*
* @param IQueryBuilder $query
* @throws DoesNotExistException if the item does not exist
* @throws MultipleObjectsReturnedException if more than one item exist
* @return Entity the entity
* @psalm-return T the entity
* @throws Exception
* @throws MultipleObjectsReturnedException if more than one item exist
* @throws DoesNotExistException if the item does not exist
* @since 14.0.0
*/
protected function findEntity(IQueryBuilder $query): Entity {
Expand Down