This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Dao/EntityConverters/PostScoreEntityConverter.php

28 lines
696 B
PHP
Raw Normal View History

2014-09-28 15:21:25 +02:00
<?php
namespace Szurubooru\Dao\EntityConverters;
class PostScoreEntityConverter extends AbstractEntityConverter implements IEntityConverter
{
public function toArray(\Szurubooru\Entities\Entity $entity)
{
return
[
'id' => $entity->getId(),
'userId' => $entity->getUserId(),
'postId' => $entity->getPostId(),
'time' => $entity->getTime(),
'score' => $entity->getScore(),
];
}
public function toBasicEntity(array $array)
{
$entity = new \Szurubooru\Entities\PostScore($array['id']);
$entity->setUserId($array['userId']);
$entity->setPostId($array['postId']);
$entity->setTime($array['time']);
$entity->setScore(intval($array['score']));
return $entity;
}
}