symfonysymfony-cache

Symfony "app_dev.php" cache not clearing


I'm working with symfony and followed the doc about using app_dev.php to work without worrying about the cache... But it doesn't work for me. I'm often forced to clear_cache to see my changes in twig templates !

My app_dev.php :

$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);

Any help would be appreciated.

[EDIT]

config.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

config_dev.yml :

imports:
    - { resource: config.yml }

framework:
    router:
        resource: "%kernel.root_dir%/config/routing_dev.yml"
        strict_requirements: true
    profiler: { only_exceptions: false }

web_profiler:
    toolbar: true
    intercept_redirects: false

monolog:
    handlers:
        main:
            type:  stream
            path:  "%kernel.logs_dir%/%kernel.environment%.log"
            level: debug
        firephp:
            type:  firephp
            level: info
        chromephp:
            type:  chromephp
            level: info

assetic:
    use_controller: true

Solution

  • Navigate to your app config file. In twig configuration settings (under twig:) you can set as below:

    twig:
       cache: false
    

    It is default set to %kernel.cache_dir%/twig, May be it will help you.