Skip to content

Commit

Permalink
Merge 4.x into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Apr 25, 2023
2 parents bbdb886 + 7e887ff commit 4abb660
Show file tree
Hide file tree
Showing 55 changed files with 318 additions and 448 deletions.
9 changes: 6 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Closes #{put_issue_number_here}.

<!-- MANDATORY
Fill the changelog part inside the code block.
Follow this schema: http://keepachangelog.com/
Follow this schema: https://keepachangelog.com/
This will end up on https://github.com/sonata-project/SonataMediaBundle/releases,
please keep it short and clear and to the point
-->
Expand All @@ -34,10 +34,13 @@ Closes #{put_issue_number_here}.
(eg. update to docs, tests)
-->

<!-- REMOVE EMPTY SECTIONS -->
<!-- REMOVE EMPTY SECTIONS
- Don't repeat the verb in the messages (don't use "Added", "Changed", etc).
- Don't use a full stop at the end of the messages.
-->
```markdown
### Added
- Added some `Class::newMethod()` to do great stuff.
- Some `Class::newMethod()` to do great stuff

### Changed

Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ jobs:
dependencies: lowest
allowed-to-fail: false
variant: normal
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 4.4.*
variant: symfony/symfony:"4.4.*"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
Expand All @@ -79,10 +74,6 @@ jobs:
- name: Add PHPUnit matcher
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Use older Flex endpoint for Symfony 4.4
if: matrix.symfony-require == '4.4.*'
run: composer config extra.symfony.endpoint https://raw.githubusercontent.com/symfony/recipes/c8d90298241f176a261dadc4814d7058415a4c1f/index.json

- name: Globally install symfony/flex
if: matrix.symfony-require != ''
run: |
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.8.1](https://github.com/sonata-project/SonataMediaBundle/compare/4.8.0...4.8.1) - 2023-04-25
### Fixed
- [[#2384](https://github.com/sonata-project/SonataMediaBundle/pull/2384)] `sonata.media.metadata.amazon` is removed from the container if the configuration for S3 is not enabled ([@jordisala1991](https://github.com/jordisala1991))

## [4.8.0](https://github.com/sonata-project/SonataMediaBundle/compare/4.7.1...4.8.0) - 2023-04-24
### Removed
- [[#2382](https://github.com/sonata-project/SonataMediaBundle/pull/2382)] Support for Symfony 4.4 ([@jordisala1991](https://github.com/jordisala1991))
- [[#2382](https://github.com/sonata-project/SonataMediaBundle/pull/2382)] Support for Twig 2 ([@jordisala1991](https://github.com/jordisala1991))

## [4.7.1](https://github.com/sonata-project/SonataMediaBundle/compare/4.7.0...4.7.1) - 2023-04-12
### Changed
- [[#2364](https://github.com/sonata-project/SonataMediaBundle/pull/2364)] Italian translations updated (missing keys, keys ordering) ([@gremo](https://github.com/gremo))

### Fixed
- [[#2363](https://github.com/sonata-project/SonataMediaBundle/pull/2363)] `gallery_item` translation key (english) ([@gremo](https://github.com/gremo))
- [[#2379](https://github.com/sonata-project/SonataMediaBundle/pull/2379)] ORM schema mapping does not give errors about validation root ([@jordisala1991](https://github.com/jordisala1991))
- [[#2374](https://github.com/sonata-project/SonataMediaBundle/pull/2374)] Deprecation for boolean field on MongoDB ODM ([@jordisala1991](https://github.com/jordisala1991))

## [4.7.0](https://github.com/sonata-project/SonataMediaBundle/compare/4.6.0...4.7.0) - 2023-03-09
### Added
- [[#2360](https://github.com/sonata-project/SonataMediaBundle/pull/2360)] Added support for `knplabs/gaufrette` ^0.11. ([@jordisala1991](https://github.com/jordisala1991))
Expand Down
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ you using the latest patch version?

GitHub Issues is for **issues**, as opposed to question on how to use Sonata.
If you are not sure this is a bug, or simply want to ask such a question,
please post your question on [Stack Overflow](http://stackoverflow.com/questions/tagged/sonata),
please post your question on [Stack Overflow](https://stackoverflow.com/questions/tagged/sonata),
using the `sonata` tags.

If you happen to find a bug, we kindly request you report it. However,
Expand Down Expand Up @@ -79,11 +79,11 @@ But please, read the following before.

#### Coding style

Each project follows [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/)
and [Symfony Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html) for coding style,
[PSR-4](http://www.php-fig.org/psr/psr-4/) for autoloading.
Each project follows [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/)
and [Symfony Coding Standards](https://symfony.com/doc/current/contributing/code/standards.html) for coding style,
[PSR-4](https://www.php-fig.org/psr/psr-4/) for autoloading.

Please [install PHP Coding Standard Fixer](http://cs.sensiolabs.org/#installation)
Please [install PHP Coding Standard Fixer](https://cs.symfony.com/#installation)
and run this command before committing your modifications:

```bash
Expand Down Expand Up @@ -207,13 +207,13 @@ Your note can be put on one of these sections:
* `Fixed` for any bug fixes.
* `Security` to invite users to upgrade in case of vulnerabilities.

