this is my query for find all records in table and sort from the oldest. I want to limit one column to only 50 characters. I can't find any information how to change this query for use left clause.
$posts = $ChocoPosts->findBy(array(), array('id' => 'DESC'));
Additionally i tried use clean sql syntax for that, but it's not show any records.
$conn = $this->getDoctrine()->getManager()->getConnection();
$sql = '
SELECT id, title, left(content, 45), date_add, img
FROM choco_posts
ORDER BY id DESC
';
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->fetchAll();
I'm using symfony4 ant twig template. I display all records in twig for loop.