1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

[2.0] Fixing coding standards of generated proxies

This commit is contained in:
jwage 2010-03-18 21:30:09 +00:00
parent af65410ada
commit 119c4eca57

View file

@ -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.");
}