2012-03-01 14 views
0

単純なエンティティUserTypeがあります。 usertypeはUIのドロップダウンに表示されるため、さまざまな言語で利用できるようにしたいと思います。私のプロジェクトでi18nをどのように動作させるべきですか?それはドキュメントではっきりしていませんでした。i18nのdoctrine翻訳をzendフレームワークに統合するには?

あなたは単に「@gedmo:翻訳可能」を追加し
<?php 

namespace Entities; 

/** 
* @Entity (repositoryClass="Repositories\UserType") 
* @Table(name="usertypes") 
* @HasLifecycleCallbacks 
*/ 
class UserType { 

    /** 
    * @Id @Column(type="integer") 
    * @GeneratedValue(strategy="AUTO") 
    */ 
    private $id; 

    /** @Column(type="string", length=30,unique=TRUE) */ 
    private $usertype; 

    /** @Column(type="boolean") */ 
    private $active; 


    public function __construct() { 

     $this->active = true; 
    } 

    /** 
    * @return the $id 
    */ 
    public function getId() { 
     return $this->id; 
    } 

    /** 
    * @return the $usertype 
    */ 
    public function getUserType() { 
     return $this->usertype; 
    } 

    /** 
    * @return the $active 
    */ 
    public function getActive() { 
     return $this->active; 
    } 

    /** 
    * @param field_type $usertype 
    */ 
    public function setUsertype($usertype) { 
     $this->usertype = $usertype; 
    } 

    /** 
    * @param field_type $active 
    */ 
    public function setActive($active) { 
     $this->active = $active; 
    } 

} 

答えて

0

<?php 

namespace Entities; 

/** 
* @Entity (repositoryClass="Repositories\UserType") 
* @Table(name="usertypes") 
* @HasLifecycleCallbacks 
*/ 
class UserType { 

    /** 
    * @Id @Column(type="integer") 
    * @GeneratedValue(strategy="AUTO") 
    */ 
    private $id; 

    /** 
    * @gedmo:Translatable 
    * @Column(type="string", length=30,unique=TRUE) 
    */ 
    private $usertype; 

    /** @Column(type="boolean") */ 
    private $active; 

    /** 
    * @gedmo:Locale 
    */ 
    private $locale; 

    public function __construct() { 

     $this->active = true; 
    } 

    /** 
    * @return the $id 
    */ 
    public function getId() { 
     return $this->id; 
    } 

    /** 
    * @return the $usertype 
    */ 
    public function getUserType() { 
     return $this->usertype; 
    } 

    /** 
    * @return the $active 
    */ 
    public function getActive() { 
     return $this->active; 
    } 

    /** 
    * @param field_type $usertype 
    */ 
    public function setUsertype($usertype) { 
     $this->usertype = $usertype; 
    } 

    /** 
    * @param field_type $active 
    */ 
    public function setActive($active) { 
     $this->active = $active; 
    } 

    public function setTranslatableLocale($locale) 
    { 
     $this->locale = $locale; 
    } 

} 
+0

私の知る限り、これは私のZFプロジェクトでDoctrineExtensionsを設定する必要があり、これは一部ですtranslableフィールドに自分のコメントブロックに私が立ち往生していることのすでにこれを実装していますか? – dimbo

関連する問題