Skip to content
Merged
Changes from 1 commit
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
22 changes: 22 additions & 0 deletions lib/Db/FaceDetectionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@
return $this->findEntity($qb);
}

/**
* @throws \OCP\DB\Exception
*/
public function insert(Entity $entity): FaceDetection {
$qb = $this->db->getQueryBuilder();
$qb->select(FaceDetection::$columns)
->from('recognize_face_detections')
->where($qb->expr()->eq('file_id', $qb->createPositionalParameter($entity->getFileId(), IQueryBuilder::PARAM_INT)))

Check failure on line 52 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedMagicMethod

lib/Db/FaceDetectionMapper.php:52:79: UndefinedMagicMethod: Magic method OCP\AppFramework\Db\Entity::getfileid does not exist (see https://psalm.dev/219)
->andWhere($qb->expr()->eq('user_id', $qb->createPositionalParameter($entity->getUserId(), IQueryBuilder::PARAM_STR)))

Check failure on line 53 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedMagicMethod

lib/Db/FaceDetectionMapper.php:53:82: UndefinedMagicMethod: Magic method OCP\AppFramework\Db\Entity::getuserid does not exist (see https://psalm.dev/219)
->andWhere($qb->expr()->eq('x', $qb->createPositionalParameter($entity->getX(), IQueryBuilder::PARAM_INT)))

Check failure on line 54 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedMagicMethod

lib/Db/FaceDetectionMapper.php:54:76: UndefinedMagicMethod: Magic method OCP\AppFramework\Db\Entity::getx does not exist (see https://psalm.dev/219)
->andWhere($qb->expr()->eq('y', $qb->createPositionalParameter($entity->getY(), IQueryBuilder::PARAM_INT)))

Check failure on line 55 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedMagicMethod

lib/Db/FaceDetectionMapper.php:55:76: UndefinedMagicMethod: Magic method OCP\AppFramework\Db\Entity::gety does not exist (see https://psalm.dev/219)
->andWhere($qb->expr()->eq('height', $qb->createPositionalParameter($entity->getHeight(), IQueryBuilder::PARAM_INT)))

Check failure on line 56 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedMagicMethod

lib/Db/FaceDetectionMapper.php:56:81: UndefinedMagicMethod: Magic method OCP\AppFramework\Db\Entity::getheight does not exist (see https://psalm.dev/219)
->andWhere($qb->expr()->eq('width', $qb->createPositionalParameter($entity->getWidth(), IQueryBuilder::PARAM_INT)));

Check failure on line 57 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedMagicMethod

lib/Db/FaceDetectionMapper.php:57:80: UndefinedMagicMethod: Magic method OCP\AppFramework\Db\Entity::getwidth does not exist (see https://psalm.dev/219)
$duplicates = $this->findEntities($qb);

if (empty($duplicates)) {
return parent::insert($entity);

Check failure on line 61 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

LessSpecificReturnStatement

lib/Db/FaceDetectionMapper.php:61:11: LessSpecificReturnStatement: The type 'OCP\AppFramework\Db\Entity' is more general than the declared return type 'OCA\Recognize\Db\FaceDetection' for OCA\Recognize\Db\FaceDetectionMapper::insert (see https://psalm.dev/129)
}

return $duplicates[0];

Check failure on line 64 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

LessSpecificReturnStatement

lib/Db/FaceDetectionMapper.php:64:10: LessSpecificReturnStatement: The type 'OCP\AppFramework\Db\Entity' is more general than the declared return type 'OCA\Recognize\Db\FaceDetection' for OCA\Recognize\Db\FaceDetectionMapper::insert (see https://psalm.dev/129)
}

/**
* @throws \OCP\DB\Exception
*/
Expand Down Expand Up @@ -265,7 +287,7 @@
$qb->executeStatement();
}

public function findDetectionForPreviewImageByClusterId(int $clusterId) : FaceDetection {

Check failure on line 290 in lib/Db/FaceDetectionMapper.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

MoreSpecificReturnType

lib/Db/FaceDetectionMapper.php:290:76: MoreSpecificReturnType: The declared return type 'OCA\Recognize\Db\FaceDetection' for OCA\Recognize\Db\FaceDetectionMapper::findDetectionForPreviewImageByClusterId is more specific than the inferred return type 'OCP\AppFramework\Db\Entity' (see https://psalm.dev/070)
$qb = $this->db->getQueryBuilder();
$qb->select(array_map(fn ($col) => 'd.'.$col, FaceDetection::$columns))
->from('recognize_face_detections', 'd')
Expand Down
Loading