Skip to content

Commit

Permalink
Merge pull request #180 from greg0ire/merge_2.x
Browse files Browse the repository at this point in the history
Merge 2.x
  • Loading branch information
jordisala1991 committed Sep 19, 2017
2 parents a6c11c6 + 46f5c9a commit 3952160
Show file tree
Hide file tree
Showing 26 changed files with 450 additions and 78 deletions.
12 changes: 5 additions & 7 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@

#### Sonata packages

```bash
$ composer show sonata-project/*
# Put the result here.
```
$ composer show --latest 'sonata-project/*'
```

#### Symfony packages

```bash
$ composer show symfony/*
# Put the result here.
```
$ composer show --latest 'symfony/*'
```

#### PHP version

```bash
```
$ php -v
# Put the result here.
```
Expand Down
4 changes: 3 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
- master is for deprecation removals and other changes that cannot be done without a BC-break
More details here: https://github.com/sonata-project/SonataTranslationBundle/blob/2.x/CONTRIBUTING.md#the-base-branch
-->
I am targetting this branch, because {reason}.
I am targeting this branch, because {reason}.

In case of bug fix, `2.x` **MUST** be targeted.

<!--
Specify which issues will be fixed/closed.
Expand Down
2 changes: 2 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ finder:
- 'Tests/Fixtures'
# ecommerce special case:
- 'Resources/skeleton'
# ignore vendor assets
- 'Resources/public/vendor'
27 changes: 15 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- nightly
- hhvm

sudo: false
dist: precise

cache:
pip: true
Expand All @@ -35,30 +36,32 @@ env:
matrix:
fast_finish: true
include:
- php: '7.0'
- php: '7.1'
env: TARGET=docs
- php: '7.0'
- php: '7.1'
env: TARGET=lint
- php: '5.4'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '7.0'
- php: '7.1'
env: SYMFONY=2.8.*
- php: '7.0'
- php: '7.1'
env: SYMFONY=3.1.*
- php: '7.0'
- php: '7.1'
env: SYMFONY=3.2.*
- php: '7.0'
- php: '7.1'
env: SYMFONY=dev-master@dev
- php: '7.0'
- php: '7.1'
env: SONATA_CORE=3.*
- php: '7.0'
- php: '7.1'
env: SONATA_CORE=dev-master@dev
- php: '7.0'
- php: '7.1'
env: SONATA_ADMIN=3.*
- php: '7.0'
- php: '7.1'
env: SONATA_ADMIN=dev-master@dev
- php: '7.0'
- php: '7.1'
env: SYMFONY_DEPRECATIONS_HELPER=0
- php: hhvm
dist: trusty
allow_failures:
- php: nightly
- php: hhvm
Expand Down
10 changes: 3 additions & 7 deletions .travis/before_install_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
set -ev

if [ "${TRAVIS_PHP_VERSION}" != "hhvm" ]; then
mv "$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini" /tmp
echo "memory_limit=3072M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
PHP_INI_DIR="$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/"
TRAVIS_INI_FILE="$PHP_INI_DIR/travis.ini"
echo "memory_limit=3072M" >> "$TRAVIS_INI_FILE"

if [ ${TRAVIS_PHP_VERSION} '<' '7.0' ]; then
echo "extension=mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
fi
fi

# To be removed when following PR will be merged: https://github.com/travis-ci/travis-build/pull/718
composer self-update --stable
sed --in-place "s/\"dev-master\":/\"dev-${TRAVIS_COMMIT}\":/" composer.json

if [ "$SYMFONY" != "" ]; then composer require "symfony/symfony:$SYMFONY" --no-update; fi;
Expand Down
4 changes: 0 additions & 4 deletions .travis/before_script_test.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
#!/usr/bin/env sh
set -ev

if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then
mv /tmp/xdebug.ini "$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d"
fi
13 changes: 7 additions & 6 deletions .travis/install_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ mkdir --parents "${HOME}/bin"

# PHPUnit install
if [ ${TRAVIS_PHP_VERSION} '<' '5.6' ]; then
PHPUNIT_PHAR=phpunit-old.phar
PHPUNIT_PHAR=phpunit-4.8.phar
else
PHPUNIT_PHAR=phpunit.phar
PHPUNIT_PHAR=phpunit-5.7.phar
fi
wget "https://phar.phpunit.de/${PHPUNIT_PHAR}" --output-document="${HOME}/bin/phpunit"
chmod u+x "${HOME}/bin/phpunit"
Expand All @@ -16,8 +16,9 @@ chmod u+x "${HOME}/bin/phpunit"
wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar --output-document="${HOME}/bin/coveralls"
chmod u+x "${HOME}/bin/coveralls"

# To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
if [ "${COMPOSER_FLAGS}" = '--prefer-lowest' ]; then
composer update --prefer-dist --no-interaction --prefer-stable --quiet
fi
# To be removed when these issues are resolved:
# https://github.com/composer/composer/issues/5355
# https://github.com/composer/composer/issues/5030
composer update --prefer-dist --no-interaction --prefer-stable --quiet --ignore-platform-reqs

composer update --prefer-dist --no-interaction --prefer-stable ${COMPOSER_FLAGS}
22 changes: 22 additions & 0 deletions Admin/Extension/Phpcr/TranslatableAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,28 @@
namespace Sonata\TranslationBundle\Admin\Extension\Phpcr;

use Doctrine\ODM\PHPCR\DocumentManager;
use Doctrine\ODM\PHPCR\Translation\LocaleChooser\LocaleChooser;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\TranslationBundle\Admin\Extension\AbstractTranslatableAdminExtension;
use Sonata\TranslationBundle\Checker\TranslatableChecker;

/**
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*/
class TranslatableAdminExtension extends AbstractTranslatableAdminExtension
{
/**
* @var LocaleChooser
*/
private $localeChooser;

public function __construct(TranslatableChecker $translatableChecker, LocaleChooser $localeChooser)
{
parent::__construct($translatableChecker);
$this->localeChooser = $localeChooser;
}

/**
* {@inheritdoc}
*/
Expand All @@ -43,6 +57,14 @@ public function alterObject(AdminInterface $admin, $object)
}
}

