Commit 86c12a07 authored by romanb's avatar romanb

[2.0] Fixed proxy classes to not invoke parent class constructors. We never...

[2.0] Fixed proxy classes to not invoke parent class constructors. We never call constructors to reconstitute persistent entities and proxies always represent persistent entities.
parent 962ecab7
...@@ -121,19 +121,16 @@ class ProxyFactory ...@@ -121,19 +121,16 @@ class ProxyFactory
* @param $originalClassName * @param $originalClassName
* @param $proxyClassName * @param $proxyClassName
* @param $file The path of the file to write to. * @param $file The path of the file to write to.
* @return void
*/ */
private function _generateProxyClass($class, $proxyClassName, $fileName, $file) private function _generateProxyClass($class, $proxyClassName, $fileName, $file)
{ {
$methods = $this->_generateMethods($class); $methods = $this->_generateMethods($class);
$sleepImpl = $this->_generateSleep($class); $sleepImpl = $this->_generateSleep($class);
$constructorInv = $class->reflClass->hasMethod('__construct') ? 'parent::__construct();' : '';
$placeholders = array( $placeholders = array(
'<namespace>', '<namespace>',
'<proxyClassName>', '<className>', '<proxyClassName>', '<className>',
'<methods>', '<sleepImpl>', '<methods>', '<sleepImpl>'
'<constructorInvocation>'
); );
if(substr($class->name, 0, 1) == "\\") { if(substr($class->name, 0, 1) == "\\") {
...@@ -145,8 +142,7 @@ class ProxyFactory ...@@ -145,8 +142,7 @@ class ProxyFactory
$replacements = array( $replacements = array(
$this->_proxyNamespace, $this->_proxyNamespace,
$proxyClassName, $className, $proxyClassName, $className,
$methods, $sleepImpl, $methods, $sleepImpl
$constructorInv
); );
$file = str_replace($placeholders, $replacements, $file); $file = str_replace($placeholders, $replacements, $file);
...@@ -258,7 +254,6 @@ namespace <namespace> { ...@@ -258,7 +254,6 @@ namespace <namespace> {
public function __construct($entityPersister, $identifier) { public function __construct($entityPersister, $identifier) {
$this->_entityPersister = $entityPersister; $this->_entityPersister = $entityPersister;
$this->_identifier = $identifier; $this->_identifier = $identifier;
<constructorInvocation>
} }
private function _load() { private function _load() {
if (!$this->__isInitialized__) { if (!$this->__isInitialized__) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment