I am trying to update a column value using symfony query builder. The issue is I dont want the old value to be overwritten, i want to concat the new value with old value with a comma seperation, like below
id fruits
------------------
1 orange,apple
here is my query which is just update the old value, fruits column is of type longtext
public function updateById($id,$fruit) {
return $this->createQueryBuilder('c')
->update()
->set('c.fruits', ':fruits')
->where('c.id LIKE :id')
->setParameter('id', $id)
->setParameter('fruits', $fruit)
->getQuery()
->getArrayResult();
}