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
Categories
Recent posts
Oder by nulls last in doctrine [Symfony]
Switch between php7.4 and php 8.2 on macos [mac os]
Dump all variables present on a twig template [Symfony]
Dynamically update session duration [Symfony]