/**
* {@inheritdoc}
*/
public function configureQuery(AdminInterface $admin, ProxyQueryInterface $query, $context = 'list')
{
$this->localeChooser->setLocale($this->getTranslatableLocale($admin));
}

/**
* @param AdminInterface $admin
*
Expand Down
4 changes: 2 additions & 2 deletions Block/LocaleSwitcherBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

namespace Sonata\TranslationBundle\Block;

use Sonata\BlockBundle\Block\BaseBlockService;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Sonata\BlockBundle\Block\Service\AbstractBlockService;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
* @author Nicolas Bastien <nbastien.pro@gmail.com>
*/
class LocaleSwitcherBlockService extends BaseBlockService
class LocaleSwitcherBlockService extends AbstractBlockService
{
/**
* NEXT_MAJOR: remove this method.
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [2.1.1](https://github.com/sonata-project/SonataTranslationBundle/compare/2.1.0...2.1.1) - 2017-04-04
### Changed
- use `Sonata\BlockBundle\Block\Service\AbstractBlockService` instead of deprecated `Sonata\BlockBundle\Block\BaseBlockService` in `LocaleSwitcherBlockService`
- renamed `service.xml` to `service_orm.xml`
- only load `service_orm.xml` if `SonataDoctrineORMAdminBundle` is registered

### Fixed
- Fixed typo in `SonataTranslationExtension`

## [2.1.0](https://github.com/sonata-project/SonataTranslationBundle/compare/2.0.2...2.1.0) - 2017-01-17
### Added
- Added missing flag image `ja.png`
Expand Down
Loading

0 comments on commit 3952160

Please sign in to comment.