In order to have the dump() function always available when running any PHP code, you can install it globally on your computer:
- Run composer global require symfony/var-dumper;
- Add auto_prepend_file = ${HOME}/.composer/vendor/autoload.php to your php.ini file;
- From time to time, run composer global update to have the latest bug fixes.
$process->run();
$process->mustRun();
php -i
в консоле и так:$process = new \Symfony\Component\Process\Process("php -i");
$process->run();
return new Response($process->getOutput());
/**
* @Route("/cpanel/{p}", defaults={"p" = "start"})
* @Template()
*/
public function cpanelAction($p=null, Request $r){
return array("p"=>$p);
}
class SomeService
/**
* @var \Symfony\Bundle\FrameworkBundle\Templating\EngineInterface
*/
private $templating;
public function __construct(EngineInterface $templating)
{
$this->templating = $templating;
}
public function doSome()
{
$template = $this->templating->render('AppBundle::foo.html.twig', array(
'foo' => 'bar'
));
}
services:
app.service.foo:
class: %app.service.foo.class%
arguments:
- @templating
entity_managers:
default:
dql:
string_functions:
GROUP_CONCAT: DoctrineExtensions\Query\Mysql\GroupConcat
symfony.com/doc/current/cookbook/controller/servic...
В настройках роута надо заменитьdefaults: { _controller: TestTestBundle:Test:index }
наdefaults: { _controller: test:indexAction }
$builder
->add(
$builder->create('destination', 'text', array(
'attr' => array(
'class' => 'select_station'
)
))
->addModelTransformer(new EntityToStringTransformer(
$options['em'],
'Acme\DemoBundle\Entity\Station',
'id'
)
)
)
;
$(window).bind('statechange', function () {
var State = History.getState();
var url = State.url;
var data = State.data;
if (ajaxRequest) {
ajaxRequest.abort();
} else {
$resultContainer.html('<div class="ajax-loader" style="position:relative;"><img src="http://i.imgur.com/6RMhx.gif" /></div>');
}
ajaxRequest = $.ajax({
url: url,
data: data,
dataType: 'json',
success: function (data, textStatus, jqXHR) {
$resultContainer.html(data.content);
if (data.form) {
$filterForm.html(data.form);
filterFormInitCallback();
}
ajaxRequest = null;
},
error: function (jqXHR, textStatus, errorThrown) {
if ('abort' != textStatus) {
document.location.href = url;
}
return false;
}
});
});
$filterForm.submit(function () {
var query = $(this).formSerialize();
// decodeURIComponent т.к. formSerialize выдает закодированный урл, а histoty.js пытается закодировать его еще раз
History.pushState(null, document.title, '?' + window.decodeURIComponent(query));
return false;
});
defaults: { _controller: TestTestBundle:Test:index }
defaults: { _controller: test:indexAction }