Skip to content

Commit

Permalink
2.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Sep 21, 2021
1 parent 2d05be9 commit 435f00b
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 39 deletions.
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/).

## [2.9.0](https://github.com/sonata-project/SonataTranslationBundle/compare/2.8.1...2.9.0) - 2021-09-21
### Added
- [[#543](https://github.com/sonata-project/SonataTranslationBundle/pull/543)] Added `LocaleProviderInterface` and `RequestLocaleProvider` to get the locale based on the parameter from the URL or the default configured one ([@franmomu](https://github.com/franmomu))
- [[#543](https://github.com/sonata-project/SonataTranslationBundle/pull/543)] Added `LocaleProvider` service when `knplabs` is enabled to be able to show the content in the proper language ([@franmomu](https://github.com/franmomu))

### Deprecated
- [[#542](https://github.com/sonata-project/SonataTranslationBundle/pull/542)] Deprecated implementing `Sonata\TranslationBundle\Model\TranslatableInterface` in an Entity implementing `Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface` ([@franmomu](https://github.com/franmomu))
- [[#537](https://github.com/sonata-project/SonataTranslationBundle/pull/537)] `Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable` class ([@franmomu](https://github.com/franmomu))
- [[#537](https://github.com/sonata-project/SonataTranslationBundle/pull/537)] `Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslation` class ([@franmomu](https://github.com/franmomu))
- [[#537](https://github.com/sonata-project/SonataTranslationBundle/pull/537)] `Sonata\TranslationBundle\Model\Gedmo\AbstractTranslatable` class ([@franmomu](https://github.com/franmomu))
- [[#537](https://github.com/sonata-project/SonataTranslationBundle/pull/537)] `Sonata\TranslationBundle\Model\AbstractTranslatable` class ([@franmomu](https://github.com/franmomu))
- [[#537](https://github.com/sonata-project/SonataTranslationBundle/pull/537)] `Sonata\TranslationBundle\Traits\Gedmo\PersonalTranslatableTrait` trait ([@franmomu](https://github.com/franmomu))
- [[#537](https://github.com/sonata-project/SonataTranslationBundle/pull/537)] `Sonata\TranslationBundle\Traits\Gedmo\TranslatableTrait` trait ([@franmomu](https://github.com/franmomu))
- [[#537](https://github.com/sonata-project/SonataTranslationBundle/pull/537)] `Sonata\TranslationBundle\Traits\TranslatableTrait` trait ([@franmomu](https://github.com/franmomu))

### Removed
- [[#542](https://github.com/sonata-project/SonataTranslationBundle/pull/542)] Removed support of `knplabs/doctrine-behaviors` < 2.2 ([@franmomu](https://github.com/franmomu))

## [2.8.1](https://github.com/sonata-project/SonataTranslationBundle/compare/2.8.0...2.8.1) - 2021-05-18
### Fixed
- [[#491](https://github.com/sonata-project/SonataTranslationBundle/pull/491)] Fixed registering `sonata_translation.listener.translatable` when no `translatable_listener_service` is defined ([@franmomu](https://github.com/franmomu))
Expand Down
49 changes: 26 additions & 23 deletions UPGRADE-2.x.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
UPGRADE 2.x
===========

UPGRADE FROM 2.x to 2.x
UPGRADE FROM 2.8 to 2.9
=======================

If you are using this bundle with "gedmo/doctrine-extensions", you MUST to specify the translatable listener service
name in the configuration.

Before:
```yaml
# config/packages/sonata_translation.yaml

sonata_translation:
gedmo:
enabled: true
```
After:
```yaml
# config/packages/sonata_translation.yaml

sonata_translation:
gedmo:
enabled: true
# in case you are using stof/doctrine-extensions-bundle
translatable_listener_service: stof_doctrine_extensions.listener.translatable
```
### Deprecated abstract models and traits

- `Sonata\TranslationBundle\Model\Gedmo\AbstractPersonalTranslatable`.
Expand All @@ -50,6 +28,31 @@ It is deprecated implementing `Sonata\TranslationBundle\Model\TranslatableInterf
`Sonata\TranslationBundle\Admin\Extension\Phpcr\TranslatableAdminExtension` classes must receive an instance of
`LocaleProviderInterface` as second argument.

UPGRADE FROM 2.7 to 2.8
=======================

If you are using this bundle with "gedmo/doctrine-extensions", you MUST to specify the translatable listener service
name in the configuration.

Before:
```yaml
# config/packages/sonata_translation.yaml

sonata_translation:
gedmo:
enabled: true
```
After:
```yaml
# config/packages/sonata_translation.yaml

sonata_translation:
gedmo:
enabled: true
# in case you are using stof/doctrine-extensions-bundle
translatable_listener_service: stof_doctrine_extensions.listener.translatable
```
UPGRADE FROM 2.1 to 2.7
=======================
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Extension/AbstractTranslatableAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function __construct(TranslatableChecker $translatableChecker, $defaultTr
if (!$defaultTranslationLocaleOrLocaleProvider instanceof LocaleProviderInterface) {
@trigger_error(sprintf(
'Omitting the argument 2 or passing other type than "%s" to "%s()" is deprecated'
.' since sonata-project/translation-bundle 2.x and will be not possible in version 3.0.',
.' since sonata-project/translation-bundle 2.9 and will be not possible in version 3.0.',
LocaleProviderInterface::class,
__METHOD__
), \E_USER_DEPRECATED);
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/Extension/Knplabs/TranslatableAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function alterNewInstance(AdminInterface $admin, $object)
if ($object instanceof TranslatableInterface) {
@trigger_error(sprintf(
'Implementing "%1$s" for entities using "knplabs/doctrine-behaviors" is deprecated'
.' since sonata-project/translation-bundle 2.x and "%1$s::setLocale()" method will not be called'
.' since sonata-project/translation-bundle 2.9 and "%1$s::setLocale()" method will not be called'
.' anymore in version 3.0.',
TranslatableInterface::class
), \E_USER_DEPRECATED);
Expand All @@ -52,7 +52,7 @@ public function alterObject(AdminInterface $admin, $object)
if ($object instanceof TranslatableInterface) {
@trigger_error(sprintf(
'Implementing "%1$s" for entities using "knplabs/doctrine-behaviors" 3 is deprecated'
.' since sonata-project/translation-bundle 2.x and "%1$s::setLocale()" method will not be called'
.' since sonata-project/translation-bundle 2.9 and "%1$s::setLocale()" method will not be called'
.' anymore in version 3.0.',
TranslatableInterface::class
), \E_USER_DEPRECATED);
Expand Down
2 changes: 1 addition & 1 deletion src/Checker/TranslatableChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function isTranslatable($object)
if (\count(array_intersect($translateTraits, $traits)) > 0) {
@trigger_error(sprintf(
'Using traits to specify that a model is translatable is deprecated since'
.' sonata-project/translation-bundle 2.x and will be not possible in version 3.0. To mark "%s" class'
.' sonata-project/translation-bundle 2.9 and will be not possible in version 3.0. To mark "%s" class'
.' as translatable you should implement one of "%s" interfaces.',
\is_string($object) ? $object : \get_class($object),
implode(', ', $this->getSupportedInterfaces())
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getConfigTreeBuilder()
->defaultValue(static function (): string {
@trigger_error(
'Not specifying the translatable listener service when using'
.' gedmo/doctrine-extensions is deprecated since sonata-project/translation-bundle 2.x.'
.' gedmo/doctrine-extensions is deprecated since sonata-project/translation-bundle 2.8.'
.' If you are using a bundle that integrates this library, it is likely that it'
.' registers that service for you. In case of "stof/doctrine-extensions-bundle", it is:'
.' "stof_doctrine_extensions.listener.translatable".'
Expand Down
2 changes: 1 addition & 1 deletion src/Model/AbstractTranslatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*
* @deprecated since version 2.x, to be removed in 3.0.
* @deprecated since version 2.9, to be removed in 3.0.
*/
abstract class AbstractTranslatable
{
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Gedmo/AbstractPersonalTranslatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*
* @deprecated since version 2.x, to be removed in 3.0. Create your own instead.
* @deprecated since version 2.9, to be removed in 3.0. Create your own instead.
* @see https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/translatable.md : Personal translations
*/
abstract class AbstractPersonalTranslatable extends AbstractTranslatable
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Gedmo/AbstractPersonalTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*
* @deprecated since version 2.x, to be removed in 3.0. Create your own instead.
* @deprecated since version 2.9, to be removed in 3.0. Create your own instead.
* @see https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/translatable.md : Personal translations
*/
class AbstractPersonalTranslation extends GedmoAbstractPersonalTranslation
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Gedmo/AbstractTranslatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*
* @deprecated since version 2.x, to be removed in 3.0. Create your own instead.
* @deprecated since version 2.9, to be removed in 3.0. Create your own instead.
* @see https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/translatable.md
*/
abstract class AbstractTranslatable extends \Sonata\TranslationBundle\Model\AbstractTranslatable
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/Gedmo/PersonalTranslatableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* If you don't want to use trait, you can extend AbstractPersonalTranslatable instead.
*
* @deprecated since version 2.x, to be removed in 3.0. Create your own trait instead.
* @deprecated since version 2.9, to be removed in 3.0. Create your own trait instead.
*
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/Gedmo/TranslatableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* If you don't want to use trait, you can extend AbstractTranslatable instead.
*
* @deprecated since version 2.x, to be removed in 3.0. Create your own trait instead.
* @deprecated since version 2.9, to be removed in 3.0. Create your own trait instead.
*
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/TranslatableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*
* @deprecated since version 2.x and will be removed in 3.0.
* @deprecated since version 2.9 and will be removed in 3.0.
*/
trait TranslatableTrait
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testGetTranslatableLocaleFromContainer(): void
->method('getConfigurationPool')
->willReturn($pool);

$this->expectDeprecation('Omitting the argument 2 or passing other type than "Sonata\TranslationBundle\Provider\LocaleProviderInterface" to "Sonata\TranslationBundle\Admin\Extension\AbstractTranslatableAdminExtension::__construct()" is deprecated since sonata-project/translation-bundle 2.x and will be not possible in version 3.0.');
$this->expectDeprecation('Omitting the argument 2 or passing other type than "Sonata\TranslationBundle\Provider\LocaleProviderInterface" to "Sonata\TranslationBundle\Admin\Extension\AbstractTranslatableAdminExtension::__construct()" is deprecated since sonata-project/translation-bundle 2.9 and will be not possible in version 3.0.');

$extension = new class($this->translatableChecker) extends AbstractTranslatableAdminExtension {
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected function setUp(): void
TranslatableInterface::class,
]);

$this->expectDeprecation('Omitting the argument 2 or passing other type than "Sonata\TranslationBundle\Provider\LocaleProviderInterface" to "Sonata\TranslationBundle\Admin\Extension\AbstractTranslatableAdminExtension::__construct()" is deprecated since sonata-project/translation-bundle 2.x and will be not possible in version 3.0.');
$this->expectDeprecation('Omitting the argument 2 or passing other type than "Sonata\TranslationBundle\Provider\LocaleProviderInterface" to "Sonata\TranslationBundle\Admin\Extension\AbstractTranslatableAdminExtension::__construct()" is deprecated since sonata-project/translation-bundle 2.9 and will be not possible in version 3.0.');
$this->expectDeprecation('Not passing an instance of "Gedmo\Translatable\TranslatableListener" as argument 2 to "Sonata\TranslationBundle\Admin\Extension\Gedmo\TranslatableAdminExtension::__construct()" is deprecated since sonata-project/translation-bundle 2.7 and will be mandatory in 3.0.');
$this->expectDeprecation('Not passing an instance of "Doctrine\Persistence\ManagerRegistry" as argument 3 to "Sonata\TranslationBundle\Admin\Extension\Gedmo\TranslatableAdminExtension::__construct()" is deprecated since sonata-project/translation-bundle 2.7 and will be mandatory in 3.0.');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testDeprecatedSetLocaleForTranslatableObject(): void
{
$object = new DeprecatedTranslatableEntity();

$this->expectDeprecation('Implementing "Sonata\TranslationBundle\Model\TranslatableInterface" for entities using "knplabs/doctrine-behaviors" is deprecated since sonata-project/translation-bundle 2.x and "Sonata\TranslationBundle\Model\TranslatableInterface::setLocale()" method will not be called anymore in version 3.0.');
$this->expectDeprecation('Implementing "Sonata\TranslationBundle\Model\TranslatableInterface" for entities using "knplabs/doctrine-behaviors" is deprecated since sonata-project/translation-bundle 2.9 and "Sonata\TranslationBundle\Model\TranslatableInterface::setLocale()" method will not be called anymore in version 3.0.');

$this->extension->alterNewInstance($this->admin, $object);

Expand Down
2 changes: 1 addition & 1 deletion tests/Checker/TranslatableCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function testIsTranslatableOnTrait(): void

$object = new ModelUsingTraitTranslatable();

$this->expectDeprecation('Using traits to specify that a model is translatable is deprecated since sonata-project/translation-bundle 2.x and will be not possible in version 3.0. To mark "Sonata\TranslationBundle\Tests\Fixtures\Model\ModelUsingTraitTranslatable" class as translatable you should implement one of "Gedmo\Translatable\Translatable" interfaces.');
$this->expectDeprecation('Using traits to specify that a model is translatable is deprecated since sonata-project/translation-bundle 2.9 and will be not possible in version 3.0. To mark "Sonata\TranslationBundle\Tests\Fixtures\Model\ModelUsingTraitTranslatable" class as translatable you should implement one of "Gedmo\Translatable\Translatable" interfaces.');

static::assertTrue($translatableChecker->isTranslatable($object));
}
Expand Down

0 comments on commit 435f00b

Please sign in to comment.