2017-02-11 68 views
0

IM安裝​​在我的項目foscomment bundel和IM在git的樞紐提供此bundel文檔以下FOSCommentBundle symfony的3嚴重錯誤

THI是鏈接

documentation git hub

,當我想更新我的數據庫架構這個beatiful execption在我看來

[2017-02-11 17:06:57] php.CRITICAL: Fatal Compile Error: Declaration of Group\GroupBundle\Entity\Comment::setThread() must be compatible with FOS\CommentBundle\Model\CommentInterface::setThread(FOS\CommentBundle\Model\ThreadInterface $thread) {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Compile Error: Declaration of Group\\GroupBundle\\Entity\\Comment::setThread() must be compatible with FOS\\CommentBundle\\Model\\CommentInterface::setThread(FOS\\CommentBundle\\Model\\ThreadInterface $thread) at C:\\wamp\\www\\E-Randopi\\src\\Group\\GroupBundle\\Entity\\Comment.php:18)"} 


[Symfony\Component\Debug\Exception\FatalErrorException]      
Compile Error: Declaration of Group\GroupBundle\Entity\Comment::setThread() 
must be compatible with FOS\CommentBundle\Model\CommentInterface::setThrea 
d(FOS\CommentBundle\Model\ThreadInterface $thread)       


doctrine:schema:update [--complete] [--dump-sql] [-f|--force] [--em [EM]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> 

這是我的錯誤輸出

error

這是我的意見實體

<?php 

namespace Group\GroupBundle\Entity; 

use Doctrine\ORM\Mapping as ORM; 
use FOS\CommentBundle\Entity\Comment as BaseComment; 


/** 
    * Commentaire 
    * 
    * @ORM\Table(name="commentaire") 
    * @ORM\Entity 
    * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT") 

*/ 
class Comment extends BaseComment 
{ 
/** 
* @ORM\Id 
* @ORM\Column(type="integer") 
* @ORM\GeneratedValue(strategy="AUTO") 
*/ 
protected $id; 

/** 
* Thread of this comment 
* 
* @var Thread 
* @ORM\ManyToOne(targetEntity="Group\GroupBundle\Entity\Thread") 
*/ 
protected $thread; 

/** 
* @var string 
* 
* @ORM\Column(name="description", type="string", length=100, nullable=false) 
*/ 
private $description; 

/** 
* @var integer 
* 
* @ORM\Column(name="id_createur", type="integer", nullable=false) 
*/ 
private $idCreateur; 

/** 
* @var integer 
* 
* @ORM\Column(name="id_publication", type="integer", nullable=false) 
*/ 
private $idPublication; 

/** 
* @var string 
* 
* @ORM\Column(name="photo", type="string", length=100, nullable=false) 
*/ 
private $photo; 

/** 
* @var \DateTime 
* 
* @ORM\Column(name="date_commentaire", type="date", nullable=false) 
*/ 
private $dateCommentaire; 

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

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

/** 
* @return Thread 
*/ 
public function getThread() 
{ 
    return $this->thread; 
} 

/** 
* @param Thread $thread 
*/ 
public function setThread($thread) 
{ 
    $this->thread = $thread; 
} 

/** 
* @return string 
*/ 
public function getDescription() 
{ 
    return $this->description; 
} 

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

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

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

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

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

/** 
* @return string 
*/ 
public function getPhoto() 
{ 
    return $this->photo; 
} 

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

/** 
* @return \DateTime 
*/ 
public function getDateCommentaire() 
{ 
    return $this->dateCommentaire; 
} 

/** 
* @param \DateTime $dateCommentaire 
*/ 
public function setDateCommentaire($dateCommentaire) 
{ 
    $this->dateCommentaire = $dateCommentaire; 
} 


} 
+0

Thnks man錯誤消失,但評論輸入未顯示在我的視圖中 –

回答

2

的setThread()方法必須根據FOSCommentBundle這是CommentInterface::setThread()聲明:

/** 
* @param ThreadInterface $thread 
*/ 
public function setThread(ThreadInterface $thread); 

和你Comment::setThread()聲明:

/** 
* @param Thread $thread 
*/ 
public function setThread($thread) 
{ 
    $this->thread = $thread; 
}