0

大家好,我遇到了一个 Doctrine 连接查询。

系统继续告诉我拍卖未映射:

Class Auction does not exist and could not be loaded in Doctrine/doctrine-orm/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php on line 40

显然,该项目已经开始,并且成功使用了其他连接。

include_once '../../../bootstrap_doctrine.php';

$rsm = new \Doctrine\ORM\Query\ResultSetMapping;
$rsm->addEntityResult('Auction', 'Au');
$rsm->addEntityResult('VariantPerAuction', 'Vpa');

$Q=" SELECT Au.id
FROM Auction Au
JOIN VariantPerAuction Vpa ";
        $query = $entityManager->createNativeQuery($Q,$rsm);

$auctions = $query->getResult();
4

1 回答 1

1

感谢 Marco Pivetta,它现在似乎可以工作了。

问题似乎是 Doctrine2 Class 没有完全命名空间。

对它们进行完全命名空间的快速试验是有效的。

在每个类的顶部:

// put the folder where your class is
 namespace DbClasses\entities;

新的加入查询变为:

$rsm = new \Doctrine\ORM\Query\ResultSetMapping;
$rsm->addEntityResult('DbClasses\entities\Auction', 'Au');
$rsm->addEntityResult('DbClasses\entities\VariantPerAuction', 'Vpa');

$Q=" SELECT Au.id
FROM Auction Au
JOIN VariantPerAuction Vpa 
Where Au.piattaforma='EbayDE' AND Au.OggettoEbayDBContainer_id=159";

$auctions = $query->getResult();
于 2012-09-12T07:57:29.557 回答