1

我一直在疯狂地试图解决这个问题。我有一个可以在本地开发服务器上完美运行的 Flex Form 应用程序。我正在使用带有 Zend Server 社区版和 PHP 5.3.8 的 Flash Builder 4.5.1 我正在部署到运行 PHP 5.2.17 的服务器我在表单上有 2 个下拉列表控件,这些控件使用 mysql 数据库中的数据填充一个php数据服务。这些在服务器上完美运行。问题是在填写表格并按下保存按钮后,我立即收到一个频道断开错误,说频道在收到响应之前已断开连接。我已经针对此运行了 Charles,它给了我与服务器上的 PHP 日志相同的错误消息,即:

[06-Feb-2012 18:19:18] PHP 可捕获的致命错误:传递给 TeamService::createTeam() 的参数 1 必须是 TeamVO 的实例,/home/nmal2011/public_html/services/TeamService 中给出的 stdClass 的实例。第 22 行的 php

我已经从 TeamSerivce.php 中删除了代码提示,但这并没有解决问题。我将发布我的 Flex 和 PHP 代码。我正在传递一个 TeamVO 的实例,但我尝试过的任何事情都没有改变这个结果。我已经研究和抗争了四天了。我在本地开发中没有这个问题,只有在共享主机上的生产中。

这是我的弹性代码:

            protected function registrant_creationCompleteHandler(event:FlexEvent):void {
            dateToday = new Date();
            date_updatedDateField.selectedDate = dateToday;
            statusTextInput.text = status;  
            teamVO = new TeamVO;
        }   


        protected function btnSave_clickHandler(event:MouseEvent):void {
            teamVO.tournament_id = ddlTournaments.selectedItem.tournament_id;
            teamVO.date_updated = date_updatedDateField.text;
            teamVO.first_name = first_nameTextInput.text;
            teamVO.last_name = last_nameTextInput.text;
            teamVO.company = companyTextInput.text;
            teamVO.title = titleTextInput.text;
            teamVO.address = addressTextInput.text;
            teamVO.city = cityTextInput.text;
            teamVO.state = ddlStates.selectedItem.state_id;
            teamVO.postal_code = postal_codeTextInput.text;
            teamVO.phone = phoneTextInput.text;
            teamVO.email = emailTextInput.text;
            teamVO.team_name = team_nameTextInput.text;
            teamVO.team_id = parseInt(team_idTextInput.text);
            teamVO.status = statusTextInput.text;

            Alert.show(teamVO.first_name + " teamVO code hit");
            createTeamResult.token = teamService.createTeam(teamVO);
            lblMessage.text = "Your information has been saved.";
            btnEnterTeamMembers.enabled = true;

        }
            protected function ddlTournaments_creationCompleteHandler(event:FlexEvent):void {
            getTournamentsByActivityResult.token = tournamentService.getTournamentsByActivity(active);
        }

        protected function ddlStates_creationCompleteHandler(event:FlexEvent):void {
            getAllStatesResult.token = statesService.getAllStates();
        }

        protected function createTeamResult_resultHandler(event:ResultEvent):void {
            teamVO2 = createTeamResult.lastResult as TeamVO
            teamVO2.team_id = parseInt(team_idTextInput2.text);
            teamNo = teamVO2.team_id;
            var eventObj:Event = new Event("setTeamID");
            dispatchEvent(eventObj);
        }

        protected function btnEnterTeamMembers_clickHandler(event:MouseEvent):void {            
            this.parentApplication.currentState = "Members";            
        }

    ]]>
</fx:Script>
<fx:Metadata>
    [Event(name="setTeamID", type="flash.events.Event")]
</fx:Metadata>
<fx:Declarations>
    <valueObjects:TeamVO id="teamVO"/>
    <teamservice:TeamService id="teamService"
                             fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                             showBusyCursor="true"/>
    <s:CallResponder id="createTeamResult"
                     result="createTeamResult_resultHandler(event)"/>
    <valueObjects:TeamVO id="teamVO2"/>
    <s:CallResponder id="getTournamentsByActivityResult"/>
    <tournamentservice:TournamentService id="tournamentService"
                                         fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                         showBusyCursor="true"/>
    <s:CallResponder id="getAllStatesResult"/>
    <statesservice:StatesService id="statesService"
                                 fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                 showBusyCursor="true"/>


    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

这是 PHP 服务调用

    public function createTeam(TeamVO $team){
    $stmt = $this->_pdo->prepare("INSERT INTO $this->tablename (`first_name`, `last_name`, `address`, `city`, `state`, `postal_code`, `phone`, `email`, `company`, `title`, `team_name`, `status`, `tournament_id`, `date_updated`) 
                VALUES (:first_name, :last_name, :address, :city, :state, :postal_code, :phone, :email, :company, :title, :team_name, :status, :tournament_id, :date_updated)");
    $stmt->bindParam(':first_name', $team->first_name);
    $stmt->bindParam(':last_name', $team->last_name, PDO::PARAM_STR);
    $stmt->bindParam(':address', $team->address, PDO::PARAM_STR);
    $stmt->bindParam(':city', $team->city, PDO::PARAM_STR); 
    $stmt->bindParam(':state', $team->state, PDO::PARAM_STR);
    $stmt->bindParam(':postal_code', $team->postal_code,PDO::PARAM_STR);
    $stmt->bindParam(':phone', $team->phone, PDO::PARAM_STR); 
    $stmt->bindParam(':email', $team->email, PDO::PARAM_STR); 
    $stmt->bindParam(':company', $team->company, PDO::PARAM_STR);
    $stmt->bindParam(':title', $team->title, PDO::PARAM_STR); 
    $stmt->bindParam(':team_name', $team->team_name, PDO::PARAM_STR);
    $stmt->bindParam(':status', $team->status, PDO::PARAM_STR);
    $stmt->bindParam(':tournament_id', $team->tournament_id, PDO::PARAM_INT);
    $stmt->bindParam(':date_updated', $team->date_updated, PDO::PARAM_STR);
    $stmt->execute();
    $team->team_id = $this->_pdo->lastInsertId();   
        return $team;   
}

我可以到达我的 zend amf 端点,正如我所说,使用选择数据填充 2 个下拉列表的服务调用工作正常,所以我知道存在数据库连接,我将非常感谢任何帮助或解决此问题的见解。

4

0 回答 0