Symfony" app_dev.php"缓存未清除

时间:2017-03-20 20:57:52

标签: symfony symfony-cache

我正在使用symfony,并按照有关使用$stmt = $mysqli->prepare("UPDATE staff SET Name= ?, Address= ?, Telephone= ?, BusinessID= ? WHERE StaffID = ?"); $stmt->bind_param( "sssii", $Name, $Address, $Telephone, $BusinessID, $StaffID); $stmt->execute(); 工作的文档而不用担心缓存...但它对我不起作用。我经常被迫使用clear_cache来查看我在树枝模板中的更改!

我的app_dev.php

app_dev.php

任何帮助都将不胜感激。

[编辑]

config.yml:

$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
Debug::enable();

require_once __DIR__.'/../app/AppKernel.php';

$kernel = new AppKernel('dev', true);
//$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

config_dev.yml:

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: services.yml }

framework:
    #esi:             ~
    translator: { fallbacks: [%locale%] }
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation: { enable_annotations: true }
    templating:
        engines: ['twig']
        #assets_version: SomeVersionScheme
    default_locale:  "%locale%"
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
        # handler_id set to null will use default session handler from php.ini
        handler_id:  ~
    fragments:       ~
    http_method_override: true

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    globals:
        prod_server_url: "%prod_server_url%"
        ovh_applicationSecret: "%ovh_applicationSecret%"

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"
        #yui_css:
        #    jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"

# Doctrine Configuration
doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #     path:     "%database_path%"

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        auto_mapping: true

        dql:
            datetime_functions:
                date: DoctrineExtensions\Query\Mysql\Date
                date_format: DoctrineExtensions\Query\Mysql\DateFormat
                dateadd: DoctrineExtensions\Query\Mysql\DateAdd
                datesub: DoctrineExtensions\Query\Mysql\DateSub
                datediff: DoctrineExtensions\Query\Mysql\DateDiff
                day: DoctrineExtensions\Query\Mysql\Day
                dayname: DoctrineExtensions\Query\Mysql\DayName
                dayofweek: DoctrineExtensions\Query\Mysql\DayOfWeek
                dayofyear: DoctrineExtensions\Query\Mysql\DayOfYear
                div: DoctrineExtensions\Query\Mysql\Div
                from_unixtime: DoctrineExtensions\Query\Mysql\FromUnixtime
                last_day: DoctrineExtensions\Query\Mysql\LastDay
                minute: DoctrineExtensions\Query\Mysql\Minute
                now: DoctrineExtensions\Query\Mysql\Now
                month: DoctrineExtensions\Query\Mysql\Month
                monthname: DoctrineExtensions\Query\Mysql\MonthName
                second: DoctrineExtensions\Query\Mysql\Second
                strtodate: DoctrineExtensions\Query\Mysql\StrToDate
                time: DoctrineExtensions\Query\Mysql\Time
                timediff: DoctrineExtensions\Query\Mysql\TimeDiff
                timestampadd: DoctrineExtensions\Query\Mysql\TimestampAdd
                timestampdiff: DoctrineExtensions\Query\Mysql\TimestampDiff
                week: DoctrineExtensions\Query\Mysql\Week
                weekday: DoctrineExtensions\Query\Mysql\WeekDay
                year: DoctrineExtensions\Query\Mysql\Year
                yearweek: DoctrineExtensions\Query\Mysql\YearWeek
                unix_timestamp: DoctrineExtensions\Query\Mysql\UnixTimestamp

            numeric_functions:
                acos: DoctrineExtensions\Query\Mysql\Acos
                asin: DoctrineExtensions\Query\Mysql\Asin
                atan2: DoctrineExtensions\Query\Mysql\Atan2
                atan: DoctrineExtensions\Query\Mysql\Atan
                bit_count: DoctrineExtensions\Query\Mysql\BitCount
                bit_xor: DoctrineExtensions\Query\Mysql\BitXor
                ceil: DoctrineExtensions\Query\Mysql\Ceil
                cos: DoctrineExtensions\Query\Mysql\Cos
                cot: DoctrineExtensions\Query\Mysql\Cot
                floor: DoctrineExtensions\Query\Mysql\Floor
                hour: DoctrineExtensions\Query\Mysql\Hour
                pi: DoctrineExtensions\Query\Mysql\Pi
                power: DoctrineExtensions\Query\Mysql\Power
                quarter: DoctrineExtensions\Query\Mysql\Quarter
                rand: DoctrineExtensions\Query\Mysql\Rand
                round: DoctrineExtensions\Query\Mysql\Round
                stddev: DoctrineExtensions\Query\Mysql\StdDev
                sin: DoctrineExtensions\Query\Mysql\Sin
                std: DoctrineExtensions\Query\Mysql\Std
                tan: DoctrineExtensions\Query\Mysql\Tan

            string_functions:
                ascii: DoctrineExtensions\Query\Mysql\Ascii
                binary: DoctrineExtensions\Query\Mysql\Binary
                char_length: DoctrineExtensions\Query\Mysql\CharLength
                concat_ws: DoctrineExtensions\Query\Mysql\ConcatWs
                countif: DoctrineExtensions\Query\Mysql\CountIf
                crc32: DoctrineExtensions\Query\Mysql\Crc32
                degrees: DoctrineExtensions\Query\Mysql\Degrees
                field: DoctrineExtensions\Query\Mysql\Field
                find_in_set: DoctrineExtensions\Query\Mysql\FindInSet
                group_concat: DoctrineExtensions\Query\Mysql\GroupConcat
                ifelse: DoctrineExtensions\Query\Mysql\IfElse
                ifnull: DoctrineExtensions\Query\Mysql\IfNull
                least: DoctrineExtensions\Query\Mysql\Least
                lpad: DoctrineExtensions\Query\Mysql\Lpad
                match_against: DoctrineExtensions\Query\Mysql\MatchAgainst
                md5: DoctrineExtensions\Query\Mysql\Md5
                nullif: DoctrineExtensions\Query\Mysql\NullIf
                radians: DoctrineExtensions\Query\Mysql\Radians
                regexp: DoctrineExtensions\Query\Mysql\Regexp
                replace: DoctrineExtensions\Query\Mysql\Replace
                rpad: DoctrineExtensions\Query\Mysql\Rpad
                sha1: DoctrineExtensions\Query\Mysql\Sha1
                sha2: DoctrineExtensions\Query\Mysql\Sha2
                soundex: DoctrineExtensions\Query\Mysql\Soundex
                substring_index: DoctrineExtensions\Query\Mysql\SubstringIndex
                uuid_short: DoctrineExtensions\Query\Mysql\UuidShort

# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }
    logging:   true

fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: dm\MembreBundle\Entity\Membre


jms_security_extra:
    secure_all_services: true

knp_snappy:
    pdf:
        enabled:    true
        binary:     wkhtmltopdf
        options:    []
    image:
        enabled:    true
        binary:     wkhtmltoimage
        options:    []


oneup_uploader:
    mappings:
        filesDossier:
            frontend: dropzone
            namer: dm_foad.file_namer
        filesSociete:
            frontend: dropzone
            namer: dm_foad.file_namer

oneup_flysystem:
    adapters:
        mylocal:
            local:
                directory: "%basePath%"
                lazy: ~ # boolean (default "false")
                writeFlags: ~
                linkHandling: ~
                permissions: ~
        myftp:
            ftp:
                host: "%ftp_host%"
                port: "%ftp_port%"
                username: "%ftp_username%"
                password: "%ftp_password%"
                root: "%ftp_root%"
                ssl: "%ftp_ssl%"
                timeout: "%ftp_timeout%"
                permPrivate: "%ftp_permPrivate%"
                permPublic: "%ftp_permPublic%"
                passive: "%ftp_passive%"
        mysftp:
            sftp:
                host: "%sftp_host%"
                port: "%sftp_port%"
                username: "%sftp_username%"
                password: "%sftp_password%"
                root: "%sftp_root%"
                timeout: "%sftp_timeout%"
                permPrivate: "%sftp_permPrivate%"
                permPublic: "%sftp_permPublic%"
                directoryPerm: "%directoryPerm%"
    filesystems:
        mylocalfilesystem:
            adapter: mylocal
        myftpfilesystem:
            adapter: myftp
        mysftpfilesystem:
            adapter: mysftp

2 个答案:

答案 0 :(得分:5)

导航到您的应用配置文件。在树枝配置设置(在树枝下:)你可以设置如下:

twig:
   cache: false

默认设置为%kernel.cache_dir%/twig,可能会帮助您。

答案 1 :(得分:2)

确保仅在dev 环境中禁用缓存

获得此功能的简便方法是创建config_dev.yml,其中只保留dev env

的“覆盖”设置 config.yml

中的

# Twig Configuration
twig:
    #you other twig settings
    cache: true

config_dev.yml中(与config.yml在同一目录中)

# imports settgins from config.yml
imports:
    - { resource: config.yml }

#override 

twig:
    cache: false

这就是全部。 每次使用app_dev.php中的config_dev.yml设置访问您的应用时,都将适用。

注意:您不必将所有设置复制到config_dev,而只需复制您想要覆盖的设置

P.S。模式config_name_<ENV>.yml也适用于其他配置文件,而不仅仅适用于config.yml