Doctrine2 seems to be adding magic to its Proxy object for lazy loading. It's making my results incorrect, and I can't figure out what is causing it.
Here is my class model:
Class "RedProduct" inherits from abstract class "Product", which implements interface "BaseProduct"
abstract class Product holds the primary key:
abstract class Product implements BaseProduct {
/** @Id @Column (type="integer", name="ID") @GeneratedValue */
protected $id;
public function getId() {
return $this->id;
}
}
I want RedProduct to prepend the letter 'R' to the id before returning it.
class RedProduct extends Product {
public function getId() {
return 'R' . $this->id;
}
}
But in the proxy class, the getId() method (and ONLY the getId() method) has been modified to this:
public function getId()
{
if ($this->__isInitialized__ === false) {
return $this->_identifier["id"];
}
$this->__load();
return parent::getId();
}