public function insert($entity)
{
$querySet = new QuerySet();
$qb = $this->em->createQueryBuilder();
$qb->insert($this->getTableName());
$querySet->append($qb);
$this->persist($querySet, $entity, ['id']);
$result = $querySet->execute();
// Try and set the entity id using the response from the insert
try {
$entity->setId($querySet->getInsertId());
} catch (\Exception $e) {
}
return $result;
}