Commit f2213c4d authored by Christian Heinrich's avatar Christian Heinrich Committed by Roman S. Borschel

Fixed #DDC-578

Also added a new testcase
parent f9b53c6b
......@@ -164,7 +164,11 @@ class ProxyFactory
}
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;
$parameterString = $argumentString = '';
......
......@@ -18,5 +18,9 @@ class ForumEntry
* @Column(type="string", length=50)
*/
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());
}
/**
* 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()
{
$proxyClass = 'Proxies\DoctrineTestsModelsECommerceECommerceFeatureProxy';
......
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