Fixed entity IDs being strings
This coincidentally fixes editing newly added comments.
This commit is contained in:
parent
2b0a4d1f76
commit
4b4ccf365a
7 changed files with 7 additions and 7 deletions
|
@ -137,7 +137,7 @@ abstract class AbstractDao implements ICrudDao, IBatchDao
|
|||
$query->execute();
|
||||
$lastUsedId = $this->pdo->query('SELECT @lastUsedId')->fetchColumn();
|
||||
|
||||
$entity->setId($lastUsedId);
|
||||
$entity->setId(intval($lastUsedId));
|
||||
$arrayEntity = $this->entityConverter->toArray($entity);
|
||||
$this->pdo->insertInto($this->tableName)->values($arrayEntity)->execute();
|
||||
return $entity;
|
||||
|
|
|
@ -19,7 +19,7 @@ class CommentEntityConverter extends AbstractEntityConverter implements IEntityC
|
|||
|
||||
public function toBasicEntity(array $array)
|
||||
{
|
||||
$entity = new Comment($array['id']);
|
||||
$entity = new Comment(intval($array['id']));
|
||||
$entity->setUserId($array['userId']);
|
||||
$entity->setPostId($array['postId']);
|
||||
$entity->setText($array['text']);
|
||||
|
|
|
@ -17,7 +17,7 @@ class FavoriteEntityConverter extends AbstractEntityConverter implements IEntity
|
|||
|
||||
public function toBasicEntity(array $array)
|
||||
{
|
||||
$entity = new Favorite($array['id']);
|
||||
$entity = new Favorite(intval($array['id']));
|
||||
$entity->setUserId($array['userId']);
|
||||
$entity->setPostId($array['postId']);
|
||||
$entity->setTime($this->dbTimeToEntityTime($array['time']));
|
||||
|
|
|
@ -16,7 +16,7 @@ class GlobalParamEntityConverter extends AbstractEntityConverter implements IEnt
|
|||
|
||||
public function toBasicEntity(array $array)
|
||||
{
|
||||
$entity = new GlobalParam($array['id']);
|
||||
$entity = new GlobalParam(intval($array['id']));
|
||||
$entity->setKey($array['dataKey']);
|
||||
$entity->setValue($array['dataValue']);
|
||||
return $entity;
|
||||
|
|
|
@ -20,7 +20,7 @@ class PostNoteEntityConverter extends AbstractEntityConverter implements IEntity
|
|||
|
||||
public function toBasicEntity(array $array)
|
||||
{
|
||||
$entity = new PostNote($array['id']);
|
||||
$entity = new PostNote(intval($array['id']));
|
||||
$entity->setPostId($array['postId']);
|
||||
$entity->setLeft(floatval($array['x']));
|
||||
$entity->setTop(floatval($array['y']));
|
||||
|
|
|
@ -19,7 +19,7 @@ class ScoreEntityConverter extends AbstractEntityConverter implements IEntityCon
|
|||
|
||||
public function toBasicEntity(array $array)
|
||||
{
|
||||
$entity = new Score($array['id']);
|
||||
$entity = new Score(intval($array['id']));
|
||||
$entity->setUserId($array['userId']);
|
||||
$entity->setPostId($array['postId']);
|
||||
$entity->setCommentId($array['commentId']);
|
||||
|
|
|
@ -18,7 +18,7 @@ class TagEntityConverter extends AbstractEntityConverter implements IEntityConve
|
|||
|
||||
public function toBasicEntity(array $array)
|
||||
{
|
||||
$entity = new Tag($array['id']);
|
||||
$entity = new Tag(intval($array['id']));
|
||||
$entity->setName($array['name']);
|
||||
$entity->setCreationTime($this->dbTimeToEntityTime($array['creationTime']));
|
||||
$entity->setMeta(Tag::META_USAGES, intval($array['usages']));
|
||||
|
|
Loading…
Reference in a new issue