More information about the followed changelog format: [keepachangelog.com](http://keepachangelog.com/)
More information about the followed changelog format: [keepachangelog.com](https://keepachangelog.com/)

#### Base branch

Before writing a PR, you have to check on which branch your changes SHOULD be based.

Each project follows [semver](http://semver.org/) convention for release management.
Each project follows [semver](https://semver.org/) convention for release management.

Here is a short table resuming on which you have to start:

Expand Down Expand Up @@ -329,7 +329,7 @@ If the deprecated thing is a service, you **MUST** specify it on the service def
</service>
```

More info: http://symfony.com/blog/new-in-symfony-2-8-deprecated-service-definitions
More info: https://symfony.com/blog/new-in-symfony-2-8-deprecated-service-definitions

For everything else, not managed by the `@deprecated` tag,
you **MUST** still trigger a deprecation message (and add a `NEXT_MAJOR` comment).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Check out the documentation on the [official website](https://docs.sonata-projec

## Support

For general support and questions, please use [StackOverflow](http://stackoverflow.com/questions/tagged/sonata).
For general support and questions, please use [StackOverflow](https://stackoverflow.com/questions/tagged/sonata).

If you think you found a bug or you have a feature idea to propose, feel free to open an issue
**after looking** at the [contributing guide](CONTRIBUTING.md).
Expand Down
58 changes: 29 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,34 @@
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"psr/log": "^1.0 || ^2.0 || ^3.0",
"psr/log": "^2.0 || ^3.0",
"sonata-project/doctrine-extensions": "^1.13 || ^2.0",
"sonata-project/form-extensions": "^1.4",
"sonata-project/twig-extensions": "^1.3 || ^2.0",
"symfony/asset": "^4.4 || ^5.4 || ^6.2",
"symfony/config": "^4.4.11 || ^5.4 || ^6.2",
"symfony/console": "^4.4 || ^5.4 || ^6.2",
"symfony/dependency-injection": "^4.4.8 || ^5.4 || ^6.2",
"symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.2",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.2",
"symfony/finder": "^4.4 || ^5.4 || ^6.2",
"symfony/form": "^4.4.12 || ^5.4 || ^6.2",
"symfony/framework-bundle": "^4.4.6 || ^5.4 || ^6.2",
"symfony/http-client": "^4.4.11 || ^5.4 || ^6.2",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.2",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.2",
"symfony/mime": "^4.4 || ^5.4 || ^6.2",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.2",
"symfony/routing": "^4.4 || ^5.4 || ^6.2",
"symfony/security-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/security-core": "^4.4.24 || ^5.4 || ^6.2",
"symfony/translation": "^4.4 || ^5.4 || ^6.2",
"symfony/translation-contracts": "^1.1 || ^2.0 || ^3.0",
"symfony/twig-bridge": "^4.4 || ^5.4 || ^6.2",
"symfony/twig-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/validator": "^4.4 || ^5.4 || ^6.2",
"symfony/asset": "^5.4 || ^6.2",
"symfony/config": "^5.4 || ^6.2",
"symfony/console": "^5.4 || ^6.2",
"symfony/dependency-injection": "^5.4 || ^6.2",
"symfony/event-dispatcher": "^5.4 || ^6.2",
"symfony/filesystem": "^5.4 || ^6.2",
"symfony/finder": "^5.4 || ^6.2",
"symfony/form": "^5.4 || ^6.2",
"symfony/framework-bundle": "^5.4 || ^6.2",
"symfony/http-client": "^5.4 || ^6.2",
"symfony/http-foundation": "^5.4 || ^6.2",
"symfony/http-kernel": "^5.4 || ^6.2",
"symfony/mime": "^5.4 || ^6.2",
"symfony/options-resolver": "^5.4 || ^6.2",
"symfony/routing": "^5.4 || ^6.2",
"symfony/security-bundle": "^5.4 || ^6.2",
"symfony/security-core": "^5.4 || ^6.2",
"symfony/translation": "^5.4 || ^6.2",
"symfony/translation-contracts": "^2.0 || ^3.0",
"symfony/twig-bridge": "^5.4 || ^6.2",
"symfony/twig-bundle": "^5.4 || ^6.2",
"symfony/validator": "^5.4 || ^6.2",
"twig/string-extra": "^3.0",
"twig/twig": "^2.14 || ^3.0"
"twig/twig": "^3.0"
},
"require-dev": {
"async-aws/simple-s3": "^1.0",
Expand All @@ -83,17 +83,17 @@
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.18",
"psalm/plugin-symfony": "^4.0 || ^5.0",
"psalm/plugin-symfony": "^5.0",
"rector/rector": "^0.15",
"sonata-project/admin-bundle": "^4.9",
"sonata-project/block-bundle": "^4.11",
"sonata-project/classification-bundle": "^4.0",
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.2",
"symfony/messenger": "^4.4 || ^5.4 || ^6.2",
"symfony/browser-kit": "^5.4 || ^6.2",
"symfony/messenger": "^5.4 || ^6.2",
"symfony/phpunit-bridge": "^6.2",
"symfony/security-csrf": "^4.4 || ^5.4 || ^6.2",
"vimeo/psalm": "^4.7.2 || ^5.0"
"symfony/security-csrf": "^5.4 || ^6.2",
"vimeo/psalm": "^5.0"
},
"conflict": {
"async-aws/simple-s3": "<1.0",
Expand Down
30 changes: 9 additions & 21 deletions docs/reference/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,53 +210,41 @@ Then you have to create the corresponding documents, ``src/Document/SonataMediaM

// src/Document/SonataMediaMedia.php

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Sonata\MediaBundle\Document\BaseMedia;

/**
* @MongoDB\Document
*/
#[ODM\Document]
class SonataMediaMedia extends BaseMedia
{
/**
* @MongoDB\Id
*/
#[ODM\Id]
protected $id;
}

``src/Document/SonataMediaGallery``::

// src/Document/SonataMediaGallery.php

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Sonata\MediaBundle\Document\BaseGallery;

/**
* @MongoDB\Document
*/
#[ODM\Document]
class SonataMediaGallery extends BaseGallery
{
/**
* @MongoDB\Id
*/
#[ODM\Id]
protected $id;
}

and ``src/Document/SonataMediaGalleryItem``::

// src/Document/SonataMediaGalleryItem.php

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Sonata\MediaBundle\Document\BaseGalleryItem;

/**
* @MongoDB\Document
*/
#[ODM\Document]
class SonataMediaGalleryItem extends BaseGalleryItem
{
/**
* @MongoDB\Id
*/
#[ODM\Id]
protected $id;
}

Expand Down
6 changes: 6 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ parameters:
checkMissingVarTagTypehint: true
checkMissingTypehints: true
checkUninitializedProperties: true
featureToggles:
skipCheckGenericClasses:
- Symfony\Component\Form\AbstractType
- Symfony\Component\Form\FormInterface
- Symfony\Component\Form\FormTypeExtensionInterface
- Symfony\Component\Form\FormTypeInterface
12 changes: 3 additions & 9 deletions src/Admin/BaseMediaAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,9 @@ protected function configurePersistentParameters(): array
}

$request = $this->getRequest();
$filter = $request->query->all('filter');

// TODO: Change to $request->query->all('filter') when support for Symfony < 5.1 is dropped.
$filter = $request->query->all()['filter'] ?? [];

if (\is_array($filter) && \array_key_exists('context', $filter)) {
if (\array_key_exists('context', $filter)) {
$context = $filter['context']['value'];
} else {
$context = $request->query->get('context', $this->pool->getDefaultContext());
Expand Down Expand Up @@ -162,11 +160,7 @@ protected function alterNewInstance(object $object): void
if ($request->isMethod('POST')) {
$uniqId = $this->getUniqId();

// TODO: Change to $request->request->all($uniqid)['providerName'] when support for Symfony < 5.1 is dropped.
$data = $request->request->all()[$uniqId] ?? [];
\assert(\is_array($data));

$providerName = $data['providerName'];
$providerName = $request->request->all($uniqId)['providerName'];
} else {
$providerName = $request->query->get('provider');
}
Expand Down
8 changes: 0 additions & 8 deletions src/Command/AddMassMediaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
#[AsCommand(name: 'sonata:media:add-multiple', description: 'Add medias in mass into the database')]
final class AddMassMediaCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:media:add-multiple';
protected static $defaultDescription = 'Add medias in mass into the database';

/**
* @var string[]
*/
Expand All @@ -43,11 +39,7 @@ public function __construct(private MediaManagerInterface $mediaManager)

protected function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addOption('file', null, InputOption::VALUE_REQUIRED, 'The file to parse')
->addOption('delimiter', null, InputOption::VALUE_REQUIRED, 'Set the field delimiter (one character only)', ',')
->addOption('enclosure', null, InputOption::VALUE_REQUIRED, 'Set the field enclosure character (one character only).', '"')
Expand Down
8 changes: 0 additions & 8 deletions src/Command/AddMediaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
#[AsCommand(name: 'sonata:media:add', description: 'Add a media into the database')]
final class AddMediaCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:media:add';
protected static $defaultDescription = 'Add a media into the database';

/**
* @internal This class should only be used through the console
*/
Expand All @@ -38,11 +34,7 @@ public function __construct(private MediaManagerInterface $mediaManager)

protected function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addArgument('providerName', InputArgument::REQUIRED, 'The provider')
->addArgument('context', InputArgument::REQUIRED, 'The context')
->addArgument('binaryContent', InputArgument::REQUIRED, 'The content')
Expand Down
8 changes: 0 additions & 8 deletions src/Command/CleanMediaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
#[AsCommand(name: 'sonata:media:clean-uploads', description: 'Find orphaned files in media upload directory')]
final class CleanMediaCommand extends Command
{
// TODO: Remove static properties when support for Symfony < 5.4 is dropped.
protected static $defaultName = 'sonata:media:clean-uploads';
protected static $defaultDescription = 'Find orphaned files in media upload directory';

/**
* @var string[]|null
*/
Expand All @@ -51,11 +47,7 @@ public function __construct(

protected function configure(): void
{
\assert(null !== static::$defaultDescription);

$this
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped.
->setDescription(static::$defaultDescription)
->addOption('dry-run', null, InputOption::VALUE_NONE, 'Execute the cleanup as a dry run. This doesn\'t remove any files');
}

Expand Down

0 comments on commit 4abb660

Please sign in to comment.