我怎样才能在教义中生成这个查询?
How can I generate this query in doctrine?
如何在原则或查询生成器中生成此查询?
SELECT EndDate from helios.fsa_audits order by StartDate desc limit 1;
关于如何制作它有任何想法或建议吗?
看到你的实体 ,在你的控制器中你可以试试这个:
$em = $this->getDoctrine()->getManager();
$qb = $em->createQueryBuilder()
->select(array('a'))
->from(FsaAudits::class, 'a')
->orderBy("a.StartDate","DESC")
->setMaxResults(1);
$resultset = $qb->getQuery()->getResult();
if (count($resultset) <= 0) {
$fsaobj = $resultset[0];
echo $fsaobj->getEndDate();
}
如何在原则或查询生成器中生成此查询?
SELECT EndDate from helios.fsa_audits order by StartDate desc limit 1;
关于如何制作它有任何想法或建议吗?
看到你的实体
$em = $this->getDoctrine()->getManager();
$qb = $em->createQueryBuilder()
->select(array('a'))
->from(FsaAudits::class, 'a')
->orderBy("a.StartDate","DESC")
->setMaxResults(1);
$resultset = $qb->getQuery()->getResult();
if (count($resultset) <= 0) {
$fsaobj = $resultset[0];
echo $fsaobj->getEndDate();
}