如何检查我的数据库以查看列的值是否被多次刷新?

The Symfony2 Documentation doesn’t seem to address this problem the ‘symfony way’. As in I want to find a solution using Doctrine to query the field.

I want to write code to say… if (value is being added into database and the value already exists) then simply add ‘1’ to the ‘quantity’ field.

Doctrine doesn't have a built in way for doing this as it seems like it's custom logic, I'd do something like this

$item = // .. Get Item From Repository
$newQuantity = 10;

if ($item->getQuantity() === $newQuantity) {
    $item->setQuantity($item->getQuantity() + 1);
} else {
    $item->setQuantity($newQuantity);
}

$entityManager->flush();
$inputData = x; // your input data

$em = $this->getDoctrine()->getManager();
$entity = newYourEntityName();

$entity = $em->getRepository('corresponding entity)->findOneBy($inputData);

if( !empty($entity) )
{
 $entity->setwhateveritis($entity->setwhateveritis++);
}
else
{
 $entity->setwhateveritis($inputData);
}
$em->persist($entity);
$em->flush();