duancong2965 2012-02-07 01:53
浏览 34

Flex Flash Builder表单。 本地开发中没有错误,但生产服务器上的错误

I have been going crazy trying to figure this problem out. I have a Flex Form application that works perfectly on my local development server. I'm using Flash Builder 4.5.1 with Zend Server community edition and PHP 5.3.8 I am deploying to a server running PHP 5.2.17 I have 2 drop down list controls on the form that are populated with data from a mysql database using a php data service. These work perfectly on the server. The problem is after the form is filled out and the save button is pushed I immediately get a channel disconnect error saying channel disconnected before a response was received. I have ran Charles against this and it gives me the same error message as the PHP log on the server which is:

[06-Feb-2012 18:19:18] PHP Catchable fatal error: Argument 1 passed to TeamService::createTeam() must be an instance of TeamVO, instance of stdClass given in /home/nmal2011/public_html/services/TeamService.php on line 22

I have removed code hinting from the TeamSerivce.php but that did not resolve the issue. I will post my Flex and PHP code. I am passing an instance of TeamVO and nothing I have tried has changed this outcome. I've been researching and fighting this for four days now. I don't have this problem in Development locally, only in production on a shared hosting.

Here is my Flex Code:

            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 + '
' + 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 + '
' + event.fault.faultDetail)"
                                         showBusyCursor="true"/>
    <s:CallResponder id="getAllStatesResult"/>
    <statesservice:StatesService id="statesService"
                                 fault="Alert.show(event.fault.faultString + '
' + event.fault.faultDetail)"
                                 showBusyCursor="true"/>


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

Here is the PHP Service Call

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

I can reach my zend amf endpoint and as I said, the service calls to populate the 2 drop down lists with selection data work fine so I know there is database connectivity I would greatly appreciate any help or insight into fixing this.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
    • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
    • ¥30 Unity接入微信SDK 无法开启摄像头
    • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
    • ¥20 cad图纸,chx-3六轴码垛机器人
    • ¥15 移动摄像头专网需要解vlan
    • ¥20 access多表提取相同字段数据并合并
    • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
    • ¥20 Java-Oj-桌布的计算
    • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow