ORMを使うパターン
use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\ORM\Query\ResultSetMappingBuilder; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Tools\Setup; //とりあえず、たくさんインポート 中略 $em = $this->getDoctrine()->getEntityManager(); $rsm = new ResultSetMapping(); $rsm->addEntityResult('Acme\HelloBundle\Entity\Post', 'p'); $rsm->addFieldResult('p', 'id', 'id'); //第2引数がDBカラム名、第3引数がエンティティーのフィールド名 $rsm->addFieldResult('p', 'name', 'name'); $query = $em->createNativeQuery('SELECT id, name FROM Post WHERE id = ?', $rsm); $query->setParameter(1, 123); $resulet = $query->getArrayResult();//getArrayResult()は配列で取得 //getResult() もあるがなんだかよくわからない。
ORMを使わないパターン
$stmt = $this->getDoctrine()->getEntityManager()->getConnection()->prepare('select * from mimicry_ranking'); $stmt->execute(); $result = $stmt->fetchAll();//どうやってバインドするかは不明 //まあでもいい感じ結果取得できてます。
参考URL
docs.doctrine-project.org
29 Pockets

Four o four - Doctrine - PHP Database Tools
The Doctrine Project is the home to several PHP libraries primarily focused on database storage and object mapping. The core projects are the Object Relational Mapper (ORM) and the Database Abstraction Layer (DBAL) it is built upon.
blog.xfloyd.net
1 User
4 Pockets
Executing SQL directly in Symfony2 Doctrine | Blog – Internet Business Soluti...
docs.symfony.gr.jp
1 User
3 Pockets
Doctrine の DBAL レイヤーの使用方法 | Symfony2日本語ドキュメント
docs.symfony.gr.jp
データベースと Doctrine (“The Model”) | Symfony2日本語ドキュメント