我是 Doctrine ORM 或任何 ORM 的新手
$em = Zend_Registry::getInstance ()->entitymanager;
$p = $em->createQuery ( "
SELECT u
FROM Teon_Model_User u
WHERE u.app_auth IN (:app_auth)" );
$p->setParameter ( 'app_auth', $app_auth );
$array = $p->getArrayResult();
$customer_id = $array[0]['customer_id'];
$p = $em->createQuery ( "
SELECT p
FROM Teon_Model_Purchase p
WHERE p.customer IN (:customer_id)" );
$p->setParameter ( 'customer_id', $customer_id );
$array = $p->getArrayResult();
$purchase_id = $array[0]['id'];
$p = $em->createQuery ( "
SELECT pm
FROM Teon_Model_PurchaseManual pm
WHERE pm.purchase_id IN (:purchase_id)" );
$p->setParameter ( 'purchase_id', $purchase_id );
$array = $p->getArrayResult();
$m_id = $array[0]['manual_id'];
你能简化这个查询吗,它看起来很愚蠢,我在 zend 框架中使用 Doctrine
这个查询是通过提供一个验证码来验证用户是否在他的购买中有manual_id..