2014-05-23 8 views
0

심플한 심플 CMS 번들에서 extend the default Page class님께 보내려고합니다.Symfony simple cms 번들에서 Page 클래스를 확장하는 방법은 무엇입니까?

문제 :
사용자 지정 속성이 유지되지 않습니다.

다음은 BasePage에서 확장 한 클래스의 코드입니다.

use Doctrine\ODM\PHPCR\Mapping\Annotations\Document; 
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM; 
use Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page as BasePage; 

/** 
* {@inheritDoc} 
* @PHPCRODM\Document(referenceable=true) 
*/ 
class Product extends BasePage 
{ 
    public $node; 

    /** 
    * @var string(nullable=true) 
    */ 
    private $code; 

    /** 
    * Get Code 
    * @return string 
    */ 
    public function getCode() 
    { 
     return $this->code; 
    } 

    /** 
    * Set code 
    * @return Product 
    */ 
    public function setCode($code) 
    { 
     $this->code = $code; 
     return $this; 
    } 
} 

답변

1

이 거의 정확한 보이지만, 당신은 $ 코드에 매핑 그리워 :

/** 
* @PHPCRODM\String(nullable=true) 
*/ 
private $code; 

내가 $code 언어 의존하지 않는 것으로 가정합니다. 당신은 또한 PHPCR 노드 매핑 갖고 싶어 그렇지 않으면 당신은 당신이

/** 
* @PHPCRODM\Node 
*/ 
public $node; 
+0

고마워 데이비드 필요 nullable=true,translatable=true

을해야합니다 :) – loicb