Skip to content

Commit

Permalink
fix mapper constructor parameter for nc21
Browse files Browse the repository at this point in the history
  • Loading branch information
datenangebot committed Apr 9, 2021
1 parent ad98e61 commit 54b01a2
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 21 deletions.
4 changes: 2 additions & 2 deletions lib/Db/FeelingdataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\IDbConnection;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;

class FeelingdataMapper extends QBMapper {

public function __construct(IDbConnection $db) {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'health_feelingdata', Feelingdata::class);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Db/MeasurementdataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\IDbConnection;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;

class MeasurementdataMapper extends QBMapper {

public function __construct(IDbConnection $db) {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'health_measurementdata', Measurementdata::class);
}

Expand Down
15 changes: 8 additions & 7 deletions lib/Db/PersonMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@
namespace OCA\Health\Db;

use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Entity;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\IDbConnection;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;

class PersonMapper extends QBMapper {

public function __construct(IDbConnection $db) {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'health_persons', Person::class);
}

public function find(int $id, string $userId = "") {
public function find(int $id, string $userId = ""): ?Entity
{
$qb = $this->db->getQueryBuilder();

$qb->select('*');
Expand All @@ -47,14 +49,13 @@ public function find(int $id, string $userId = "") {

try {
return $this->findEntity($qb);
} catch (DoesNotExistException $e) {
} catch (DoesNotExistException | MultipleObjectsReturnedException $e) {
return null;
} catch (MultipleObjectsReturnedException $e) {
return null;
}
}

public function findAll(string $userId) {
public function findAll(string $userId): array
{
$qb = $this->db->getQueryBuilder();

$qb->select('*')
Expand Down
4 changes: 2 additions & 2 deletions lib/Db/SleepdataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\IDbConnection;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;

class SleepdataMapper extends QBMapper {

public function __construct(IDbConnection $db) {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'health_sleepdata', Sleepdata::class);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Db/SmokingdataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

namespace OCA\Health\Db;

use OCP\IDbConnection;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;

class SmokingdataMapper extends QBMapper {

public function __construct(IDbConnection $db) {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'health_smokingdata', Smokingdata::class);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Db/WeightdataMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\IDbConnection;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;

class WeightdataMapper extends QBMapper {

public function __construct(IDbConnection $db) {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'health_weightdata', Weightdata::class);
}

Expand Down
17 changes: 13 additions & 4 deletions lib/Services/PersonsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,20 @@ class PersonsService {
protected $permissionService;
protected $userManager;

public function __construct(PersonMapper $pM, $userId, WeightdataService $wdS, FormatHelperService $fhS, PermissionService $permissionService, IUserManager $userManager, FeelingdataService $feelingdataService, SleepdataService $sleepdataService, MeasurementdataService $measurementdataService) {
$this->personMapper = $pM;
public function __construct(PersonMapper $personMapper,
$userId,
WeightdataService $weightdataService,
FormatHelperService $formatHelperService,
PermissionService $permissionService,
IUserManager $userManager,
FeelingdataService $feelingdataService,
SleepdataService $sleepdataService,
MeasurementdataService $measurementdataService
) {
$this->personMapper = $personMapper;
$this->userId = $userId;
$this->weightdataService = $wdS;
$this->formatHelperService = $fhS;
$this->weightdataService = $weightdataService;
$this->formatHelperService = $formatHelperService;
$this->permissionService = $permissionService;
$this->userManager = $userManager;
$this->sleepdataService = $sleepdataService;
Expand Down

0 comments on commit 54b01a2

Please sign in to comment.