for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dtc\QueueBundle\ODM;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ODM\MongoDB\DocumentManager;
trait CommonTrait
{
/**
* @param ObjectManager $objectManager
* @param string $objectName
* @param string $field
* @param \DateTime $olderThan
*
* @return int
*/
protected function removeOlderThan(ObjectManager $objectManager, $objectName, $field, \DateTime $olderThan)
/** @var DocumentManager $objectManager */
$qb = $objectManager->createQueryBuilder($objectName);
$qb
->remove()
->field($field)->lt($olderThan);
$query = $qb->getQuery();
$result = $query->execute();
if (isset($result['n'])) {
return $result['n'];
}
return 0;
public function stopIdGenerator($objectName)
$objectName
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
// Not needed for ODM
public function restoreIdGenerator($objectName)
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.