Php 错误1061的帮助-调用可能未定义的方法
首先,这里是我得到的确切错误:Php 错误1061的帮助-调用可能未定义的方法,php,apache-flex,actionscript-3,flash-builder,remoting,Php,Apache Flex,Actionscript 3,Flash Builder,Remoting,首先,这里是我得到的确切错误: 错误1061:通过引用静态类型类调用可能未定义的方法\u initRemoteClassAlias 话虽如此,我想我知道的是。它正试图调用名为\u initRemoteClassAlias的方法,但找不到它。所以我猜我的困惑/问题出在哪里。它试图调用的方法是由FlashBuilder在我编写的PHP脚本的_超类中自动创建的。(在本例中,错误源于:services.cascobackend.\u Super\u cascobackend.as)-下面是所讨论的\u
错误1061:通过引用静态类型类调用可能未定义的方法\u initRemoteClassAlias
话虽如此,我想我知道的是。它正试图调用名为\u initRemoteClassAlias
的方法,但找不到它。所以我猜我的困惑/问题出在哪里。它试图调用的方法是由FlashBuilder在我编写的PHP脚本的_超类中自动创建的。(在本例中,错误源于:services.cascobackend.\u Super\u cascobackend.as)-下面是所讨论的\u Super类的第一段代码:
package services.cascobackend
{
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper;
import com.adobe.serializers.utility.TypeUtility;
import mx.rpc.AbstractOperation;
import mx.rpc.AsyncToken;
import mx.rpc.remoting.Operation;
import mx.rpc.remoting.RemoteObject;
import valueObjects.Ticket;
import mx.collections.ItemResponder;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
[ExcludeClass]
internal class _Super_CASCOBackend extends com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper
{
// Constructor
public function _Super_CASCOBackend()
{
// initialize service control
_serviceControl = new mx.rpc.remoting.RemoteObject();
// initialize RemoteClass alias for all entities returned by functions of this service
valueObjects.Ticket._initRemoteClassAlias();
var operations:Object = new Object();
var operation:mx.rpc.remoting.Operation;
operation = new mx.rpc.remoting.Operation(null, "throwExceptionOnError");
operation.resultType = Object;
operations["throwExceptionOnError"] = operation;
operation = new mx.rpc.remoting.Operation(null, "getTicketsByUser");
operation.resultElementType = valueObjects.Ticket;
operations["getTicketsByUser"] = operation;
_serviceControl.operations = operations;
_serviceControl.convertResultHandler = com.adobe.serializers.utility.TypeUtility.convertResultHandler;
_serviceControl.source = "CASCOBackend";
_serviceControl.endpoint = "http://localhost/CMphp/public/gateway.php";
preInitializeService();
model_internal::initialize();
}
发生错误的具体行是:
valueObjects.Ticket._initRemoteClassAlias();
在应用程序中,我(显然)创建了一个名为Ticket的值对象,如下所示:
package valueObjects
{
[Bindable]
[RemoteClass(alias="Ticket")]
public class Ticket
{
public var ticketid:int;
public var ticketNumber:String;
etc...
etc...
...
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
$row = new Ticket();
mysqli_bind_result($stmt, $row->ticketid, etc...
它所引用的PHP函数只是获取具有特定参数的所有项,并返回一个Ticket[]数组,其结果作为单个Ticket项,如下所示:
package valueObjects
{
[Bindable]
[RemoteClass(alias="Ticket")]
public class Ticket
{
public var ticketid:int;
public var ticketNumber:String;
etc...
etc...
...
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
$row = new Ticket();
mysqli_bind_result($stmt, $row->ticketid, etc...
另外-当我在FlashBuilder中运行此函数的测试时,它返回的项与我预期的一样,即使出现了关于_initRemoteClassAlias的错误。如果我只是注释掉有问题的那一行,那么代码在运行时就不会返回任何内容(尽管在FB中测试时仍然返回值)
所以-我已经纠结了好几个小时,四处寻找答案,但我没有主意了。希望你有一些
提前感谢您的帮助!
-CS
编辑:::编辑:::
好的-下面是Flex创建的整个超级代码:
/**
* This is a generated class and is not intended for modification. To customize behavior
* of this service wrapper you may modify the generated sub-class of this class - CASCOBackend.as.
*/
package services.cascobackend
{
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper;
import com.adobe.serializers.utility.TypeUtility;
import mx.rpc.AbstractOperation;
import mx.rpc.AsyncToken;
import mx.rpc.remoting.Operation;
import mx.rpc.remoting.RemoteObject;
import valueObjects.Ticket;
import mx.collections.ItemResponder;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
[ExcludeClass]
internal class _Super_CASCOBackend extends com.adobe.fiber.services.wrapper.RemoteObjectServiceWrapper
{
// Constructor
public function _Super_CASCOBackend()
{
// initialize service control
_serviceControl = new mx.rpc.remoting.RemoteObject();
// initialize RemoteClass alias for all entities returned by functions of this service
valueObjects.Ticket._initRemoteClassAlias();
var operations:Object = new Object();
var operation:mx.rpc.remoting.Operation;
operation = new mx.rpc.remoting.Operation(null, "throwExceptionOnError");
operation.resultType = Object;
operations["throwExceptionOnError"] = operation;
operation = new mx.rpc.remoting.Operation(null, "getTicketsByUser");
operation.resultElementType = valueObjects.Ticket;
operations["getTicketsByUser"] = operation;
_serviceControl.operations = operations;
_serviceControl.convertResultHandler = com.adobe.serializers.utility.TypeUtility.convertResultHandler;
_serviceControl.source = "CASCOBackend";
_serviceControl.endpoint = "http://localhost/CMphp/public/gateway.php";
preInitializeService();
model_internal::initialize();
}
//init initialization routine here, child class to override
protected function preInitializeService():void
{
destination = "CASCOBackend";
}
/**
* This method is a generated wrapper used to call the 'throwExceptionOnError' operation. It returns an mx.rpc.AsyncToken whose
* result property will be populated with the result of the operation when the server response is received.
* To use this result from MXML code, define a CallResponder component and assign its token property to this method's return value.
* You can then bind to CallResponder.lastResult or listen for the CallResponder.result or fault events.
*
* @see mx.rpc.AsyncToken
* @see mx.rpc.CallResponder
*
* @return an mx.rpc.AsyncToken whose result property will be populated with the result of the operation when the server response is received.
*/
public function throwExceptionOnError(link:Object) : mx.rpc.AsyncToken
{
var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("throwExceptionOnError");
var _internal_token:mx.rpc.AsyncToken = _internal_operation.send(link) ;
return _internal_token;
}
/**
* This method is a generated wrapper used to call the 'getTicketsByUser' operation. It returns an mx.rpc.AsyncToken whose
* result property will be populated with the result of the operation when the server response is received.
* To use this result from MXML code, define a CallResponder component and assign its token property to this method's return value.
* You can then bind to CallResponder.lastResult or listen for the CallResponder.result or fault events.
*
* @see mx.rpc.AsyncToken
* @see mx.rpc.CallResponder
*
* @return an mx.rpc.AsyncToken whose result property will be populated with the result of the operation when the server response is received.
*/
public function getTicketsByUser(userid:Object) : mx.rpc.AsyncToken
{
var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getTicketsByUser");
var _internal_token:mx.rpc.AsyncToken = _internal_operation.send(userid) ;
return _internal_token;
}
}
}
很简单,
\u initRemoteClassAlias()
不是票证的一部分,或者它不是静态公共
我不知道是谁编写的代码,但它没有遵循我所看到的任何标准。是谁编写的代码?这是非常混乱的…FlashBuilder创建了_超级类代码-剩下的示例只是展示Ticket对象是如何开始的,PHP部分是展示数组是如何构建的,等等。你确定吗?我从未见过这种从FlashBuilder生成的代码。不管怎么说,你所指的函数是无用的,所以你可以把它注释掉。还有,什么不是静态公共的?超级文件,票证,作为???抱歉,如果这是一个愚蠢的问题…是的-但当我注释掉它时-它不会返回任何东西…?静态公共将与票证相关,因为您试图引用的是一个类,而不是一个实例。注释掉该行,而是添加一个
private var\u ticket:ticket代码>右上方的构造函数,看看这是否有效。