2017-07-09 18 views
0

私はTYPO3 7.6.18を持っていますが、私の問題はaddCommentActionが動作しない/呼び出されないことです。TYPO3アクションが呼び出さない

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
    "MyVendor.".$_EXTKEY, 
    'commentForm', 
    'Comment form' 
); 

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'MyVendor.'.$_EXTKEY, 
    'commentForm', 
    array('Comment' => 'form,addComment'), 
    array('Comment' => 'form,addComment') 
); 



<f:form action="addComment" object="{newComment}" name="newComment" method="post" additionalParams="{showUid: userto}"> 
     <div style="overflow: hidden;"> 
      <div id="reviewStars-input"> 
       <f:form.hidden property="userto" value="{userto}"/> 
       <f:form.radio property="rating" value="5" id="star-4"/> 
       <label title="{f:translate(key: 'tx_fecomments_domain_model_comment.gorgeous')}" for="star-4"></label> 
       <f:form.radio property="rating" value="4" id="star-3"/> 
       <label title="{f:translate(key: 'tx_fecomments_domain_model_comment.good')}" for="star-3"></label> 
       <f:form.radio property="rating" value="3" id="star-2"/> 
       <label title="{f:translate(key: 'tx_fecomments_domain_model_comment.regular')}" for="star-2"></label> 
       <f:form.radio property="rating" value="2" id="star-1"/> 
       <label title="{f:translate(key: 'tx_fecomments_domain_model_comment.poor')}" for="star-1"></label> 
       <f:form.radio property="rating" value="1" id="star-0"/> 
       <label title="{f:translate(key: 'tx_fecomments_domain_model_comment.bad')}" for="star-0"></label> 
      </div> 
     </div> 
     <div> 
      <f:form.textfield style="height: 100px;" property="text"/> 
      <br> 
      <f:form.submit class="btn btn-primary" value="{f:translate(key: 'tx_fecomments_domain_model_comment.send_comment')}"/> 
     </div> 

    </f:form> 


    /** 
    * @param \MyVendor\Fecomments\Domain\Model\Comment $newComment 
    * @return bool 
    */ 
    public function addCommentAction(\MyVendor\Fecomments\Domain\Model\Comment $newComment) 
    { 
     die(8979); 
} 

「フォームを送信」をクリックしても何も起こりません。どうしてか分かりません。 addCommentアクションが呼び出されないようです。私の他の拡張では、同様のコードが適切に機能します。 「フォームを送信」をクリックすると、次のURLが表示されます。site.en/?showUid=1&tx_fecomments_commentform%5Baction%5D=addComment&tx_fecomments_commentform%5Bcontroller%5D=Comment&cHash=236d87f2ee987ddf7b5720ae5ddc029e

なぜ動作しないのか分かりません。私を助けてください、私は本当に考えがありません。

また、それは私のコメントのモデルです:

namespace MyVendor\Fecomments\Domain\Model; 

use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; 

class Comment extends AbstractEntity { 
    /** 
    * @var string 
    **/ 
    protected $text = ''; 

    /** 
    * user 
    * 
    * @var \Fhk\Feusersplus\Domain\Model\User 
    */ 
    protected $userfrom; 

    /** 
    * user 
    * 
    * @var \Fhk\Feusersplus\Domain\Model\User 
    */ 
    protected $userto; 

    /** 
    * @var int 
    **/ 
    protected $crdate; 

    /** 
    * @var int 
    **/ 
    protected $rating; 

    /** 
    * @param int $userfrom 
    */ 
    public function setUserfrom($userfrom) { 
     $this->userfrom = (int)$userfrom; 
    } 

    /** 
    * @return \Fhk\Feusersplus\Domain\Model\User 
    */ 
    public function getUserfrom() { 
     return $this->userfrom; 
    } 

    /** 
    * @param int $userto 
    */ 
    public function setUserto($userto) { 
     $this->userto = (int)$userto; 
    } 

    /** 
    * @return \Fhk\Feusersplus\Domain\Model\User 
    */ 
    public function getUserto() { 
     return $this->userto; 
    } 

    /** 
    * @param int $crdate 
    */ 
    public function setCrdate($crdate) { 
     $this->userto = (int)$crdate; 
    } 

    /** 
    * @param int $rating 
    */ 
    public function setRating($rating) { 
     $this->rating = (int)$rating; 
    } 

    /** 
    * @return int 
    */ 
    public function getCrdate() { 
     return $this->crdate; 
    } 

    /** 
    * @return int 
    */ 
    public function getRating() { 
     return $this->rating; 
    } 

    /** 
    * @param $text 
    */ 
    public function setText($text) { 
     $this->text = (string)$text; 
    } 

    /** 
    * @return string 
    */ 
    public function getText() { 
     return $this->text; 
    } 
} 
+0

ドメインモデルに別のスニペットを追加してください。フォームの提出が検証の問題で失敗する可能性があります。 – derhansen

+0

モデルにスニペットを追加しました。私はあなたの助けを願っています。本当に私はそれがなぜうまくいかないのか全く考えていない – Mikael

答えて

0

私は私の問題を解決しました。フィールド '評価'はTCAに定義されていません。

関連する問題