Skip to content

Instantly share code, notes, and snippets.

@npotier
Last active March 21, 2019 12:15
Show Gist options
  • Save npotier/5732b6311d2baf95c0e6d5dd7fdeb93f to your computer and use it in GitHub Desktop.
Save npotier/5732b6311d2baf95c0e6d5dd7fdeb93f to your computer and use it in GitHub Desktop.
PHP Convert XML to array
<?php
// This code show how you can easily convert a XML file to an associative array
// var_dump(
// json_decode(
// json_encode(
// simplexml_load_string(
// file_get_contents(
// "https://gist.githubusercontent.com/npotier/5732b6311d2baf95c0e6d5dd7fdeb93f/raw/f6c751f85ad6e646c6f89c81a5ee3a8d452151f5/sample.atom"
// )
// )
// ), true)
//);'
// it can be wrapped in a function
function convertXMLToArray(string $xmlUrl) {
return json_decode(
json_encode(
simplexml_load_string(
file_get_contents(
$xmlUrl
)
)
), true
);
}
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
<id>tag:github.com,2008:/symfony/symfony/commits/master</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commits/master"/>
<link type="application/atom+xml" rel="self" href="https://github.com/symfony/symfony/commits/master.atom"/>
<title>Recent Commits to symfony:master</title>
<updated>2019-03-20T20:49:31Z</updated>
<entry>
<id>tag:github.com,2008:Grit::Commit/af28965c24873dceb4c4c2bdfa2633345f7b5a1c</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/af28965c24873dceb4c4c2bdfa2633345f7b5a1c"/>
<title>
fixed encoder in Mime
</title>
<updated>2019-03-20T20:49:31Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;fixed encoder in Mime&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/fc826aac4ce24c366198d8aa8430ee54fc3d6afc</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/fc826aac4ce24c366198d8aa8430ee54fc3d6afc"/>
<title>
feature #30508 [Routing] Exposed &quot;utf8&quot; option, defaults &quot;locale&quot; and…
</title>
<updated>2019-03-20T15:17:03Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;feature #30508 [Routing] Exposed &amp;quot;utf8&amp;quot; option, defaults &amp;quot;locale&amp;quot; and &amp;quot;format&amp;quot; in configuration (Jules Pietri)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Routing] Exposed &amp;quot;utf8&amp;quot; option, defaults &amp;quot;locale&amp;quot; and &amp;quot;format&amp;quot; in configuration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | symfony/symfony-docs#11126
A sibling to #30501, everything is in the title :).
Commits
-------
2911490c80 [Routing] Exposed &amp;quot;utf8&amp;quot; option, defaults &amp;quot;locale&amp;quot; and &amp;quot;format&amp;quot; in configuration&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/2911490c80d265e69b81c8342e79dcc03b56a3d4</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/2911490c80d265e69b81c8342e79dcc03b56a3d4"/>
<title>
[Routing] Exposed &quot;utf8&quot; option, defaults &quot;locale&quot; and &quot;format&quot; in co…
</title>
<updated>2019-03-20T14:57:56Z</updated>
<media:thumbnail height="30" width="30" url="https://1.gravatar.com/avatar/64758fcaf553947009c840cdc1db1b90?d=https%3A%2F%2Fgithub.githubassets.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png&amp;r=g&amp;s=30"/>
<author>
<name></name>
<email>jules@heahprod.com</email>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;[Routing] Exposed &amp;quot;utf8&amp;quot; option, defaults &amp;quot;locale&amp;quot; and &amp;quot;format&amp;quot; in configuration&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/1479a26a0b38dbbefd2476735f18da6b5e0404b8</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/1479a26a0b38dbbefd2476735f18da6b5e0404b8"/>
<title>
feature #28920 [EventDispatcher] swap arguments of dispatch() to allo…
</title>
<updated>2019-03-20T12:34:13Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;feature #28920 [EventDispatcher] swap arguments of dispatch() to allow registering events by FQCN (nicolas-grekas)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[EventDispatcher] swap arguments of dispatch() to allow registering events by FQCN
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
PR green and ready. From UPGRADE files:
EventDispatcher
---------------
* The signature of the `EventDispatcherInterface::dispatch()` method should be updated to `dispatch($event, string $eventName = null)`, not doing so is deprecated
HttpKernel
----------
* Renamed `FilterControllerArgumentsEvent` to `ControllerArgumentsEvent`
* Renamed `FilterControllerEvent` to `ControllerEvent`
* Renamed `FilterResponseEvent` to `ResponseEvent`
* Renamed `GetResponseEvent` to `RequestEvent`
* Renamed `GetResponseForControllerResultEvent` to `ViewEvent`
* Renamed `GetResponseForExceptionEvent` to `ExceptionEvent`
* Renamed `PostResponseEvent` to `TerminateEvent`
Security
---------
* The `ListenerInterface` is deprecated, turn your listeners into callables instead.
* The `Firewall::handleRequest()` method is deprecated, use `Firewall::callListeners()` instead.
Commits
-------
75369dabb8 [EventDispatcher] swap arguments of dispatch() to allow registering events by FQCN&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/81bf2abf191e436ebf8d29980c07779f2c076b86</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/81bf2abf191e436ebf8d29980c07779f2c076b86"/>
<title>
feature #30605 [Cache] added DSN support for rediss in AbstractAdapte…
</title>
<updated>2019-03-20T11:35:16Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;feature #30605 [Cache] added DSN support for rediss in AbstractAdapter and RedisTrait (alex-vasilchenko-md)
This PR was squashed before being merged into the 4.3-dev branch (closes #30605).
Discussion
----------
[Cache] added DSN support for rediss in AbstractAdapter and RedisTrait
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/30573
| License | MIT
A fix for this issue: https://github.com/symfony/symfony/issues/30573
Support for &amp;quot;rediss:&amp;quot; in DSN added.
Commits
-------
7e2852dd44 [Cache] added DSN support for rediss in AbstractAdapter and RedisTrait&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/7e2852dd4466e7de83e80d746fb5e07584e4b221</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/7e2852dd4466e7de83e80d746fb5e07584e4b221"/>
<title>
[Cache] added DSN support for rediss in AbstractAdapter and RedisTrait
</title>
<updated>2019-03-20T11:35:07Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars0.githubusercontent.com/u/36757942?s=30&amp;v=4"/>
<author>
<name>alex-vasilchenko-md</name>
<uri>https://github.com/alex-vasilchenko-md</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;[Cache] added DSN support for rediss in AbstractAdapter and RedisTrait&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/2278d4c52b34fdafcc2b305a2380506e633fb532</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/2278d4c52b34fdafcc2b305a2380506e633fb532"/>
<title>
minor #30611 throw TypeErrors to prepare for type hints in 5.0 (xabbuh)
</title>
<updated>2019-03-20T07:28:49Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;minor #30611 throw TypeErrors to prepare for type hints in 5.0 (xabbuh)
This PR was merged into the 4.3-dev branch.
Discussion
----------
throw TypeErrors to prepare for type hints in 5.0
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
10afb99e3f throw TypeErrors to prepare for type hints in 5.0&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/83ff914b25fbd19b4cd937b9e365be262829cb20</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/83ff914b25fbd19b4cd937b9e365be262829cb20"/>
<title>
bug #30612 [FrameworkBundle] fix max host connections option for XML …
</title>
<updated>2019-03-20T07:26:26Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;bug #30612 [FrameworkBundle] fix max host connections option for XML configs (xabbuh)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[FrameworkBundle] fix max host connections option for XML configs
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
3378f5e9a1 fix max host connections option for XML configs&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/3378f5e9a1aa17b13f6655d4f099d20dde33222f</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/3378f5e9a1aa17b13f6655d4f099d20dde33222f"/>
<title>
fix max host connections option for XML configs
</title>
<updated>2019-03-19T21:31:07Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/1957048?s=30&amp;v=4"/>
<author>
<name>xabbuh</name>
<uri>https://github.com/xabbuh</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;fix max host connections option for XML configs&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/10afb99e3f65f43cec02a0d01b83f8de95a0f007</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/10afb99e3f65f43cec02a0d01b83f8de95a0f007"/>
<title>
throw TypeErrors to prepare for type hints in 5.0
</title>
<updated>2019-03-19T21:12:04Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/1957048?s=30&amp;v=4"/>
<author>
<name>xabbuh</name>
<uri>https://github.com/xabbuh</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;throw TypeErrors to prepare for type hints in 5.0&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/d5d1b50cf7bf769d7ac1eea746561dc55223f7c6</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/d5d1b50cf7bf769d7ac1eea746561dc55223f7c6"/>
<title>
feature #30604 [HttpClient] add MockHttpClient (nicolas-grekas)
</title>
<updated>2019-03-19T18:41:07Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;feature #30604 [HttpClient] add MockHttpClient (nicolas-grekas)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] add MockHttpClient
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR introduces `MockHttpClient` and `MockResponse`, to be used for testing classes that need an HTTP client without making actual HTTP requests.
`MockHttpClient` is configured via its constructor: you provide it either with an iterable or a callable, and these will be used to provide responses as the consumer requests them.
Example:
```php
$responses = [
new MockResponse($body1, $info1),
new MockResponse($body2, $info2),
];
$client = new MockHttpClient($responses);
$response1 = $client-&amp;gt;request(...); // created from $responses[0]
$response2 = $client-&amp;gt;request(...); // created from $responses[1]
```
Or alternatively:
```php
$callback = function ($method, $url, $options) {
return new MockResponse(...);
};
$client = new MockHttpClient($callback);
$response = $client-&amp;gt;request(...); // calls $callback internal
```
The responses provided to the client don&amp;#39;t have to be instances of `MockResponse` - any `ResponseInterface` works (e.g. `$this-&amp;gt;getMockBuilder(ResponseInterface::class)-&amp;gt;getMock()`).
Using `MockResponse` allows simulating chunked responses and timeouts:
```php
$body = function () {
yield &amp;#39;hello&amp;#39;;
yield &amp;#39;&amp;#39;; // the empty string is turned into a timeout so that they are easy to test
yield &amp;#39;world&amp;#39;;
};
$mockResponse = new Mockresponse($body);
```
Last but not least, the implementation simulates the full lifecycle of a properly behaving `HttpClientInterface` contracts implementation: error handling, progress function, etc. This is &amp;quot;proved&amp;quot; by `MockHttpClientTest`, who implements and passes the reference test suite in `HttpClientTestCase`.
Commits
-------
8fd7584158 [HttpClient] add MockHttpClient&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/8fd7584158a39a52ed8dfb9f22e1696208a9755f</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/8fd7584158a39a52ed8dfb9f22e1696208a9755f"/>
<title>
[HttpClient] add MockHttpClient
</title>
<updated>2019-03-19T18:38:55Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars2.githubusercontent.com/u/243674?s=30&amp;v=4"/>
<author>
<name>nicolas-grekas</name>
<uri>https://github.com/nicolas-grekas</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;[HttpClient] add MockHttpClient&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/72fa2b3b2af2c9dec02b77804c7b1ff67143517d</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/72fa2b3b2af2c9dec02b77804c7b1ff67143517d"/>
<title>
feature #21035 [FrameworkBundle] Deprecate the Templating component i…
</title>
<updated>2019-03-19T18:24:43Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;feature #21035 [FrameworkBundle] Deprecate the Templating component integration (dunglas, fabpot)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[FrameworkBundle] Deprecate the Templating component integration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
This PR deprecates the Templating component integration in FrameworkBundle. Only a few people use it because almost everybody use Twig or the serializer to output data. Removing this component will facilitate the maintenance.
Commits
-------
7169f4d3e2 [Templating] added more deprecation
224c891e10 [FrameworkBundle] Deprecate the Templating component integration&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/7169f4d3e27b0365123af2dc7244c14fab167b9d</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/7169f4d3e27b0365123af2dc7244c14fab167b9d"/>
<title>
[Templating] added more deprecation
</title>
<updated>2019-03-19T17:56:32Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;[Templating] added more deprecation&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/224c891e10f53757e4669f674d160edccbb90790</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/224c891e10f53757e4669f674d160edccbb90790"/>
<title>
[FrameworkBundle] Deprecate the Templating component integration
</title>
<updated>2019-03-19T17:23:24Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars0.githubusercontent.com/u/57224?s=30&amp;v=4"/>
<author>
<name>dunglas</name>
<uri>https://github.com/dunglas</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;[FrameworkBundle] Deprecate the Templating component integration&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/b315c638d543e13998365f1c388f4d6e243a7dd9</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/b315c638d543e13998365f1c388f4d6e243a7dd9"/>
<title>
minor #30608 [TwigBundle] Simplify code (fabpot)
</title>
<updated>2019-03-19T17:22:55Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;minor #30608 [TwigBundle] Simplify code (fabpot)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[TwigBundle] Simplify code
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no &amp;lt;!-- don&amp;#39;t forget to update src/**/CHANGELOG.md files --&amp;gt;
| BC breaks? | no &amp;lt;!-- see https://symfony.com/bc --&amp;gt;
| Deprecations? | no &amp;lt;!-- don&amp;#39;t forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --&amp;gt;
| Tests pass? | yes &amp;lt;!-- please add some, will be required by reviewers --&amp;gt;
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
&amp;lt;!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
--&amp;gt;
Commits
-------
4d6967e756 [TwigBundle] simplified code&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/4d6967e7564bdcf97731e19c9852da3f43155bad</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/4d6967e7564bdcf97731e19c9852da3f43155bad"/>
<title>
[TwigBundle] simplified code
</title>
<updated>2019-03-19T17:08:47Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;[TwigBundle] simplified code&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/bff9e68bb448ca7f7da5365b4d733acfedba87dd</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/bff9e68bb448ca7f7da5365b4d733acfedba87dd"/>
<title>
feature #30567 [HttpClient] exceptions carry response (antonch1989)
</title>
<updated>2019-03-19T07:49:53Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars1.githubusercontent.com/u/47313?s=30&amp;v=4"/>
<author>
<name>fabpot</name>
<uri>https://github.com/fabpot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;feature #30567 [HttpClient] exceptions carry response (antonch1989)
This PR was squashed before being merged into the 4.3-dev branch (closes #30567).
Discussion
----------
[HttpClient] exceptions carry response
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no &amp;lt;!-- see https://symfony.com/bc --&amp;gt;
| Deprecations? | no
| Tests pass? | yes &amp;lt;!-- please add some, will be required by reviewers --&amp;gt;
| Fixed tickets | #30502
| License | MIT
| Doc PR |
Commits
-------
103448cc67 [HttpClient] exceptions carry response&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/103448cc672d81f7914049d0e0a78e0b172a7bc4</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/103448cc672d81f7914049d0e0a78e0b172a7bc4"/>
<title>
[HttpClient] exceptions carry response
</title>
<updated>2019-03-19T07:49:42Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars2.githubusercontent.com/u/8297194?s=30&amp;v=4"/>
<author>
<name>antonch1989</name>
<uri>https://github.com/antonch1989</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;[HttpClient] exceptions carry response&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/b15eee97b4c3467caa2d674ec12dca2d5465e17e</id>
<link type="text/html" rel="alternate" href="https://github.com/symfony/symfony/commit/b15eee97b4c3467caa2d674ec12dca2d5465e17e"/>
<title>
feature #28849 [Messenger] Support for handling messages after curren…
</title>
<updated>2019-03-19T05:36:52Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars3.githubusercontent.com/u/804625?s=30&amp;v=4"/>
<author>
<name>sroze</name>
<uri>https://github.com/sroze</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;feature #28849 [Messenger] Support for handling messages after current bus is finished (Nyholm)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Messenger] Support for handling messages after current bus is finished
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/10015
This is a replacement for #27844. We achieve the same goals without introducing the new concept of &amp;quot;recorder&amp;quot;.
```php
class CreateUserHandler
{
private $em;
private $eventBus;
public function __construct(MessageBus $eventBus, EntityManagerInterface $em)
{
$this-&amp;gt;eventBus = $eventBus;
$this-&amp;gt;em = $em;
}
public function __invoke(CreateUser $command)
{
$user = new User($command-&amp;gt;getUuid(), $command-&amp;gt;getName(), $command-&amp;gt;getEmail());
$this-&amp;gt;em-&amp;gt;persist($user);
$message = new UserCreatedEvent($command-&amp;gt;getUuid();
$this-&amp;gt;eventBus-&amp;gt;dispatch((new Envelope($message))-&amp;gt;with(new DispatchAfterCurrentBus()));
}
}
```
Note that this `DispatchAfterCurrentBusMiddleware` is added automatically as the first middleware.
2019-03-13: I updated the PR description.
Commits
-------
903355fbcc Support for handling messages after current bus is finished&lt;/pre&gt;
</content>
</entry>
</feed>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment