我尝试安装捆绑:KnpLabs / KnpMarkdownBundle但我有这个错误:
InvalidArgumentException: The service definition "my.markdown.parser" does not exist.
这是一部分要求:
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "1.3.*@dev",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"jms/di-extra-bundle": "dev-master",
"doctrine/doctrine-fixtures-bundle": "2.2.*@dev",
"doctrine/data-fixtures": "1.0.*@dev",
"stof/doctrine-extensions-bundle": "~1.1@dev",
"knplabs/knp-markdown-bundle": "~1.3"
和appkernel的部分:
$bundles = array(
//....
new JMS\DiExtraBundle\JMSDiExtraBundle($this),
new JMS\AopBundle\JMSAopBundle(),
new Knp\Bundle\MarkdownBundle\KnpMarkdownBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
);
这是我使用捆绑包的部分:
<i>Le {{ article.date|date('d/m/Y') }}, par {{ article.auteur|markdown }}.</i>
{# On affiche les Competence éventuelles #}
{% if article.articleCompetences.count > 0 %}
<i>
Competences :
{% for categorie in article.articleCompetences %}
{{ categorie.competence.nom }}{% if not loop.last %}, {% endif %}
{% endfor %}
</i>
{% endif %}
答案 0 :(得分:0)
除非您打算将捆绑包配置为使用自己的解析器实现,否则不应该将其添加到您的捆绑包中。
knp_markdown:
parser:
service: my.markdown.parser
只需删除它,我认为默认情况下它将使用Knp\Bundle\MarkdownBundle\Parser\MarkdownParser
解析器。