<p dir="auto">from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="8056737" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/5895" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/5895/hovercard" href="https://github.com/symfony/symfony/pull/5895">#5895</a>:</p>
<p dir="auto">"<br>
After discussion with <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Crell/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Crell">@Crell</a>, we agreed that the RequestContext is a burden in reusing the routing component. That's because it only duplicates information of the Request and is not really useful without it anyway. Since we probably cannot remove it fully as it would be a big BC break, my idea is to make it optional. So the symfony generator and matcher both work with a RequestContext and a Request. I removed the RequestContextAwareInterface from the interfaces so a custom router does not need a RequestContext anymore. The default symfony generator/matcher still implements RequestContextAwareInterface but can also work with a Request. So UrlMatcher::match(Request) is now also possible. And the generator can use UrlGenerator::setRequest() instead of setContext().</p>
<p dir="auto">I think it makes the routing more useable in symfony and more reusable for other libraries.<br>
And it will probably make it easier to integrate content negotiation as matching a request directly with all it's metadata (like Accept header) is now possible.</p>
<p dir="auto">One more point: symfony allowed to use matching a Request with <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="4676965" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/4363" data-hovercard-type="pull_request" data-hovercard-url="/symfony/symfony/pull/4363/hovercard" href="https://github.com/symfony/symfony/pull/4363">#4363</a>. But it's not integrated in symfony as symfonys router does not use it at all. And the important interfaces like the RouterInterface required the RequestContext anyway. So there was no way to use Request matching without RequestContext. This PR replaces the other extension point.</p>
<p dir="auto">The only bc break is in terms of interfaces. People should be aware that RequestContextAwareInterface is not part of UrlGeneratorInterface/UrlMatcherInterface/RouterInterface anymore. And the RequestMatcherInterface was changed.<br>
"</p>
<p dir="auto">Hi,</p>
<p dir="auto">I use a <code class="notranslate">collection</code> type with <em>prototype = true</em>  to add/remove items.<br>
It works pretty fine but I got a notice error when I add a new item and I save the whole form :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Notice: Undefined index: 2 .../PropertyPath.php on line 283"><pre class="notranslate"><code class="notranslate">Notice: Undefined index: 2 .../PropertyPath.php on line 283
</code></pre></div>
<p dir="auto">This index is the index of the added item. I fixed this notice by addding a test in the <code class="notranslate">readProperty()</code> method (line 283) as <code class="notranslate">$object</code> should be an <code class="notranslate">ArrayAccess</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="if ($object-&gt;offsetExists($property)) {
    return $object[$property];
}"><pre class="notranslate"><code class="notranslate">if ($object-&gt;offsetExists($property)) {
    return $object[$property];
}
</code></pre></div>
<p dir="auto">I don't get any side effects for the moment.</p>
<p dir="auto"><strong>Note:</strong> I'm using Propel.<br>
The <code class="notranslate">PropelCollection</code> implements <code class="notranslate">ArrayAccess</code> so I don't know why I get this notice (which only appears when I add a new item).</p>
<p dir="auto">Regards,<br>
William.</p>