私はsymfony 1.4 & doctrineを使ってプロジェクトを進めています。私のschema.ymlの1.2symfony/doctrine従業員のgetOrganisation()は文字列を返します(ただしオブジェクトが必要です)
私は、従業員と組織エンティティ定義された:私は、コマンドsymfony doctrine:build --all --and-load
を実行し
employee:
tableName: employee
columns:
id:
primary: true
type: integer(8)
notnull: true
autoincrement: true
organization:
default: NULL
type: integer
relations:
organization:
onDelete: restrict
local: organization
foreign: id
organization:
tableName: organization
columns:
id:
primary: true
unique: true
type: integer
notnull: true
autoincrement: true
relations:
employee:
type: many
class: employee
local: id
foreign: organization
を、これは(再)に応じて、テーブルとのphp-クラスでデータベースを作成しますschema.yml。
今私が$employee->getOrganization()
($従業員が従業員であると仮定して)を実行すると、クラス構成のオブジェクトを取得することが期待されます。しかし、私は組織のIDフィールドの内容で文字列を取得します。 私はそれ以外の方法でそれを試してみます:$organization->getEmployee()
($ organizationはクラス組織であると仮定します)、すべての従業員と共にDoctrine_Collectionを返します。
組織オブジェクトを返すにはどのようにしてgetOrganization()
を返すのですか?
Gradの「組織」を「組織」(北米以外の国での綴り)として再表示しても、それは間違いではありません。 –
@コリンファイン:ハハ、オクラホマ、私はNAの外にいて、Zを好む。 : – Mathias
@コリンoops ...申し訳ありません... ;-) zが許可されていることを知りませんでした... –