愚蠢的问题,但我无法找到答案。
我需要执行这样的查询:
# Disable Code Coverage for Pods projects except MyPod
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
if target.name == 'MyPod'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'YES'
end
else
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO'
end
end
end
end
或通过hibernate.jdbc.batch_size=50
$em
->createQueryBuilder()
->update('AppBundle:Contest\Member', 'm')
->innerJoin('m.votes', 'v')
->set('m.total_votes', 'COUNT(v.id)')
->where('m.id = :member')
->setParameter('member', $member->id())
->getQuery()
->execute()
;
Doctrine断然拒绝执行查询。
我做错了什么?
答案 0 :(得分:0)
我找到了解决方案
$total = $em
->getRepository('AppBundle:Contest\Member\Vote')
->createQueryBuilder('v')
->select('COUNT(v.id)')
->where('v.member = :member')
->setParameter('member', $member->getId())
->getDQL()
;
$em->createQueryBuilder()
->update('AppBundle:Contest\Member', 'm')
->set('m.total_votes', '('.$total.')')
->where('m.id = :member')
->setParameter('member', $member->getId())
->getQuery()
->execute()
;