I have a strange Doctrine behaviour. Classes:
/**
* @Entity
* @Cache
*/
class UserInfo {
/**
* @Id
* @Column
*/
protected $id;
/**
* @Cache
* @OneToOne
*/
protected $extra;
public function getExtra(){
return $this->extra;
}
}
/*!! Without @Cache ANNOTATION on ExtraUserInfo !!*/
/**
* @Entity
*/
class ExtraUserInfo {
/**
* @Id
* @OnToOne
*/
protected $info;
/**
* @Column
*/
protected $extra;
}
Doctrine causes a fatal error when i do:
$userinf->getExtra();
Fatal error: Call to undefined method Doctrine\ORM\Persisters\BasicEntityPersister::getCacheRegion() in /lib/Doctrine/ORM/Cache/DefaultEntityHydrator.php on line 137
This happens because $assocPersister
is instance of BasicEntityPersister.
It is a Doctrine bug, or i have to specify @Cache
on all entities?
It was fixed here https://github.com/doctrine/doctrine2/commit/7e5a1c6b0d928a63626fea961dd4cecb74ab01de. So, the problem does not exists any-more.