Moved type conversion to EntityConverters
This commit is contained in:
parent
9bd114e5b6
commit
6e196637eb
5 changed files with 8 additions and 8 deletions
|
@ -16,7 +16,7 @@ class TokenEntityConverter implements IEntityConverter
|
||||||
|
|
||||||
public function toEntity(array $array)
|
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->setName($array['name']);
|
||||||
$entity->setPurpose($array['purpose']);
|
$entity->setPurpose($array['purpose']);
|
||||||
$entity->setAdditionalData($array['additionalData']);
|
$entity->setAdditionalData($array['additionalData']);
|
||||||
|
|
|
@ -23,15 +23,15 @@ class UserEntityConverter implements IEntityConverter
|
||||||
|
|
||||||
public function toEntity(array $array)
|
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->setName($array['name']);
|
||||||
$entity->setEmail($array['email']);
|
$entity->setEmail($array['email']);
|
||||||
$entity->setEmailUnconfirmed($array['emailUnconfirmed']);
|
$entity->setEmailUnconfirmed($array['emailUnconfirmed']);
|
||||||
$entity->setPasswordHash($array['passwordHash']);
|
$entity->setPasswordHash($array['passwordHash']);
|
||||||
$entity->setAccessRank($array['accessRank']);
|
$entity->setAccessRank(intval($array['accessRank']));
|
||||||
$entity->setRegistrationTime($array['registrationTime']);
|
$entity->setRegistrationTime($array['registrationTime']);
|
||||||
$entity->setLastLoginTime($array['lastLoginTime']);
|
$entity->setLastLoginTime($array['lastLoginTime']);
|
||||||
$entity->setAvatarStyle($array['avatarStyle']);
|
$entity->setAvatarStyle(intval($array['avatarStyle']));
|
||||||
$entity->setBrowsingSettings($array['browsingSettings']);
|
$entity->setBrowsingSettings($array['browsingSettings']);
|
||||||
$entity->setAccountConfirmed($array['accountConfirmed']);
|
$entity->setAccountConfirmed($array['accountConfirmed']);
|
||||||
return $entity;
|
return $entity;
|
||||||
|
|
|
@ -82,7 +82,7 @@ final class User extends Entity
|
||||||
|
|
||||||
public function setAccessRank($accessRank)
|
public function setAccessRank($accessRank)
|
||||||
{
|
{
|
||||||
$this->accessRank = intval($accessRank);
|
$this->accessRank = $accessRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRegistrationTime()
|
public function getRegistrationTime()
|
||||||
|
@ -112,7 +112,7 @@ final class User extends Entity
|
||||||
|
|
||||||
public function setAvatarStyle($avatarStyle)
|
public function setAvatarStyle($avatarStyle)
|
||||||
{
|
{
|
||||||
$this->avatarStyle = intval($avatarStyle);
|
$this->avatarStyle = $avatarStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBrowsingSettings()
|
public function getBrowsingSettings()
|
||||||
|
|
|
@ -70,7 +70,7 @@ class UserSearchServiceTest extends \Szurubooru\Tests\AbstractDatabaseTestCase
|
||||||
$user->setPasswordHash('whatever');
|
$user->setPasswordHash('whatever');
|
||||||
$user->setLastLoginTime('whatever');
|
$user->setLastLoginTime('whatever');
|
||||||
$user->setRegistrationTime('whatever');
|
$user->setRegistrationTime('whatever');
|
||||||
$user->setAccessRank('whatever');
|
$user->setAccessRank(\Szurubooru\Entities\User::ACCESS_RANK_REGULAR_USER);
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ final class UserDaoTest extends \Szurubooru\Tests\AbstractDatabaseTestCase
|
||||||
$user->setPasswordHash('whatever');
|
$user->setPasswordHash('whatever');
|
||||||
$user->setLastLoginTime('whatever');
|
$user->setLastLoginTime('whatever');
|
||||||
$user->setRegistrationTime('whatever');
|
$user->setRegistrationTime('whatever');
|
||||||
$user->setAccessRank('whatever');
|
$user->setAccessRank(\Szurubooru\Entities\User::ACCESS_RANK_REGULAR_USER);
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue