2011-07-26 8 views
0

wamp serverとPropelを使用しています。Propelを使用してサービスを作成しましたが、サービスから返されたデータを接続するときに戻り値の型を認識できません。flexのpropel戻り型の設定

これは私が自動検出の戻り値の型を選択したときはまだ、それはエラーに

'teacher' cannot be set to the data type "StdClass" because it has no properties. 
を与え、私はデータグリッド内teacersの情報を表示するためにwanto

<?php 

// Include the main Propel script 
require_once 'C:/wamp/propel/runtime/lib/Propel.php'; 

// Initialize Propel with the runtime configuration 
Propel::init("C:/wamp/www/school/build/conf/school-conf.php"); 

// Add the generated 'classes' directory to the include path 
set_include_path("C:/wamp/www/school/build/classes" . PATH_SEPARATOR . get_include_path()); 

class TeacherService { 
function getTeachers() 
{ 

$allTeachers=TeacherQuery::create()->find(); 

$teachers=array(); 
foreach($allTeachers as $teacher1) 
{ 

    array_push($teachers, $teacher1); 

} 

return $teachers; 
} 
} 
?> 

を書いたPHPのコードです

propelによって返された教師行のプロパティをflexに知らせるにはどうすればよいですか?

+0

PHPコードのみを提供するように見えるPHPタグb/cを追加しました。個人的には、プロペラが何であるか分かりません。 – JeffryHouser

答えて

0

@ www.Flextras.com PropelはPHPのORMフレームワークです。

あなたがシリアライズがあなたのPHPのクラスで仕事をしたい場合、あなたはこのような何かを持っている必要があります。この

var $_explicitType = "path.to.classes.Teacher"; 

とあなたのFlex側VOさんのようなものを持っている必要があります。

[Bindable] 
[RemoteClass(alias="path.to.classes.Teacher")] 

これは、AMFを使用していることを前提としています。 AMFエンドポイントでもマッピングを指定する必要があります。たとえば、私のエンドポイントファイルにこのようなものがあります。

$server->setClassMap('path.to.classes.Teacher' , 'path\to\classes\Teacher'); 

これはあなたのエンドポイントは、それが直列化復元されなければならないPHP側でのクラスマッチング記述子、とクラスを見たときにことを知ることができます。