We want to show a flash message as the result of executing some controller. This message will only last for the next request.
I propose to use the new addFlash()
method available in the base controller of Symfony 2.6:
private function getAllFormErrors($children, $template = true) { | |
foreach ($children as $child) { | |
if ($child->hasErrors()) { | |
$vars = $child->createView()->getVars(); | |
$errors = $child->getErrors(); | |
foreach ($errors as $error) { | |
$this->allErrors[$vars["name"]][] = $this->convertFormErrorObjToString($error); | |
} | |
} |
<?php | |
require_once '/path/to/lib/Twig/Autoloader.php'; | |
/** | |
* A factory for create Twig instances | |
* | |
* @author Victor Puertas <vpgugr@gmail.com> | |
* | |
* Usage: | |
* <code> |
<?php | |
// Version 1 | |
// Minified | |
// class Dispatch{function add($e,$l){$this->l[$e][]=$l;}function trigger($e,$d){foreach ($this->l[$e] as $l)call_user_func_array($l, $d);}} | |
class Dispatch{ | |
function add($e, $l) { | |
$this->l[$e][] = $l; |
<?php | |
namespace AppBundle\EventListener; | |
use Symfony\Component\HttpFoundation\RedirectResponse; | |
use Symfony\Component\HttpKernel\HttpKernelInterface; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
use Symfony\Component\Routing\Router; | |
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; |
<?php | |
namespace Acme\YourBundle\Serializer; | |
use JMS\Serializer\Context; | |
use JMS\Serializer\JsonSerializationVisitor; | |
use JMS\Serializer\Metadata\ClassMetadata; | |
/* | |
* Copyright 2014 Paul Ferrett <paul@paulferrett.com> |
set :application, "appname" | |
set :deploy_to, "/var/www" | |
set :scm, :git | |
set :repository, "git@github.com:user/app.git" | |
default_run_options[:pty] = true | |
set :user, "www-data" | |
set :domain, "foo.tld" | |
set :normalize_asset_timestamps, false |
<?php | |
namespace Chyrius\SiteBundle\Form; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
use Symfony\Component\Form\Form; | |
/** | |
* @todo Обрабатывать так же ошибки детей-детей | |
*/ | |
class FormErrors |
*.php filter=subvars |
<?php | |
namespace Silex\Provider; | |
use Silex\Application; | |
use Silex\SilexEvents; | |
use Silex\ControllerProviderInterface; | |
use Silex\ControllerCollection; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; |