$this->forward404Unless($this->vacancy instanceof Vacancy);
Check if user is logged in:
$sf_user->isAuthenticated()
Check if user belongs to a specific group:
$sf_user->hasCredential('admin')
Assuming you’re using Doctrine rather than Propel…
plugins/sfMyAdminThemePlugin
plugins/sfDoctrinePlugin/data/generator/sfDoctrineAdmin/defaultto your new plugin folder - both the skeleton and template directories.
./symfony doctrine-init-admin appname modulename basedOnThisClassDefinition
Example:
./symfony doctrine-init-admin admin sfGuardUser sfGuardUser
generator:
class: sfDoctrineAdminGenerator
param:
model_class: sfGuardUser
theme: mindGymAdmin
sfConfig::get('sf_environment')
$this->forward('default', 'module');
link_to expects an internal URI:
module/action?arg1=val1&arg2=val2
Passing it a routed URL like /foo/bar/baz will not work.
You can find the current internal URI using:
sfRouting::getInstance()->getCurrentInternalUri();
The commonly used
$this->getRequestParameter('blah')
is a shortened version of
$this->getRequest()->getRequestParameter('blah')
All sorts of other goodies are available using $this->getRequest(), including for example:
$this->getRequest()->getPathInfo()
$moduleName = sfContext::getInstance()->getModuleName();
Stylesheets are specified in config/view.yml files. These files can exist globally in config/, at the application level in apps/appname/config, or for individual modules (including plugin modules) under modules/modulename/config. Properties are inherited from the level above, so if you define this in apps/appname/config/view.yml:
default: stylesheets: [reset, main]…all pages will have reset.css and main.css included (in that order). To override this for an individual module (an admin page, perhaps), you can use this magic:
all: stylesheets: [-*, admin]The -* part instructs the view to ignore any stylesheets specified further up the chain. You can also specify the order that stylesheets are included using the ‘position’ attribute. For example:
all:
stylesheets: [-*, admin: { position: last }]