我收到此错误
D:\Projects\Tickle\tests>phpunit
PHPUnit 3.5.5 by Sebastian Bergmann.
..........ok1
Fatal error: Doctrine\Common\ClassLoader::loadClass(): Failed opening required 'D:\Projects\Tickle\Application\Models\Ap
plication\Models\User.php' (include_path='D:\Projects\Tickle\application/../library;D:\Projects\Tickle\application;D:\Pr
ojects\Tickle\library;D:\ResourceLibrary\Frameworks\PHPFrameworks;C:\Program Files (x86)\PHP\pear;.;c:\php\includes') in
D:\ResourceLibrary\Frameworks\PHPFrameworks\Doctrine\Common\ClassLoader.php on line 148
请注意D:\Projects\Tickle\Application\Models\Application\Models\User.php
的重复“Application\Models
”。在一些echo
语句
protected function isAllowed($userId, $taskId, $privilege) {
$user = $this->em->find('Application\Models\User', $userId);
echo 'ok1'; // this gets printed
$task = $this->em->find('Application\Models\Task', $taskId); // this seem to be the cause of the problem
echo 'ok2'; // this doesn't get printed
return $this->acl->isAllowed($user, $task, $privilege);
}
完整的课程http://pastebin.com/rJungFvP
所以我尝试在Tasks类中查找使用User的东西......唯一可以使用User类的东西是
/**
* @ManyToOne(targetEntity="User", inversedBy="ownedTasks")
*/
protected $owner;
/**
* @ManyToOne(targetEntity="User", inversedBy="assignedTasks")
*/
protected $assigned;
除此之外,我没有看到任何用户的使用。全班http://pastebin.com/wDPXUPSV。
我做错了什么?
答案 0 :(得分:0)
问题实际上是在TodoList
课程中找到的...我有类似
public function setProject(Application\Models\Project $project) {
...
}
当我应该使用像
这样的东西时public function setProject(Project $project) {
$this->project = $project;
}
代替