Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symfony 4.3 - The child node "db_driver" at path "fos_comment" must be configured. #698

Open
z0om opened this issue Nov 7, 2019 · 4 comments

Comments

@z0om
Copy link

z0om commented Nov 7, 2019

Hello,

I followed your documentation but I have this issue 'The child node "db_driver" at path "fos_comment" must be configured.'

image

What I did.

➡ 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

I inserted this part :
{% include '@FOSComment/Thread/async.html.twig' with {'id': 'foo'} %}

Nothing else, neither make:migration...

Thank for helping

@ishapkin
Copy link

ishapkin commented Dec 7, 2019

Hi! You must created fos_comment.yaml in config/packages and set orm

fos_comment:
    db_driver: orm

@z0om
Copy link
Author

z0om commented Jan 9, 2020

Sorry, I though I have replied.

I have a other issue:
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "fos_comment_get_threads" as such route does not exist.").

@srdjan-martinov
Copy link

srdjan-martinov commented Jan 16, 2020

Route should be set in the routing config file config/routes.yaml

fos_comment_api:
    type: rest
    resource: "@FOSCommentBundle/Resources/config/routing.yml"
    prefix: /api
    defaults: { _format: html }

@z0om
Copy link
Author

z0om commented Jan 18, 2020

Thanks @srdjan-martinov, no more issue but nothing is displayed :(

You can see my code here : https://github.com/z0om/FOSCommentBundle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants