Commit 119c4eca authored by jwage's avatar jwage

[2.0] Fixing coding standards of generated proxies

parent af65410a
...@@ -197,7 +197,8 @@ class ProxyFactory ...@@ -197,7 +197,8 @@ class ProxyFactory
} }
} }
$methods .= $parameterString . ') {' . PHP_EOL; $methods .= $parameterString . ')';
$methods .= PHP_EOL . ' {' . PHP_EOL;
$methods .= ' $this->_load();' . PHP_EOL; $methods .= ' $this->_load();' . PHP_EOL;
$methods .= ' return parent::' . $method->getName() . '(' . $argumentString . ');'; $methods .= ' return parent::' . $method->getName() . '(' . $argumentString . ');';
$methods .= PHP_EOL . ' }' . PHP_EOL; $methods .= PHP_EOL . ' }' . PHP_EOL;
...@@ -242,19 +243,23 @@ class ProxyFactory ...@@ -242,19 +243,23 @@ class ProxyFactory
/** Reference Proxy class code template */ /** Reference Proxy class code template */
private static $_proxyClassTemplate = private static $_proxyClassTemplate =
'<?php '<?php
namespace <namespace> { namespace <namespace>
{
/** /**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE. * THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/ */
class <proxyClassName> extends \<className> implements \Doctrine\ORM\Proxy\Proxy { class <proxyClassName> extends \<className> implements \Doctrine\ORM\Proxy\Proxy
{
private $_entityPersister; private $_entityPersister;
private $_identifier; private $_identifier;
public $__isInitialized__ = false; public $__isInitialized__ = false;
public function __construct($entityPersister, $identifier) { public function __construct($entityPersister, $identifier)
{
$this->_entityPersister = $entityPersister; $this->_entityPersister = $entityPersister;
$this->_identifier = $identifier; $this->_identifier = $identifier;
} }
private function _load() { private function _load()
{
if (!$this->__isInitialized__ && $this->_entityPersister) { if (!$this->__isInitialized__ && $this->_entityPersister) {
$this->__isInitialized__ = true; $this->__isInitialized__ = true;
if ($this->_entityPersister->load($this->_identifier, $this) === null) { if ($this->_entityPersister->load($this->_identifier, $this) === null) {
...@@ -267,7 +272,8 @@ namespace <namespace> { ...@@ -267,7 +272,8 @@ namespace <namespace> {
<methods> <methods>
public function __sleep() { public function __sleep()
{
if (!$this->__isInitialized__) { if (!$this->__isInitialized__) {
throw new \RuntimeException("Not fully loaded proxy can not be serialized."); throw new \RuntimeException("Not fully loaded proxy can not be serialized.");
} }
......
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