首页 > 解决方案 > 未知的“form_start”函数

问题描述

问题的内容 我目前正在努力提高已创建的现有 Web 应用程序的 symfony 版本。当我在浏览器中显示应用程序时,出现错误。我想知道如何解决它。大概,好像是articleAnalyticsSearch的定义目的地的路由不好。提升 symfony 时相应的代码没有改变。

错误信息

Unknown "form_start" function.

源代码

{% macro articleAnalyticsSearch(searchForm) %}
        {{ form_start(searchForm) }}
        {% set params = app.request.query.all|merge({'page': null}) %}
        {% set q = app.request.query.get("q")|default({}) %}
            <table>
//composer.json
{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": { "": "src/" },
        "classmap": [ "vendor/lsolesen/pel/src" , "app/AppKernel.php", "app/AppCache.php" ]
    },
    "repositories": [
        {
            "type": "pear",
            "url": "https://pear.php.net"
        }
    ],
    "require": {
        "php": ">=5.5.9",
        "symfony/symfony": "3.0.*",
        "doctrine/orm": "2.5.*",
        "doctrine/doctrine-bundle": "~1.4",
        "twig/extensions": "1.0.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "3.0.*",
        "sensio/distribution-bundle": "5.0.*",
        "sensio/framework-extra-bundle": "3.0.*",
        "incenteev/composer-parameter-handler": "~2.0",
        "jms/security-extra-bundle": "1.6.*",
        "jms/di-extra-bundle": "1.7.*",
        "lsolesen/pel": "dev-master",
        "gedmo/doctrine-extensions": "2.3.*",
        "shark/simple_html_dom": "dev-master",
        "pear-pear/mail_mimedecode": "1.5.*",
        "rakuten-ws/rws-php-sdk": "1.*",
        "liuggio/excelbundle": "2.1.0",
        "doctrine/annotations": "^1.2",
        "symfony/intl": "3.0.*",
        "symfony/console": "3.0.*",
        "jms/aop-bundle": "1.2.*",
        "symfony/framework-bundle": "3.0.*",
        "symfony/form": "^3.0",
        "symfony/twig-bridge": "^3.0",
        "symfony/translation": "v3.0.9"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
          "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
     ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
       ]
    },
    "config": {
        "bin-dir": "bin",
        "secure-http": false,
        "platform": {
            "php": "5.6.4"
      }
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "3.0-dev"
        }
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    }
}

版本 CentOS 6.7 composer 1.10 symfony 3.0.9 PHP 5.6.40

标签: phpsymfony

解决方案


似乎我遇到了错误,因为我没有将 $ 请求传递给事件侦听器。当我解决它时,错误消失了。


推荐阅读