diff --git a/src/Dao/EntityConverters/TokenEntityConverter.php b/src/Dao/EntityConverters/TokenEntityConverter.php index 4f9f9645..34d10f29 100644 --- a/src/Dao/EntityConverters/TokenEntityConverter.php +++ b/src/Dao/EntityConverters/TokenEntityConverter.php @@ -16,7 +16,7 @@ class TokenEntityConverter implements IEntityConverter public function toEntity(array $array) { - $entity = new \Szurubooru\Entities\Token($array['id']); + $entity = new \Szurubooru\Entities\Token(intval($array['id'])); $entity->setName($array['name']); $entity->setPurpose($array['purpose']); $entity->setAdditionalData($array['additionalData']); diff --git a/src/Dao/EntityConverters/UserEntityConverter.php b/src/Dao/EntityConverters/UserEntityConverter.php index a6a945b9..1276f8cf 100644 --- a/src/Dao/EntityConverters/UserEntityConverter.php +++ b/src/Dao/EntityConverters/UserEntityConverter.php @@ -23,15 +23,15 @@ class UserEntityConverter implements IEntityConverter public function toEntity(array $array) { - $entity = new \Szurubooru\Entities\User($array['id']); + $entity = new \Szurubooru\Entities\User(intval($array['id'])); $entity->setName($array['name']); $entity->setEmail($array['email']); $entity->setEmailUnconfirmed($array['emailUnconfirmed']); $entity->setPasswordHash($array['passwordHash']); - $entity->setAccessRank($array['accessRank']); + $entity->setAccessRank(intval($array['accessRank'])); $entity->setRegistrationTime($array['registrationTime']); $entity->setLastLoginTime($array['lastLoginTime']); - $entity->setAvatarStyle($array['avatarStyle']); + $entity->setAvatarStyle(intval($array['avatarStyle'])); $entity->setBrowsingSettings($array['browsingSettings']); $entity->setAccountConfirmed($array['accountConfirmed']); return $entity; diff --git a/src/Entities/User.php b/src/Entities/User.php index e7b6e08b..6878f9e1 100644 --- a/src/Entities/User.php +++ b/src/Entities/User.php @@ -82,7 +82,7 @@ final class User extends Entity public function setAccessRank($accessRank) { - $this->accessRank = intval($accessRank); + $this->accessRank = $accessRank; } public function getRegistrationTime() @@ -112,7 +112,7 @@ final class User extends Entity public function setAvatarStyle($avatarStyle) { - $this->avatarStyle = intval($avatarStyle); + $this->avatarStyle = $avatarStyle; } public function getBrowsingSettings() diff --git a/tests/Dao/Services/UserSearchServiceTest.php b/tests/Dao/Services/UserSearchServiceTest.php index d78dd557..be0e9b4e 100644 --- a/tests/Dao/Services/UserSearchServiceTest.php +++ b/tests/Dao/Services/UserSearchServiceTest.php @@ -70,7 +70,7 @@ class UserSearchServiceTest extends \Szurubooru\Tests\AbstractDatabaseTestCase $user->setPasswordHash('whatever'); $user->setLastLoginTime('whatever'); $user->setRegistrationTime('whatever'); - $user->setAccessRank('whatever'); + $user->setAccessRank(\Szurubooru\Entities\User::ACCESS_RANK_REGULAR_USER); return $user; } } diff --git a/tests/Dao/UserDaoTest.php b/tests/Dao/UserDaoTest.php index 11906cb6..ed4a1e70 100644 --- a/tests/Dao/UserDaoTest.php +++ b/tests/Dao/UserDaoTest.php @@ -46,7 +46,7 @@ final class UserDaoTest extends \Szurubooru\Tests\AbstractDatabaseTestCase $user->setPasswordHash('whatever'); $user->setLastLoginTime('whatever'); $user->setRegistrationTime('whatever'); - $user->setAccessRank('whatever'); + $user->setAccessRank(\Szurubooru\Entities\User::ACCESS_RANK_REGULAR_USER); return $user; } }