Flex 1056: невозможно создать свойство, но оно уже существует в таблице данных.

Я следую учебному пособию по гибкому приложению, и хотя мне удалось исправить большинство своих ошибок, эта ошибка меня полностью поставила в тупик.

У меня есть таблица данных, называемая сотрудниками, с этими столбцами: идентификатор, имя, фамилия, должность, день рождения, мобильный телефон, офисный телефон, электронная почта, адрес, фотофайл.

Приложение простое: перечислите всех сотрудников в HomeView, и когда вы нажмете на сотрудника, вы попадете в DetailView, где вы увидите всю их дополнительную информацию. Однако каждый раз, когда я это делаю, я получаю: «ReferenceError: Ошибка № 1056: невозможно создать адрес свойства для valueObjects.Employees».

Вот код для DetailView:

    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"/>

Now something to note: I added the Cellphone, Officephone, Email, and Address columns after I had created the EmployeesService1, and so I had to edit the .php to include these new values. So I'm worried I might have done something wrong there, but I triple checked for typos and I'm not getting any errors on the other values, so, I don't know. Again, this has me pretty frustrated. I've tested all the operations in the service, and they're all returning all of the appropriate values.

Вот функция из .php: public function getEmployeesByID($itemID) {

    $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;
    }
}

Даже если вы не знаете точного ответа, есть ли для меня более простые способы выяснить, что происходит? Стек вызовов в окне ошибки — это все внутреннее содержимое flex/as3. Так что я не хочу спускаться в эту кроличью нору, если в этом нет необходимости.

Любая помощь приветствуется. Спасибо!!!!


person DanTheMan    schedule 03.12.2013    source источник
comment
Off: Меня зовут странно, но ты выиграл!   -  person DontVoteMeDown    schedule 03.12.2013


Ответы (1)


Догадаться.

Проблема была в .php, после каждой из сгенерированных getEmployeesBy**() функций есть @return stdClass.

Однако мне нужно было создать функцию getEmployeesByName, и я сделал это между getEmployeesByID() и @return stdClass. Так что я просто вставил еще один @return между функциями, и теперь все работает чисто.

person DanTheMan    schedule 03.12.2013