我該如何解決這個問題?無法讓ManyToOne工作
<?php
namespace entity;
/**
* @Entity @Table(name="debt")
* */
class Debt {
/**
* @Id @Column(type="integer") @GeneratedValue
* */
protected $id;
/**
* @Column(type="integer")
* */
protected $value;
/**
* @ManyToOne(targetEntity="people", inversedBy="debts")
* */
protected $who;
public function setValue($value) {
$this->value = $value;
}
public function setWho(Who $who) {
$this->who = $who;
}
public function getValue() {
return $this->value;
}
public function getWho() {
return $this->who;
}
}
<?php
namespace entity;
/**
* @Entity @Table(name="people")
* */
class People {
/**
* @Id @Column(type="integer") @GeneratedValue
* */
protected $id;
/**
* @Column(type="string")
* */
protected $name;
/**
* @OneToMany(targetEntity="debt", mappedBy="who")
* */
protected $debts;
public function setName($name) {
$this->name = $name;
}
public function assignDebt(Debt $debt) {
$this->debts[] = $debt;
}
public function getName() {
return $this->name;
}
public function getDebts() {
return $this->debts;
}
}
當我想:$em->getRepository("entity\Debt")->findAll()
我得到這個錯誤:
警告:要求(C:\ WINDOWS \ TEMP__CG__entitypeople.php):未能打開流:沒有這樣的文件或目錄第92行中的C:\ xampp \ htdocs \ skola \ vendor \ doctrine \ orm \ lib \ Doctrine \ ORM \ Proxy \ ProxyFactory.php
致命錯誤:require():Failed opening required'C:\ Windows \ TEMP__CG__entitypeople.php'(include_path ='.; C:\ xampp \ php \ pear; C:\ pear; \ xampp \ php \ PEAR')在C:\ xampp \ htdocs \ skola \ vendor \ doctrine \ orm \ lib \ Doctrine \ ORM \ Proxy \ ProxyFactory.php在線92
還當我刪除這部分工作原理:
/**
* @ManyToOne(targetEntity="people", inversedBy="debts")
* */
protected $who;