Fixed entity IDs being strings

This coincidentally fixes editing newly added comments.
This commit is contained in:
Marcin Kurczewski 2014-11-21 22:32:10 +01:00
parent 2b0a4d1f76
commit 4b4ccf365a
7 changed files with 7 additions and 7 deletions

View file

@ -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;

View file

@ -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']);

View file

@ -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']));

View file

@ -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;

View file

@ -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']));

View file

@ -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']);

View file

@ -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']));