Merge branch '4.2' into 4.3
* 4.2: [Lock] fix missing inherit docs in RedisStore fix accessing session bags Add missing rendering of form help block.
This commit is contained in:
commit
2dedf38b55
@ -114,6 +114,7 @@
|
||||
<div class="form-group{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
|
||||
{{- form_label(form) }} {# -#}
|
||||
{{ form_widget(form, widget_attr) }} {# -#}
|
||||
{{- form_help(form) -}}
|
||||
{{ form_errors(form) }} {# -#}
|
||||
</div> {# -#}
|
||||
{%- endblock form_row %}
|
||||
|
@ -253,7 +253,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function getBag($name)
|
||||
{
|
||||
return $this->storage->getBag($name)->getBag();
|
||||
$bag = $this->storage->getBag($name);
|
||||
|
||||
return method_exists($bag, 'getBag') ? $bag->getBag() : $bag;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -15,6 +15,7 @@ use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionBagProxy;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||
|
||||
/**
|
||||
@ -260,4 +261,28 @@ class SessionTest extends TestCase
|
||||
$flash->get('hello');
|
||||
$this->assertTrue($this->session->isEmpty());
|
||||
}
|
||||
|
||||
public function testGetBagWithBagImplementingGetBag()
|
||||
{
|
||||
$bag = new AttributeBag();
|
||||
$bag->setName('foo');
|
||||
|
||||
$storage = new MockArraySessionStorage();
|
||||
$storage->registerBag($bag);
|
||||
|
||||
$this->assertSame($bag, (new Session($storage))->getBag('foo'));
|
||||
}
|
||||
|
||||
public function testGetBagWithBagNotImplementingGetBag()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$bag = new AttributeBag();
|
||||
$bag->setName('foo');
|
||||
|
||||
$storage = new MockArraySessionStorage();
|
||||
$storage->registerBag(new SessionBagProxy($bag, $data, $usageIndex));
|
||||
|
||||
$this->assertSame($bag, (new Session($storage))->getBag('foo'));
|
||||
}
|
||||
}
|
||||
|
@ -71,6 +71,9 @@ class RedisStore implements StoreInterface
|
||||
$this->checkNotExpired($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function waitAndSave(Key $key)
|
||||
{
|
||||
throw new InvalidArgumentException(sprintf('The store "%s" does not supports blocking locks.', \get_class($this)));
|
||||
|
Reference in New Issue
Block a user