开发者

Doctrine 2 - Get all Records

开发者 https://www.devze.com 2023-04-01 11:46 出处:网络
Does anyone know is there is a quick way to get all the records in 开发者_如何学Ca table using Doctrine with out using the DQL.

Does anyone know is there is a quick way to get all the records in 开发者_如何学Ca table using Doctrine with out using the DQL.

Did I miss something or did you need to just write the public function in the class?


If you have an entity class (Doctrine Repository manual):

$records = $em->getRepository("Entities\YourTargetEntity")->findAll();

If you don't have entity class (PDO manual):

$pdo = $em->getCurrentConnection()->getDbh();
$result = $pdo->query("select * from table"); //plain sql query here, it's just PDO
$records = $pdo->fetchAll();
0

精彩评论

暂无评论...
验证码 换一张
取 消