From 34752529b54d822a4bb7af5be33bd8c514df87af Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Thu, 18 Sep 2014 19:30:36 +0200 Subject: [PATCH] Fixed saving tags under certain circumstances --- src/Dao/PostDao.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Dao/PostDao.php b/src/Dao/PostDao.php index f2597213..1d5a73fa 100644 --- a/src/Dao/PostDao.php +++ b/src/Dao/PostDao.php @@ -46,7 +46,12 @@ class PostDao extends AbstractDao implements ICrudDao private function syncTags($postId, array $tags) { - $existingTags = iterator_to_array($this->fpdo->from('postTags')->where('postId', $postId)); + $existingTags = array_map( + function($arrayEntity) + { + return $arrayEntity['tagName']; + }, + iterator_to_array($this->fpdo->from('postTags')->where('postId', $postId))); $tagRelationsToInsert = array_diff($tags, $existingTags); $tagRelationsToDelete = array_diff($existingTags, $tags); $this->createMissingTags($tags);