Issues

ZF-5040: Impossible to set same method name in two differents services

Issue Type: Bug Created: 2008-11-24T03:19:24.000+0000 Last Updated: 2009-05-15T11:47:45.000+0000 Status: Resolved Fix version(s): - 1.7.2 (23/Dec/08)

Reporter: Cyrille (cyrilleb) Assignee: Wade Arnold (wadearnold) Tags: - Zend_Amf

Related issues: Attachments:

Description

It is impossible to set same method name in two different services: If I set getMenu in ServiceA and in ServiceB I can't call ServiceA.getMenu or ServiceB.getMenu.

The Zend_Amf_Server_Exception message is 'Duplicate method registered: getMenu'

My gateway.php

<pre class="highlight">

$server = new Zend_Amf_Server();
$server->setProduction(true);

$server->addDirectory(dirname(__FILE__) .'/services/');
$server->setClass('ServiceA');
$server->setClass('ServiceB');

echo $server->handle();

My two classes: ServiceA.php

<pre class="highlight">
<?php
class ServiceA {    
    
    function __construct() {        
        //Construction...
    }
    
    /**
     * @return string
     */
    public function getMenu( )
    {
        return 'myMenuA';
    }
}
?>

ServiceB.php

<pre class="highlight">
<?php
class ServiceB {    
    
    function __construct() {        
        //Construction...
    }
    
    /**
     * @return string
     */
    public function getMenu( )
    {
        return 'myMenuB';
    }
}
?>

Comments

Posted by Wade Arnold (wadearnold) on 2008-12-12T12:37:24.000+0000

I have the issue reproduce and working on a solution. Thanks for submitting the bug.

Posted by Wade Arnold (wadearnold) on 2008-12-12T13:11:37.000+0000

Update to add a default namespace based on the class name so that there are no long conflict issues with reflection of classes with the same method names.

Posted by Francisco Herrero (tinsax) on 2009-05-15T11:47:45.000+0000

Hello!, sorry about my english but i'm spanish and my english in poor.

I explain my problem.. i have a project, that project have 3 classes: OtherProductDelegate.php, wineProductDelegate.php and ProductDelegate.php. The last class is a parent class, otherproduct and wineproduct are children from product.

class ProductDelegate class OtherProductDelegate extends ProductDelegate class WineProductDelegate extends ProductDelegate

ProductDelegate has a method function InsertProduct( $productVO ), and the derivated classes have the methods:

WineProductDelegate function InsertWineProduct( $wineproductVO ) { parent::InsertProduct( $wineproductVO ); }

OtherProductDelegate function InsertOtherProduct( $otherproductVO ) { parent::InsertProduct( $otherproductVO ); }

When i had only derived class all work fine, but when i created the second derivated class i have this error:

Fatal error: Uncaught exception 'Zend_Amf_Server_Exception' with message 'Duplicate method registered: InsertProduct' in C:\AppServ\www\webElMananServer\zend_framework\library\Zend\Amf\Server.php:543 Stack trace: #0 C:\AppServ\www\webElMananServer\zend_framework\library\Zend\Amf\Server.php(447): Zend_Amf_Server->_buildDispatchTable() #1 C:\AppServ\www\webElMananServer\index.php(17): Zend_Amf_Server->setClass('OtherProductDel...') #2 {main} thrown in C:\AppServ\www\webElMananServer\zend_framework\library\Zend\Amf\Server.php on line 543

I have read that this problem is resolved, i don't know if i have the same problem.

I hope you can help me, please.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts