2012-04-05 14 views
1

埋め込まれたi18n形式の中で私はオブジェクトを取得する必要があります。 この例では、私はArtistImageTranslationオブジェクトを持っていますが、私はArtistImageが必要です。オブジェクトをi18n形式で取得する

誰か助けてもらえますか?

class ArtistImageTranslationForm extends BaseArtistImageTranslationForm 
{ 
    public function configure() 
    { 
    $this->getObject(); 
    .... 
    } 
} 

答えて

0

あなたは次のことを試しましたか?

$artistimage = $this->getObject()->getArtistImage(); 
+0

私は、不明なメソッドArtistImageTranslation :: getArtistImage'を取得しようとしました。 – user1256630

0

試してみてください。

$artistimage = $this->getObject()->artistImage; 

または

$artistimage = $this->getObject()->artist_image; 
+0

$ this-> getObject() - > artistImage'は、ArtistImageTranslationと '$ this-> getObject() - > artist_image'は、 'ArtistImageTranslation"の 'Unknownレコードプロパティ/関連コンポーネント" artist_image "を返します。 – user1256630

0

私は同じ問題で、今日一日の半分を過ごし、私は最終的に何かを見つけたように見える;)

まず、もしテーブルの「翻訳」部分にあるフィールドにアクセスする必要があります。フィールドには、foに含まれるオブジェクトから直接アクセスできますrm。ゲッターを使わずにプロパティにアクセスするだけです(いい方法ではありませんが、動作します)。

$this->getObject()->getTable()->getRelation('ArtistImage') 
    ->fetchRelatedFor($this->getObject()); 

・ホープ、このことができます:あなたは本当にあなたがこのようにアクセスすることができ、元のオブジェクトが必要な場合など

$this->getObject()->id; 
$this->getObject()->translated_name; 

を:だから、のようなものを使用することができます。

関連する問題