To perform a raw mysql statement in symfony through Doctrine:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$sql = ‘SELECT c.CampaignId as campaignId, c.ProfileId as profileId, p.Name as name FROM Profile.ProfileCampaign c INNER JOIN Profile.Profile p ON p.ProfileId = c.ProfileId WHERE c.CampaignId IN (:campaignIdList) AND p.Deleted = 0 AND p.Active = 1′; $stmt = $this->getDoctrine() ->getManager() ->getConnection() ->prepare($sql); $stmt->bindValue(‘campaignIdList’, implode(“,”, $campaignIdList)); $stmt->execute(); |
This example was being used in a controller.
Leave a Reply