I have a field reply_level in a reply table.
protected function buildDomainObject(array $row)
{
$reply = new Reply();
$reply->setId($row['reply_id']);
$reply->setAuthor($row['reply_author']);
$reply->setContent($row['reply_content']);
$reply->setComParent($row['com_id']);
$reply->setLevel($row['reply_level']);
if (array_key_exists('art_id', $row))
{
$commentaireId = $row['art_id'];
$article = $this->articleDAO->find($commentaireId);
$reply->setArticle($article);
}
return $reply;
}
public function save(Reply $reply) {
$commentData = array(
'reply_content' => $reply->getContent(),
'reply_author' => $reply->getAuthor(),
'com_id' => $reply->getComParent(),
'art_id' => $reply->getArticle()->getId(),
'reply_level' => $reply->getLevel()
);
if ($reply->getId()) {
// update comment
$this->getDb()->update('t_reply', $commentData, array('reply_id' => $reply->getId()));
} else {
// The comment has never been saved : insert it
$this->getDb()->insert('t_reply', $commentData);
// Get the id of the newly created comment and set it on the entity.
$id = $this->getDb()->lastInsertId();
$reply->setId($id);
}
}
I would like to pass several values to reply_level, either reply_level, reply_level1, reply _level2, reply_level3 ...(Depending on the level of the sub-comment). How to pass multiple values ? i use pdo mysql.
Thank you