services:
fooService:
class: \Bar
$foo = $this->get('fooService');
acme_demo.twig.theme_loader:
class: Acme\DemoBundle\Twig\Loader\ThemeTwigLoader
arguments: [@service_container, ...]
tags:
- { name: twig.loader }
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'multiple' => true,
'required' => false,
'class' => 'QFilesBundle:File',
'query_builder' => function($repository) {
$id = $this->news->getId();
// ваш код
},
));
}