Skip to content

Commit

Permalink
doctrine#881 doctrine#882 removed reliance on internal property defau…
Browse files Browse the repository at this point in the history
…lts exposed via public API
  • Loading branch information
Ocramius committed Jan 10, 2020
1 parent ec63837 commit 7eeb0a1
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/Doctrine/Common/Proxy/ProxyGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ class <proxyShortClassName> extends \<className> implements \<baseProxyInterface
public static $lazyPropertiesNames = <lazyPropertiesNames>;
/**
* @var array default values of properties to be lazy loaded, with keys being the property names
* @var array<string, mixed> default values of properties to be lazy loaded, with keys being the property names
*
* @see \Doctrine\Common\Proxy\Proxy::__getLazyProperties
*/
public static $lazyProperties = [<lazyPropertiesDefaults>];
public static $lazyPropertiesDefaults = <lazyPropertiesDefaults>;
<additionalProperties>
Expand Down Expand Up @@ -177,11 +177,12 @@ public function __getCloner()
/**
* {@inheritDoc}
* @internal generated method: use only when explicitly handling proxy specific loading logic
* @deprecated no longer in use - generated code now relies on internal components rather than generated public API
* @static
*/
public function __getLazyProperties()
{
return self::$lazyProperties;
return self::$lazyPropertiesDefaults;
}
<methods>
Expand Down Expand Up @@ -383,14 +384,7 @@ private function generateLazyPropertiesNames(ClassMetadata $class)
*/
private function generateLazyPropertiesDefaults(ClassMetadata $class)
{
$lazyPublicPropertiesDefaultValues = $this->getLazyLoadedPublicProperties($class);
$values = [];

foreach ($lazyPublicPropertiesDefaultValues as $key => $value) {
$values[] = var_export($key, true) . ' => ' . var_export($value, true);
}

return implode(', ', $values);
return var_export($this->getLazyLoadedPublicProperties($class), true);
}

/**
Expand Down Expand Up @@ -710,7 +704,7 @@ public function __wakeup()
\$existingProperties = get_object_vars(\$proxy);
foreach (\$proxy->__getLazyProperties() as \$property => \$defaultValue) {
foreach (\$proxy::\$lazyPropertiesDefaults as \$property => \$defaultValue) {
if ( ! array_key_exists(\$property, \$existingProperties)) {
\$proxy->\$property = \$defaultValue;
}
Expand Down

0 comments on commit 7eeb0a1

Please sign in to comment.