2017-02-09 85 views
0

時,什麼是正確的buildViolation屬性路徑我不知道,什麼絡基科技()parametr本規範規定:有翻譯屬性

/** 
* @Assert\Callback 
*/ 
public function validate(ExecutionContextInterface $context, $payload) 
{ 
    $title = $this->getTitle(); 
    if ($this->getTitle() !== 'aaa') { 
     $context->buildViolation("This title: {$title} sounds totally fake!") 
      ->atPath('title') 
      ->addViolation(); 
    } 
} 

$標題是通過$翻譯抽象成另一個實體。

對於普通屬性$ linkUrl,我只是提供'linkUrl',它的工作原理。

也許這些HTML代碼可以幫助破譯它:

這第一個,我有問題。我試過atPath('translations_cs_title'),但不起作用。 enter image description here

這一個工程與

enter image description here

回答

0

我已經找到自己的答案絡基( 'linkUrl'):

翻譯[CS] .title僞