Skip to content

Instantly share code, notes, and snippets.

@kawahara
Created April 3, 2010 13:38
Show Gist options
  • Save kawahara/354481 to your computer and use it in GitHub Desktop.
Save kawahara/354481 to your computer and use it in GitHub Desktop.
public function retrieveGadgetsByTypesName($typesName)
{
$file = sfConfig::get('sf_app_cache_dir').'/config/'.sfInflector::underscore($typesName)."_gadgets.php";
if (is_readable($file))
{
return include($file);
}
$types = $this->getTypes($typesName);
foreach($types as $type)
{
$results[$type] = $this->retrieveByType($type);
}
file_put_contents($file, "<?php return unserialize('".serialize($results)."');");
return $results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment