symfony and TextMate
Unfortunately, the Symfony bundle for TextMate has been deprecated from the official repository of bundles on the MicroMates website, as the most recent modification to it occurred on the 29th of August, 2007 (r 8062). It can still be relatively easily exported from the repository using the following install method.
Installing Symfony Bundle into TextMate
mkdir -p /Library/Application\ Support/TextMate/Bundles cd /Library/Application\ Support/TextMate/Bundles svn --username anon --password anon export http://svn.textmate.org/trunk/Bundles/PHP\ Symfony.tmbundle@8062
...the TextMate folder could also be found at ~/Library/Application Support/TextMate
Snippets
Criteria
This is a quick way to do criteria lookups.
\$c = new Criteria();
\$c->add(${1}Peer::$2, $3);
\$${1/.*/\L$0/} = ${1}Peer::doSelectOne(\$c);
$0
Commands
Routes
This is a command written in php CLI for textmate, to show your current app's routing rules as a tooltip :
_add this code as /Library/Application Support/symfony.tmbundle/bin/symfony.showroutes.php or in your own bundle_
preg_match ('`^(.+/)apps/([^/]+/).*`i',$_ENV['TM_FILEPATH'],$match);
if ( count($match)==0 )
{
echo "You are not in a Symfony app!";
exit;
}
$app=$match[2];
$root_dir=$match[1];
define('SF_ROOT_DIR', $root_dir);
define('SF_APP', $app);
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG', true);
require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');
$routes=sfRouting::getInstance();
echo 'Routes for app '.$app.' :
';
foreach ( $routes->getRoutes() as $routename=>$params )
{
if ( $routename == 'default' || $routename == 'default_symfony' || $routename == 'default_index' ) continue;
echo ' @'.$routename;
if ( count($params[2])>0 )
{
echo '?'.implode('=X&',$params[2]).'=X';
}
echo ' ('.$params[4]['module'].'/'.$params[4]['action'].')
';
}
Create a new command in symfony bundle (or your own), that saves nothing, inputs none, and output as a tooltip :
${TM_PHP:=php} "$TM_BUNDLE_PATH"/bin/symfony.showroutes.php