Skip to content

Commit

Permalink
Merge branch 'master' into php8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Yozhef authored Mar 15, 2021
2 parents edb8016 + d4e573c commit 053a3c7
Show file tree
Hide file tree
Showing 168 changed files with 829 additions and 1,187 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@ jobs:
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: '3.7'

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install Sphinx dependencies
run: sudo apt-get install python-dev build-essential

- name: Cache pip
uses: actions/cache@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
tools: composer:v2, pecl
extensions: mongodb-1.9.0
tools: composer:v2
extensions: mongodb-1.9.0, soap, gd

- name: Add PHPUnit matcher
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
Expand Down
5 changes: 2 additions & 3 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@ $rules = [
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,
'void_return' => null,
'void_return' => false,
];


$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('Tests/Fixtures')
->exclude('tests/Fixtures')
->exclude('Resources/skeleton')
->exclude('Resources/public/vendor')
->exclude('var')
;

return PhpCsFixer\Config::create()
Expand Down
15 changes: 12 additions & 3 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@
#
# It's auto-generated by sonata-project/dev-kit package.

ignore: vendor/

extends: default

rules:
comments: disable
comments-indentation: disable
document-start: disable
line-length:
max: 120
level: warning
empty-lines:
max: 1
max-start: 0
max-end: 0
line-length: disable
truthy:
allowed-values: ['true', 'false']
check-keys: false
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [3.30.0](https://github.com/sonata-project/SonataMediaBundle/compare/3.29.0...3.30.0) - 2021-02-15
### Added
- [[#1907](https://github.com/sonata-project/SonataMediaBundle/pull/1907)] Support `sonata-project/datagrid-bundle:^3.0` ([@Yozhef](https://github.com/Yozhef))

## [3.29.0](https://github.com/sonata-project/SonataMediaBundle/compare/3.28.0...3.29.0) - 2020-11-30
### Fixed
- [[#1866](https://github.com/sonata-project/SonataMediaBundle/pull/1866)] Guessing the content type of a file stored on Amazon S3 ([@jorrit](https://github.com/jorrit))
Expand Down
17 changes: 1 addition & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ If your PR contains an addition, a new feature, this one has to be fully covered

Some rules have to be respected about the test:

* Prefer [the built-in test doubles implementation](https://phpunit.de/manual/current/en/test-doubles.html) over prophecy.
* Annotations about coverage are prohibited. This concerns:
* `@covers`
* `@coversDefaultClass`
Expand All @@ -161,22 +162,6 @@ Some rules have to be respected about the test:
* Most of the time, the test class SHOULD have the same name as the targeted class, suffixed by `Test`.
* The `@expectedException*` annotations are prohibited. Use `PHPUnit_Framework_TestCase::setExpectedException()`.

##### Using test doubles

Historically, Sonata has been using [the built-in test doubles implementation](https://phpunit.de/manual/current/en/test-doubles.html),
but [started to use Prophecy](https://github.com/sonata-project/dev-kit/issues/89).
This means the current Sonata codebase currently uses both implementations.

If you want to contribute a test that uses test doubles, please follow these rules :

1. All new test classes MUST use built-in test double implementation.
2. If you are changing an existing test method, you MUST use the same implementation it already uses,
and focus on the goal of your PR and only on that.
3. If you are changing an existing test class, you MUST use the same implementation it already uses,
to be more consistent.
4. You MAY submit a PR that migrates a test class from Prophecy to the built-in test double implementation,
but it MUST migrate it entirely. The PR SHOULD only be about the migration.

### Writing a Pull Request

#### Subject
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lint-composer:
.PHONY: lint-composer

lint-yaml:
yaml-lint --ignore-non-yaml-files --quiet --exclude vendor .
yamllint .

.PHONY: lint-yaml

Expand Down
6 changes: 6 additions & 0 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPGRADE FROM 2.x to 3.0
=======================

### Dependencies

You will need to follow the dependencies upgrade instructions.
50 changes: 50 additions & 0 deletions UPGRADE-4.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
UPGRADE FROM 3.x to 4.0
=======================

### Sonata\DatagridBundle\Pager\PageableInterface

Usages of `Sonata\Doctrine\Model\PageableManagerInterface` were replaced in favor of `Sonata\DatagridBundle\Pager\PageableInterface`.

### Dependencies

- Drop support for `sonata-project/datagrid-bundle` < 3.0.

If you are extending these methods, you MUST add argument and return type declarations:

- `Sonata\MediaBundle\Entity\GalleryManager::getPager()`
- `Sonata\MediaBundle\Entity\MediaManager::getPager()`
- `Sonata\MediaBundle\Model\GalleryManager::getPager()`
- `Sonata\MediaBundle\Model\MediaManager::getPager()`

## Deprecations

All the deprecated code introduced on 3.x is removed on 4.0.

Please read [3.x](https://github.com/sonata-project/SonataMediaBundle/tree/3.x) upgrade guides for more information.

See also the [diff code](https://github.com/sonata-project/SonataMediaBundle/compare/3.x...4.0.0).

## Controllers

`MediaController` actions were changed to introduce `Request $request` as first parameter.
You must update those signatures if you want to still extend this class:
`downloadAction`, `listAction` and `liipImagineFilterAction`

## Blocks

The property `wrap` in `GalleryBlockService` was removed. You must create a custom block, if you still want to use it.

## Models

If you have implemented a custom model, you must adapt the signature of the following new methods:
* `GalleryHasMediaInterface::getId`
* `GalleryInterface::getId`

## Renamed GalleryHasMedia to GalleryItem

All Actions, Controllers, Interfaces and anything related to this is renamed accordingly.

## Removed classification dependency

The category feature is now optional and can be disabled in the configuration.
If you need this feature you have to require `sonata-project/classifcation-bundle` via composer.
18 changes: 11 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,20 @@
"conflict": {
"doctrine/dbal": "<2.6.0",
"doctrine/mongodb-odm": "<2.0",
"doctrine/persistence": "<1.3",
"friendsofsymfony/rest-bundle": "<2.6",
"jms/serializer": "<0.13",
"liip/imagine-bundle": "<1.9",
"rackspace/php-opencloud": "<1.6",
"sonata-project/block-bundle": "<3.17 || >=4.0",
"sonata-project/classification-bundle": "<3.0 || >= 5.0",
"sonata-project/core-bundle": "<3.20",
"sonata-project/doctrine-orm-admin-bundle": "<3.0",
"sonata-project/formatter-bundle": "<3.4",
"sonata-project/notification-bundle": "<3.3",
"sonata-project/seo-bundle": "<2.5 || >=3.0",
"symfony/monolog-bundle": "<2.4"
"symfony/monolog-bundle": "<2.4",
"tilleuls/ckeditor-sonata-media-bundle": "<1.0"
},
"require-dev": {
"aws/aws-sdk-php": "^2.8 || ^3.0",
Expand All @@ -86,7 +90,7 @@
"nelmio/api-doc-bundle": "^2.13.4",
"sonata-project/admin-bundle": "^3.41",
"sonata-project/block-bundle": "^3.17",
"sonata-project/datagrid-bundle": "^2.5 || ^3.0",
"sonata-project/datagrid-bundle": "^3.0.1",
"sonata-project/doctrine-orm-admin-bundle": "^3.14",
"sonata-project/notification-bundle": "^3.3",
"sonata-project/seo-bundle": "^2.5",
Expand All @@ -97,22 +101,22 @@
},
"suggest": {
"liip/imagine-bundle": "If you want on-the-fly thumbnail generation or image filtering (scale, crop, watermark...)",
"rackspace/php-opencloud": "^1.6",
"rackspace/php-opencloud": "If you want to use OpenStack/Rackspace APIs",
"sonata-project/classification-bundle": "If you want to categorize your media items.",
"sonata-project/doctrine-orm-admin-bundle": "^3.0",
"sonata-project/doctrine-orm-admin-bundle": "If you want to persist entities",
"sonata-project/notification-bundle": "If you want to generate thumbnails asynchronously.",
"sonata-project/seo-bundle": "^2.1",
"sonata-project/seo-bundle": "If you're sensible to SEO",
"symfony/http-client": "If you want to load external content",
"symfony/monolog-bundle": "If you want to log exceptions produced when dealing with images.",
"tilleuls/ckeditor-sonata-media-bundle": "^1.0",
"tilleuls/ckeditor-sonata-media-bundle": "If you want to use CKEditor",
"twig/extra-bundle": "Auto configures the Twig Intl extension"
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
"dev-master": "4.x-dev"
}
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/advanced_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Full configuration options:
class:
media: App\Entity\SonataMediaMedia
gallery: App\Entity\SonataMediaGallery
gallery_has_media: App\Entity\SonataMediaGalleryHasMedia
gallery_item: App\Entity\SonataMediaGalleryItem
category: null # App\Entity\SonataClassificationCategory if exists
force_disable_category: false # true, if you really want to disable the relation with category
Expand Down
32 changes: 16 additions & 16 deletions docs/reference/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ SonataMediaBundle Configuration
class:
media: App\Entity\SonataMediaMedia
gallery: App\Entity\SonataMediaGallery
gallery_has_media: App\Entity\SonataMediaGalleryHasMedia
gallery_item: App\Entity\SonataMediaGalleryItem
db_driver: doctrine_orm # or doctrine_mongodb, doctrine_phpcr it is mandatory to choose one here
default_context: default # you need to set a context
contexts:
Expand Down Expand Up @@ -184,18 +184,18 @@ And then create the corresponding entities, ``src/Entity/SonataMediaMedia``::
protected $id;
}

and ``src/Entity/SonataMediaGalleryHasMedia``::
and ``src/Entity/SonataMediaGalleryItem``::

// src/Entity/SonataMediaGalleryHasMedia.php
// src/Entity/SonataMediaGalleryItem.php

use Doctrine\ORM\Mapping as ORM;
use Sonata\MediaBundle\Entity\BaseGalleryHasMedia;
use Sonata\MediaBundle\Entity\BaseGalleryItem;

/**
* @ORM\Entity
* @ORM\Table(name="media__gallery_has_media")
* @ORM\Table(name="media__gallery_item")
*/
class SonataMediaGalleryHasMedia extends BaseGalleryHasMedia
class SonataMediaGalleryItem extends BaseGalleryItem
{
/**
* @ORM\Id
Expand Down Expand Up @@ -258,17 +258,17 @@ Then you have to create the corresponding documents, ``src/PHPCR/SonataMediaMedi
protected $id;
}

and ``src/PHPCR/SonataMediaGalleryHasMedia``::
and ``src/PHPCR/SonataMediaGalleryItem``::

// src/PHPCR/SonataMediaGalleryHasMedia.php
// src/PHPCR/SonataMediaGalleryItem.php

use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
use Sonata\MediaBundle\PHPCR\BaseGalleryHasMedia;
use Sonata\MediaBundle\PHPCR\BaseGalleryItem;

/**
* @PHPCR\Document
*/
class SonataMediaGalleryHasMedia extends BaseGalleryHasMedia
class SonataMediaGalleryItem extends BaseGalleryItem
{
/**
* @PHPCR\Id
Expand All @@ -285,7 +285,7 @@ And then configure ``SonataMediaBundle`` to use the newly generated classes::
class:
media: App\PHPCR\SonataMediaMedia
gallery: App\PHPCR\SonataMediaGallery
gallery_has_media: App\PHPCR\SonataMediaGalleryHasMedia
gallery_item: App\PHPCR\SonataMediaGalleryItem

Doctrine MongoDB Configuration
------------------------------
Expand Down Expand Up @@ -335,17 +335,17 @@ Then you have to create the corresponding documents, ``src/Document/SonataMediaM
protected $id;
}

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

// src/Document/SonataMediaGalleryHasMedia.php
// src/Document/SonataMediaGalleryItem.php

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

/**
* @MongoDB\Document
*/
class SonataMediaGalleryHasMedia extends BaseGalleryHasMedia
class SonataMediaGalleryItem extends BaseGalleryItem
{
/**
* @MongoDB\Id
Expand All @@ -362,7 +362,7 @@ And then configure ``SonataMediaBundle`` to use the newly generated classes::
class:
media: App\Document\SonataMediaMedia
gallery: App\Document\SonataMediaGallery
gallery_has_media: App\Document\SonataMediaGalleryHasMedia
gallery_item: App\Document\SonataMediaGalleryItem

Add SonataMediaBundle routes
----------------------------
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ Finally your settings in your ``sonata_media`` parameters will look like this:
sonata_media:
# if you don't use default namespace configuration
#class:
# media: MyVendor\MediaBundle\Entity\Media
# gallery: MyVendor\MediaBundle\Entity\Gallery
# gallery_has_media: MyVendor\MediaBundle\Entity\GalleryHasMedia
# media: MyVendor\MediaBundle\Entity\Media
# gallery: MyVendor\MediaBundle\Entity\Gallery
# gallery_item: MyVendor\MediaBundle\Entity\GalleryItem
default_context: default
db_driver: doctrine_orm # or doctrine_mongodb, doctrine_phpcr
contexts:
Expand Down
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ It's auto-generated by sonata-project/dev-kit package.

<php>
<ini name="precision" value="8" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
<!-- Use max[self]=0 when https://github.com/symfony/symfony/issues/40400 is fixed -->
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=99999" />
<env name="SYMFONY_PHPUNIT_VERSION" value="9.4" />
</php>

Expand Down
Loading

0 comments on commit 053a3c7

Please sign in to comment.