I have a Symfony2 CLI script running which should update a timestamp each 3 seconds.
The problem is: $this->em->persist($processInfo)
creates a new entry in the DB each time it is executed. I want it to UPDATE, not to CREATE on each cycle.
$processInfo = new ....ProcessInfo();
while(true){
$someObject = new ..();
$this->em()->persist($someObject);
$this->em()->clear(); // sorry forgot this line in my initial question
$processInfo->setLastCheckOn($now); // to know if the script is still running, we set a timestamp in the db
$this->em()->persist($processInfo);
$this->em()->flush();
sleep(3);
}
any ideas?