Fixed #DDC-578
Also added a new testcase
This commit is contained in:
parent
f9b53c6b5c
commit
f2213c4d00
@ -164,7 +164,11 @@ class ProxyFactory
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($method->isPublic() && ! $method->isFinal() && ! $method->isStatic()) {
|
if ($method->isPublic() && ! $method->isFinal() && ! $method->isStatic()) {
|
||||||
$methods .= PHP_EOL . ' public function ' . $method->getName() . '(';
|
$methods .= PHP_EOL . ' public function ';
|
||||||
|
if ($method->returnsReference()) {
|
||||||
|
$methods .= '&';
|
||||||
|
}
|
||||||
|
$methods .= $method->getName() . '(';
|
||||||
$firstParam = true;
|
$firstParam = true;
|
||||||
$parameterString = $argumentString = '';
|
$parameterString = $argumentString = '';
|
||||||
|
|
||||||
|
@ -18,5 +18,9 @@ class ForumEntry
|
|||||||
* @Column(type="string", length=50)
|
* @Column(type="string", length=50)
|
||||||
*/
|
*/
|
||||||
public $topic;
|
public $topic;
|
||||||
|
|
||||||
|
public function &getTopicByReference() {
|
||||||
|
return $this->topic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,16 @@ class ProxyClassGeneratorTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$this->assertEquals('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $params[0]->getClass()->getName());
|
$this->assertEquals('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $params[0]->getClass()->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that the proxy behaves in regard to methods like &foo() correctly
|
||||||
|
*/
|
||||||
|
public function testProxyRespectsMethodsWhichReturnValuesByReference() {
|
||||||
|
$proxy = $this->_proxyFactory->getProxy('Doctrine\Tests\Models\Forum\ForumEntry', null);
|
||||||
|
$method = new \ReflectionMethod(get_class($proxy), 'getTopicByReference');
|
||||||
|
|
||||||
|
$this->assertTrue($method->returnsReference());
|
||||||
|
}
|
||||||
|
|
||||||
public function testCreatesAssociationProxyAsSubclassOfTheOriginalOne()
|
public function testCreatesAssociationProxyAsSubclassOfTheOriginalOne()
|
||||||
{
|
{
|
||||||
$proxyClass = 'Proxies\DoctrineTestsModelsECommerceECommerceFeatureProxy';
|
$proxyClass = 'Proxies\DoctrineTestsModelsECommerceECommerceFeatureProxy';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user