select('*,b.name as block_name,b.id as block_id, GROUP_CONCAT(b.content ORDER BY b.position ASC SEPARATOR "") as content') ->from('pages', 'p') ->leftJoin('p', 'blocks', 'b', 'b.id_root = p.id_block') ->andWhere(Operator::equals(['type' => FragmentPage::getType()])) ->groupBy('p.id'); if ($code) { $qb->andWhere(Operator::equals(['p.code' => $code])); } if ($id) { $qb->andWhere(Operator::equals(['p.id' => $id])); } if (!($fragment = $qb->execute()->fetchAssociative())) { throw new GraphQLNotFoundException('Fragment not found'); } return new Fragment($fragment); } }