Code snippets for symfony 1.x


Snippets by user Damien ALEXANDRE

Get the actual version of Doctrine Migration

$migration_path = sfConfig::get('sf_lib_dir').DIRECTORY_SEPARATOR.'migration'.DIRECTORY_SEPARATOR.'doctrine';
    $doctrine_migration = new Doctrine_Migration($migration_path);
    $this->migration_current_version = $doctrine_migration->getCurrentVersion();
    $this->migration_latest_version  = $doctrine_migration->getLatestVersion();

Allow you to check if the database actually need to be migrated.

by Damien ALEXANDRE on 2010-11-19, tagged doctrine  migration  migrationversion 

Clear the cache without symfony cli and cross applications

Just use the '**' pattern with sfFileCache :

$frontend_cache_dir = sfConfig::get('sf_cache_dir').'/frontend/prod/template';
$cache = new sfFileCache(array('cache_dir' => $frontend_cache_dir)); // Use the same settings as the ones defined in the frontend factories.yml
$cache->removePattern('**'); // remove everything in the dir
by Damien ALEXANDRE on 2009-10-09, tagged cache  clear 
(1 comment)