我有以下关系表:
我的目标是检索表[resident]中的所有居民。以下是我的代码:
public function getAllResidents(){
$all_resident = $this->resident_repo->getAll(); //!!error thrown from here!!
}
public function getAll(){
return $this->findAll();
}
我收到的错误消息是:
A PHP Error was encountered
Severity: Warning
Message:
require(/Applications/MAMP/htdocs/Final_Project/a18ux06/application/models/Proxies/__CG__EntityDoctor.php):
failed to open stream: No such file or directory
Filename: Proxy/AbstractProxyFactory.php
Line Number: 209
Backtrace:
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php
Line: 209 Function: _error_handler
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php
Line: 209 Function: require
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php
Line: 119 Function: getProxyDefinition
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php
Line: 2707 Function: getProxy
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php
Line: 147 Function: createEntity
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php
Line: 69 Function: hydrateRowData
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/orm/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
Line: 150 Function: hydrateAllData
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php
Line: 888 Function: hydrateAll
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php
Line: 181 Function: loadAll
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php
Line: 164 Function: findBy
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/application/models/Repository/ResidentRepository.php
Line: 13 Function: findAll
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/application/controllers/ModelTest.php
Line: 69 Function: getAllResident
File:
/Applications/MAMP/htdocs/Final_Project/a18ux06/application/controllers/ModelTest.php
Line: 21 Function: getAllResidents
File: /Applications/MAMP/htdocs/Final_Project/a18ux06/index.php Line:
315 Function: require_once
Fatal error: require(): Failed opening required
'/Applications/MAMP/htdocs/Final_Project/a18ux06/application/models/Proxies/__CG__EntityDoctor.php'
(include_path='.:/Applications/MAMP/bin/php/php7.2.8/lib/php') in
/Applications/MAMP/htdocs/Final_Project/a18ux06/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php
on line 209 A PHP Error was encountered
Severity: Compile Error
Message: require(): Failed opening required
'/Applications/MAMP/htdocs/Final_Project/a18ux06/application/models/Proxies/__CG__EntityDoctor.php'
(include_path='.:/Applications/MAMP/bin/php/php7.2.8/lib/php')
Filename: Proxy/AbstractProxyFactory.php
Line Number: 209
Backtrace:
我不知道问题出在哪里-我刚开始学习教义。是因为我的[resident]表有[2多对一]关系,也就是[2 inversedby]表[building and doctor]的关系吗?
我已经被困在这里一整天了!一个快速的帮助或者一个我能做的参考会很有帮助。如果需要额外的东西,请告诉我。
1条答案
按热度按时间oalqel3c1#
似乎doctrin的默认查询函数在它们所能做的事情上是有限的。因此,我不得不编写自己的自定义低级sql查询,而不是尝试使用
find
,find_by
等等。。。违反了原则。我曾经去过的一些地方
QueryBuilder
有些地方是普通的sql查询。