我遵循了您的文档,但出现了以下问题“必须配置路径“ fos_comment”处的子节点“ db_driver”。”
有人成功在此版本的Symfony上使用它吗?
我做了什么。
➡config / config.yaml
framework:
http_method_override: true
translator: ~
fos_comment:
db_driver: orm
class:
model:
comment: App\Entity\Comment
thread: App\Entity\Thread
fos_comment_api:
type: rest
resource: "@FOSCommentBundle/Resources/config/routing.yml"
prefix: /api
defaults: { _format: html }
assetic:
bundles: [ "FOSCommentBundle" ]
➡src / Entity / Comment.php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\CommentBundle\Entity\Comment as BaseComment;
/**
* @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="App\Entity\Thread")
*/
protected $thread;
}
➡src / Entity / Thread.php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use FOS\CommentBundle\Entity\Thread as BaseThread;
/**
* @ORM\Entity
* @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
*/
class Thread extends BaseThread
{
/**
* @var string $id
*
* @ORM\Id
* @ORM\Column(type="string")
*/
protected $id;
}
➡templates / index.html.twig
我插入了这一部分:
{% include '@FOSComment/Thread/async.html.twig' with {'id': 'foo'} %}
没有别的,也没有作:migration。