I'm building something with Silex and Doctrine DBAL using a Mysql database.
I was wondering if it considered best practice to close the cursor of a statement and database connection after one's done it. For example:
$sql = '
SELECT
`id`, `userid`, `name`, `content`
FROM
`pages` p
WHERE
p.`userid` in (?)';
$stmt = $conn->executeQuery(
$sql,
[$userIds],
[\Doctrine\DBAL\Connection::PARAM_INT_ARRAY]
);
$rows = $stmt->fetchAll();
$stmt->closeCursor();
$conn->close();
I can't find any examples of this. Both the Silex and Doctrine doc's don't use the statements but they're there for a reason right?