[2.0] Fixing coding standards of generated proxies
This commit is contained in:
parent
af65410ada
commit
119c4eca57
1 changed files with 12 additions and 6 deletions
|
@ -197,7 +197,8 @@ class ProxyFactory
|
|||
}
|
||||
}
|
||||
|
||||
$methods .= $parameterString . ') {' . PHP_EOL;
|
||||
$methods .= $parameterString . ')';
|
||||
$methods .= PHP_EOL . ' {' . PHP_EOL;
|
||||
$methods .= ' $this->_load();' . PHP_EOL;
|
||||
$methods .= ' return parent::' . $method->getName() . '(' . $argumentString . ');';
|
||||
$methods .= PHP_EOL . ' }' . PHP_EOL;
|
||||
|
@ -242,19 +243,23 @@ class ProxyFactory
|
|||
/** Reference Proxy class code template */
|
||||
private static $_proxyClassTemplate =
|
||||
'<?php
|
||||
namespace <namespace> {
|
||||
namespace <namespace>
|
||||
{
|
||||
/**
|
||||
* 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 $_identifier;
|
||||
public $__isInitialized__ = false;
|
||||
public function __construct($entityPersister, $identifier) {
|
||||
public function __construct($entityPersister, $identifier)
|
||||
{
|
||||
$this->_entityPersister = $entityPersister;
|
||||
$this->_identifier = $identifier;
|
||||
}
|
||||
private function _load() {
|
||||
private function _load()
|
||||
{
|
||||
if (!$this->__isInitialized__ && $this->_entityPersister) {
|
||||
$this->__isInitialized__ = true;
|
||||
if ($this->_entityPersister->load($this->_identifier, $this) === null) {
|
||||
|
@ -267,7 +272,8 @@ namespace <namespace> {
|
|||
|
||||
<methods>
|
||||
|
||||
public function __sleep() {
|
||||
public function __sleep()
|
||||
{
|
||||
if (!$this->__isInitialized__) {
|
||||
throw new \RuntimeException("Not fully loaded proxy can not be serialized.");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue