how can i fix this?
<?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;
}
}
When i’m trying to: $em->getRepository("entity\Debt")->findAll() i’m getting this error:
Warning: require(C:\Windows\TEMP__CG__entitypeople.php): failed to open stream: No such file or directory in C:\xampp\htdocs\skola\vendor\doctrine\orm\lib\Doctrine\ORM\Proxy\ProxyFactory.php on line 92
Fatal error: require(): Failed opening required ‘C:\Windows\TEMP__CG__entitypeople.php’ (include_path=’.;C:\xampp\php\pear;C:\pear;\xampp\php\PEAR’) in C:\xampp\htdocs\skola\vendor\doctrine\orm\lib\Doctrine\ORM\Proxy\ProxyFactory.php on line 92
also when i delete this part it works:
/**
* @ManyToOne(targetEntity="people", inversedBy="debts")
* */
protected $who;
You need setup the proxy directory in Doctrine
That directory is used to write the doctrine’s proxies and of course need to have write rights
http://docs.doctrine-project.org/en/2.0.x/reference/configuration.html#proxy-directory-required