1
0
mirror of synced 2025-03-21 15:33:51 +03:00

Fixed #DDC-578

Also added a new testcase
This commit is contained in:
Christian Heinrich 2010-05-10 16:17:17 +02:00 committed by Roman S. Borschel
parent f9b53c6b5c
commit f2213c4d00
3 changed files with 28 additions and 10 deletions

View File

@ -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 = '';

View File

@ -18,5 +18,9 @@ class ForumEntry
* @Column(type="string", length=50)
*/
public $topic;
public function &getTopicByReference() {
return $this->topic;
}
}

View File

@ -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';