Symfony2, Doctrine, update db entry without queryBuilder
database, doctrine, symfony
Solution
Simple way to do, Fusselchen said right, just show an example
// get entity manager
$em = $this->getDoctrine()->getEntityManager();
// get from this entity manager our "entity" \ object in $item
// also we can get arrayCollection and then do all in foreach loop
$item = $em->getRepository('repoName')->findOneBy($filter);
// change "entity" / object values we want to edit
$item->setSome('someText')
//...
// call to flush that entity manager from which we create $item
$em->flush();
// after that in db column 'some' will have value 'someText'
// btw after call flush we can still use $item as 'selected object' in
// another $em calls and it will have actual (some = 'someText') values
Problem
To save entry to db we can use: ``` $em->persist($entity); $em->flush(); ``` But how can we update existing entry without using `$this->getEntityManager()->createQuery()` ? Can we? I'm searching some kind of `$em->update()` for existing entry in db.