Php Flex 1056:“;无法创建属性";——但该属性已存在于datatable中
我正在学习一个flex应用程序教程,虽然我已经能够修复我的大部分错误,但这一个让我完全难堪 我有一个名为employees的数据表,包含以下列:id、名字、姓氏、头衔、生日、手机、电话、电子邮件、地址、照片文件 该应用程序很简单:在HomeView中列出所有员工,当您点击员工时,会将您带到DetailView,在那里您可以看到他们的所有额外信息。然而,每次我这样做,我都会得到: “ReferenceError:错误#1056:无法在valueObjects.Employees上创建属性地址。” 以下是DetailView的代码:Php Flex 1056:“;无法创建属性";——但该属性已存在于datatable中,php,database,actionscript-3,apache-flex,referenceerror,Php,Database,Actionscript 3,Apache Flex,Referenceerror,我正在学习一个flex应用程序教程,虽然我已经能够修复我的大部分错误,但这一个让我完全难堪 我有一个名为employees的数据表,包含以下列:id、名字、姓氏、头衔、生日、手机、电话、电子邮件、地址、照片文件 该应用程序很简单:在HomeView中列出所有员工,当您点击员工时,会将您带到DetailView,在那里您可以看到他们的所有额外信息。然而,每次我这样做,我都会得到: “ReferenceError:错误#1056:无法在valueObjects.Employees上创建属性地址。”
xmlns:employeesservice1="services.employeesservice1.*"
overlayControls="false"
title="{getEmployeesByIDResult.lastResult.Firstname} {getEmployeesByIDResult.lastResult.Lastname}"
viewActivate="view1_viewActivateHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import spark.events.ViewNavigatorEvent;
import mx.rpc.events.ResultEvent;
protected function goBack(event:Event):void
{
navigator.pushView(EmployeeListerHomeView);
}
protected function getEmployeesByID(itemID:int):void
{
getEmployeesByIDResult.token = employeesService1.getEmployeesByID(itemID);
}
protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
{
this.addElement(busyIndicator);
getEmployeesByID(data as int);
}
protected function getAllEmployeesResult_resultHandler(event:ResultEvent):void
{
this.removeElement(busyIndicator);
}
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getEmployeesByIDResult" result="getAllEmployeesResult_resultHandler(event)"/>
<employeesservice1:EmployeesService1 id="employeesService1"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:navigationContent>
<s:Button id="backBtn" click="goBack(event)">
<s:icon>
<s:MultiDPIBitmapSource source160dpi="@Embed('assets/save160.png')"
source240dpi="@Embed('assets/save240.png')"
source320dpi="@Embed('assets/save320.png')"/>
</s:icon>
</s:Button>
</s:navigationContent>
<s:Image x="10" y="10" width="100" height="100"
source="http://localhost/EmployeeLister/assets/{getEmployeesByIDResult.lastResult.photofile}128x128.png" />
<s:VGroup width="100%" height="100%" gap="10" paddingLeft="120">
<s:Label fontWeight="bold" paddingTop="10" text="Title"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Title}"/>
<s:Label fontWeight="bold" paddingTop="10" text="Cell Phone"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Cellphone}"/>
<s:Label fontWeight="bold" paddingTop="10" text="Office Phone"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Officephone}"/>
<s:Label fontWeight="bold" paddingTop="10" text="Email"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Email}"/>
<s:Label fontWeight="bold" paddingTop="10" text="Address"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Address}"/>
</s:VGroup>
<s:BusyIndicator id="busyIndicator" verticalCenter="0" horizontalCenter="0" symbolColor="red"/>
即使你不知道确切的答案,有没有更简单的方法让我知道发生了什么?错误窗口中的调用堆栈是所有内部flex/as3内容。所以我不想去兔子洞,如果我不需要的话
非常感谢您的帮助。谢谢 找到了答案
问题出在.php中,在生成的每个getEmployeesBy**()
函数之后,都有一个@return stdClass
但是,我需要创建一个
getEmployeesByName
函数,并在getEmployeesByID()
和@return stdClass
之间创建。所以我在函数之间加了另一个@return
,现在一切都正常了。Off:我的名字很奇怪,但你赢了!
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where id=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->id, $row->Firstname, $row->Lastname, $row->Title, $row->Birthday, $row->Cellphone, $row->Officephone, $row->Email, $row->Address, $row->photofile);
if(mysqli_stmt_fetch($stmt)) {
$row->Birthday = new DateTime($row->Birthday);
return $row;
} else {
return null;
}
}