Commit Graph

47663 Commits

Author SHA1 Message Date
Fabien Potencier a66b645681 feature #31466 [Validator] add Validation::createCallable() (janvernieuwe)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Validator] add Validation::createCallable()

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This is an initial PR to check/discuss the implementation of a callable validator.
If there is interest in merging this, I will gladly update the docs and such.

The use case is mainly for validation of console questions, since the default validation has been removed in the latest version and i could not find an easy solution to replace it (if there already is some solution for this, i'm not aware of it) and the question helper uses callables.
This small class allows the standard symfony validators to be used in console questions, or any other location that requires a callable validator.

Example use case:
```php
$io = new SymfonyStyle($input, $output);
$required = new CallableValidator([new NotBlank()]);
$wsdl = $io->ask('Wsdl location (URL or path to file)', null, $required);
```

As said before, this is by no means the final version, but I would like to know if there is interest  in merging this (and receive some feedback about the implementation) before I put any more effort into this.

Commits
-------

2e4f2ac322 [Validator] add Validation::createCallable()
2020-02-04 14:38:26 +01:00
Fabien Potencier 753d4a2639 feature #34747 [Notifier] Added possibility to extract path from provided DSN (espectrio)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Added possibility to extract path from provided DSN

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #34746
| License       | MIT

I'm currently working on Microsoft Teams Webhook Notifier (https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook), and there is no way to provide DSN for it, because of missing parse_url()['path'] option

It looks like
`teams://outlook.office.com/webhook/{uuid}@{uuid}/IncomingWebhook/{id}/{uuid}`
and I'd like to be able to build Notifier Transport endpoint from it

Commits
-------

ab9b49b5c6 [Notifier] Added possibility to extract path from provided DSN
2020-02-04 14:19:51 +01:00
Fabien Potencier 626999c47f feature #35534 [FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase (adrienfr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase

| Q             | A
| ------------- | ---
| Branch?       | 4.4+
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #35510
| License       | MIT
| Doc PR        |

Since 4.4, we have new PHPUnit constraints for the mailer component, but these are only available with `WebTestCase` and not `KernelTestCase`. I think this would be useful to access these constraints from both TestCase.

I don't know if I should move these [tests](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/MailerTest.php) or add new ones only for `KernelTestCase`?

Commits
-------

1b1ab2991a [FrameworkBundle] Use MailerAssertionsTrait in KernelTestCase
2020-02-04 14:16:01 +01:00
Fabien Potencier 7a4637eef9 feature #35590 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

No need to configure the same requirements for `_locale` in all routes any more thanks to the `framework.translator.enabled_locales` config option introduced in #32433.

Commits
-------

5eebd37625 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement
2020-02-04 14:14:04 +01:00
Nicolas Grekas 5eebd37625 [FrameworkBundle] use framework.translator.enabled_locales to build routes' default "_locale" requirement 2020-02-04 14:13:19 +01:00
Fabien Potencier c8725bf198 feature #35167 [Notifier] Remove superfluous parameters in *Message::fromNotification() (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Remove superfluous parameters in *Message::fromNotification()

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Those classes are final so I think we don't need those extra arguments.

Commits
-------

d0dacf51e1 [Notifier] Remove superfluous parameters in *Message::fromNotification()
2020-02-04 14:11:37 +01:00
Fabien Potencier 9b69b08062 feature #35415 Extracted code to expand an URI to `UriExpander` (lyrixx)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Extracted code to expand an URI to `UriExpander`

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

When building a crawler we need to extract and to expand all links on a
web pages.

ATM, we need to create a DomDocument, attach the href, and ask for the
full URL.

This is a bit slow, and unecessary. This is why I extracted the minimal
code to expand the URL to its onw trait for better re-usability.

I benched (a specific part of) my application:

 * before: 2.16ms
 * after: 1.42ms

Commits
-------

0c499c6b35 Extracted code to expand an URI to `UriExpanderTrait`
2020-02-04 14:05:04 +01:00
Grégoire Pineau 0c499c6b35 Extracted code to expand an URI to `UriExpanderTrait` 2020-02-04 14:03:49 +01:00
Jérémy Derussé c226479d5f
[Messenger] Add SQS transport 2020-02-04 11:49:33 +01:00
Fabien Potencier ef30ef55d0 Fix CS 2020-02-04 11:45:13 +01:00
Fabien Potencier e3fa80a514 feature #35485 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY (dunglas)
This PR was squashed before being merged into the 5.1-dev branch (closes #35485).

Discussion
----------

[Messenger] Add support for PostgreSQL LISTEN/NOTIFY

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a
| License       | MIT
| Doc PR        | todo

PostgreSQL comes with a builtin, performant, scalable and transactional pub/sub system called [`LISTEN`/`NOTIFY`](https://www.postgresql.org/docs/current/sql-notify.html).
This PR allows to leverage this mechanism when using the Messenger component with Postgres.

When the Postgres is used, workers are notified in real-time when a message is dispatched.
This reduces the latency, and prevents the worker from executing useless SQL queries. Basically, it allows to switch from a polling-based approach to an event-based one.

This patch can be used with all existing installation of Messenger, as long as the underlying DBMS is Postgres. For many (most ?) projects, it allows to get the benefits of using a queue system such as RabbitMQ or Pulsar without having to introduce new services to monitor, replicate or upgrade.

If PostgreSQL is used, `LISTEN`/`NOTIFY` is used automatically!

That's all!

It's also possible to configure how long the worker must wait for new messages:

```yaml
framework:
    messenger:
        transports:
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    pgsql_get_notify: true
                    pgsql_get_notify_timeout: 500
```

Then you can use start the workers with something like: `php bin/console messenger:consume --sleep=0`

A demo app using this new feature is available in this repository: https://github.com/dunglas/demo-postgres-listen-notify

TODO:

* [ ] Add tests

Commits
-------

01f33c3ab5 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY
2020-02-04 11:44:36 +01:00
Kévin Dunglas 01f33c3ab5 [Messenger] Add support for PostgreSQL LISTEN/NOTIFY 2020-02-04 11:42:42 +01:00
Fabien Potencier 3750988c42 bug #35553 Fix HTTP client config handling (julienfalque)
This PR was merged into the 4.4 branch.

Discussion
----------

Fix HTTP client config handling

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Defining a `key` parameter in the `query` option of a scoped HTTP client triggers an error:
```
Undefined index: value
```
This PR fixes this issue but an edge case still remains with YAML and PHP config. If one wants to define parameters `key=foo`, `value=bar` and nothing else, the query will actually be `foo=bar` instead of `key=foo&value=bar`. Not sure how to fix this case without breaking the tests I added here.

Commits
-------

963d0cce86 Fix HTTP client config handling
2020-02-04 11:40:26 +01:00
Fabien Potencier 9613f84df5 minor #35589 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call (chalasr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Mailer] Fix MandrillHttpTransport::getRecipients()'s call

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Should make the CI green.

Commits
-------

f88d1bb328 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call
2020-02-04 11:37:49 +01:00
Fabien Potencier cf9f5a071c feature #32039 [Cache] Add couchbase cache adapter (ajcerezo)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Cache] Add couchbase cache adapter

| Q             | A
| ------------- | ---
| Branch?       | 4.4 for features
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/32038
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/11748

Add new cache adapter to be able using Couchbase as cache system.

Commits
-------

1ae7dd5ec7 [Cache] Add couchbase cache adapter
2020-02-04 11:36:41 +01:00
Antonio José Cerezo Aranda 1ae7dd5ec7 [Cache] Add couchbase cache adapter 2020-02-04 11:32:31 +01:00
Nicolas Grekas 1e2b88f43e Merge branch '5.0'
* 5.0:
  cs fix
  Escape variable in Exception Template
2020-02-04 11:31:29 +01:00
Nicolas Grekas 244c347178 Merge branch '4.4' into 5.0
* 4.4:
  Escape variable in Exception Template
2020-02-04 11:31:13 +01:00
Robin Chalas f88d1bb328 [Mailer] Fix MandrillHttpTransport::getRecipients()'s call 2020-02-04 11:29:55 +01:00
Fabien Potencier eaec5d67ae bug #35588 [ErrorHandler] Escape variable in Exception template (jderusse)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Escape variable in Exception template

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | /
| License       | MIT
| Doc PR        | /

Commits
-------

629d21b800 Escape variable in Exception Template
2020-02-04 11:28:16 +01:00
Nicolas Grekas 6b18e7007a Merge branch '4.4' into 5.0
* 4.4:
  cs fix
2020-02-04 11:22:37 +01:00
Nicolas Grekas f312e3cda6 Merge branch '3.4' into 4.4
* 3.4:
  cs fix
2020-02-04 11:21:54 +01:00
Fabien Potencier f23aa969f4 feature #32433 [Translation] Introduce a way to configure the enabled locales (javiereguiluz)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Translation] Introduce a way to configure the enabled locales

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #31563
| License       | MIT
| Doc PR        | -

This implements the idea #31563 so we can decide if we want to add this or not. I tested it in the "Symfony Demo" app. Before: 107 catalogs created in cache/dev/translations/. After: 43 catalogs. But that's because the app is translated into lots of languages. In most cases, only 2 catalog files will be generated (vs 107 before).

If this idea is approved, I'll add tests and docs. Thanks.

Commits
-------

765843426e [Translation] Introduce a way to configure the enabled locales
2020-02-04 11:12:18 +01:00
Fabien Potencier 61774e6c07 Fix CS 2020-02-04 11:11:53 +01:00
Fabien Potencier a416a66416 Fix bad merge 2020-02-04 11:11:20 +01:00
Fabien Potencier a841a3e52c Fix CS 2020-02-04 11:10:55 +01:00
Fabien Potencier 2f5047ea3d Merge branch '5.0'
* 5.0:
  Fix bad merge
2020-02-04 11:03:49 +01:00
Fabien Potencier a196d0571d Fix bad merge 2020-02-04 11:03:41 +01:00
Nicolas Grekas c2e0aab7be cs fix 2020-02-04 10:59:34 +01:00
Javier Eguiluz 765843426e [Translation] Introduce a way to configure the enabled locales 2020-02-04 10:57:06 +01:00
Jérémy Derussé 629d21b800
Escape variable in Exception Template 2020-02-04 10:53:50 +01:00
Fabien Potencier d5bbdca755 Merge branch '5.0'
* 5.0:
  Fix CS
  Fix CS
  Fix CS
2020-02-04 10:50:54 +01:00
Fabien Potencier 7322985070 minor #35587 Fix CS (fabpot)
This PR was merged into the 5.0 branch.

Discussion
----------

Fix CS

| Q             | A
| ------------- | ---
| Branch?       | 5.0 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

f64f59a9c0 Fix CS
2020-02-04 10:50:02 +01:00
Fabien Potencier f64f59a9c0 Fix CS 2020-02-04 10:47:34 +01:00
Fabien Potencier bb4e394949 Merge branch '4.4' into 5.0
* 4.4:
  Fix CS
  Fix CS
2020-02-04 10:41:09 +01:00
Fabien Potencier 03181ee843 minor #35586 Fix CS (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

Fix CS

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        |  n/a

Commits
-------

de8348a033 Fix CS
2020-02-04 10:33:59 +01:00
Fabien Potencier de8348a033 Fix CS 2020-02-04 10:32:40 +01:00
Fabien Potencier 3ee39e7468 Merge branch '3.4' into 4.4
* 3.4:
  Fix CS
2020-02-04 10:01:01 +01:00
Fabien Potencier 2e27353a19 minor #35584 Fix CS (fabpot)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix CS

| Q             | A
| ------------- | ---
| Branch?       | 3.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

a3e49f30c7 Fix CS
2020-02-04 09:15:25 +01:00
Fabien Potencier 7784d9fca2 feature #33003 [Filesystem] Add $suffix argument to tempnam() (jdufresne)
This PR was submitted for the 4.4 branch but it was merged into the 5.1-dev branch instead (closes #33003).

Discussion
----------

[Filesystem] Add $suffix argument to tempnam()

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #33002
| License       | MIT
| Doc PR        | symfony/symfony-docs#12108

**Description**

The `tempnam()` interface was previously:

```php
tempnam($dir, $prefix)
```

This adds a third argument, `$suffix`, that is appended to the filename after the random component. This defaults to `''` for backwards compatibility. This is quite useful when the temporary file is consumed for a specific purpose that expects a suffix.

**Example**

```php
$filesystem->tempnam('/tmp', 'prefix_', '.png');
```

Would create a file like: `/tmp/prefix_abcd1234.png`.

Commits
-------

ef1206964e [Filesystem] Add $suffix argument to tempnam()
2020-02-04 09:10:02 +01:00
Jon Dufresne ef1206964e [Filesystem] Add $suffix argument to tempnam()
Fixes #33002
2020-02-04 09:09:47 +01:00
Fabien Potencier a3e49f30c7 Fix CS 2020-02-04 09:04:52 +01:00
Nicolas Grekas 8e22719130 feature #35347 [VarDumper] Add a RdKafka caster (romainneutron)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[VarDumper] Add a RdKafka caster

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

Hello,

This is the very beginning of this new feature.
First, I'd like to know if there's a no-go for this feature so I won't waste my time.
Then, if you are a RdKafka expert, I'd take your comments with much pleasure sincer I'm a noob in this technology (and that's why I'm implementing this caster 🤓)
Tests need to be added once the implementation will be a bit more complete.

Commits
-------

6cd1235539 Add a RdKafka caster to Var-Dumper
2020-02-04 09:00:51 +01:00
Romain Neutron 6cd1235539
Add a RdKafka caster to Var-Dumper 2020-02-04 08:53:38 +01:00
Fabien Potencier c6d0a2a10e Merge branch '5.0'
* 5.0:
  Add missing use statements
  [Translation] Add missing use statement
  [Translation] Add missing use statement
  [Config][XmlReferenceDumper] Prevent potential \TypeError
  [Mailer] Fix broken mandrill http send for recipients with names
  [Translation] prefer intl domain when adding messages to catalogue
  Fix CS
  Fix CS
  Fail on empty password verification (without warning on any implementation)
  [Translation][Debug] Add installation and minimal example to README
  [Validator] try to call __get method if property is uninitialized
  Show both missing packages in the same error message
  Fix handling of empty_data's \Closure value in Date/Time form types
2020-02-04 08:41:44 +01:00
Fabien Potencier 85f793bec6 Merge branch '4.4' into 5.0
* 4.4:
  Add missing use statements
  [Translation] Add missing use statement
  [Translation] Add missing use statement
  [Config][XmlReferenceDumper] Prevent potential \TypeError
  [Mailer] Fix broken mandrill http send for recipients with names
  [Translation] prefer intl domain when adding messages to catalogue
  Fix CS
  Fix CS
  Fail on empty password verification (without warning on any implementation)
  [Translation][Debug] Add installation and minimal example to README
  [Validator] try to call __get method if property is uninitialized
  Show both missing packages in the same error message
  Fix handling of empty_data's \Closure value in Date/Time form types
2020-02-04 08:41:34 +01:00
Fabien Potencier cb16fe7432 Merge branch '3.4' into 4.4
* 3.4:
  [Translation] Add missing use statement
  [Translation][Debug] Add installation and minimal example to README
  [Validator] try to call __get method if property is uninitialized
  Fix handling of empty_data's \Closure value in Date/Time form types
2020-02-04 08:40:16 +01:00
Fabien Potencier 647a6fe9c6 bug #35583 Add missing use statements (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

Add missing use statements

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

cd27b9d06f Add missing use statements
2020-02-04 08:38:29 +01:00
Fabien Potencier cd27b9d06f Add missing use statements 2020-02-04 08:35:15 +01:00
Fabien Potencier ce29631cd8 [Translation] Add missing use statement 2020-02-04 08:22:30 +01:00