Prepared query using IN condition with sql in a doctrine repository
Nov 6, 2021 Symfony
$inputIds = [1,2,3];$conn = $this->_em->getConnection(); $in = str_repeat('?,', count($
inputIds) - 1) . '?';//generate parameters $sql = "select * from my_table where id IN ($in)"; $stmt = $conn->prepare($sql); $res = $stmt->executeQuery($
inputIds); return $res->fetchAllAssociative();
symfony
security
sql
short
Categories
Recent posts
Create a custom attribute/annotation and understand @security annotation behind the scene [Symfony]
Create a ssl certificate using let's encrypt [System]
Usual Makefile commands on symfony project [Symfony]
Symfony create a custom logger file and understand behind the scene [Symfony]
Démarrer un nouveau projet symfony 6 comme un sénior sous docker [Symfony]