From 2aaf8e61698054d8e6553a0f708ccd7295ad380c Mon Sep 17 00:00:00 2001 From: SonataCI Date: Fri, 24 Jun 2016 14:55:49 +0200 Subject: [PATCH 1/4] DevKit updates --- .editorconfig | 23 +++ .github/ISSUE_TEMPLATE.md | 52 ++++++ .github/PULL_REQUEST_TEMPLATE.md | 57 ++++++ .php_cs | 49 ++++-- .styleci.yml | 27 +++ .travis.yml | 96 +++++----- .travis/after_success_test.sh | 4 + .travis/before_install_test.sh | 17 ++ .travis/before_script_test.sh | 6 + .travis/check_relevant_docs.sh | 6 + .travis/check_relevant_lint.sh | 6 + .travis/check_relevant_test.sh | 6 + .travis/install_docs.sh | 4 + .travis/install_lint.sh | 6 + .travis/install_test.sh | 23 +++ CONTRIBUTING.md | 293 +++++++++++++++++++++++++++---- LICENSE | 4 +- Makefile | 26 ++- README.md | 45 +++-- 19 files changed, 640 insertions(+), 110 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .styleci.yml create mode 100755 .travis/after_success_test.sh create mode 100755 .travis/before_install_test.sh create mode 100755 .travis/before_script_test.sh create mode 100755 .travis/check_relevant_docs.sh create mode 100755 .travis/check_relevant_lint.sh create mode 100755 .travis/check_relevant_test.sh create mode 100755 .travis/install_docs.sh create mode 100755 .travis/install_lint.sh create mode 100755 .travis/install_test.sh diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..a921123a5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +root = true + +[*] +end_of_line = lf +indent_style = space +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{yml,twig,php}] +indent_size = 4 + +[*.{js,json,scss,css}] +indent_size = 2 + +[.travis.yml] +indent_size = 2 + +[composer.json] +indent_size = 4 + +[Makefile] +indent_style = tab diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..8837ca65b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,52 @@ + + + + +### Environment + +#### Sonata packages + +```bash +$ composer show sonata-project/* +# Put the result here. +``` + +#### Symfony packages + +```bash +$ composer show symfony/* +# Put the result here. +``` + +#### PHP version + +```bash +$ php -v +# Put the result here. +``` + +## Subject + + + +## Steps to reproduce + +## Expected results + +## Actual results + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..82b80396f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,57 @@ + + + +I am targetting this branch, because… + + + +Closes # +Fixes # + +## Changelog + + + + +```markdown +### Added +- Added some `Class::newMethod` to do great stuff + +### Changed + +### Deprecated + +### Removed + +### Fixed + +### Security +``` + +## To do + + + +- [ ] Update the tests +- [ ] Update the documentation +- [ ] Add an upgrade note + +## Subject + + diff --git a/.php_cs b/.php_cs index 0b1c7f90e..dcd9cd1b7 100644 --- a/.php_cs +++ b/.php_cs @@ -1,19 +1,40 @@ in(array(__DIR__)) -; +/* + * DO NOT EDIT THIS FILE! + * + * It's auto-generated by sonata-project/dev-kit package. + * + * Package `sllh/php-cs-fixer-styleci-bridge` is required to get it working. + */ + +require_once __DIR__.'/vendor/sllh/php-cs-fixer-styleci-bridge/autoload.php'; + +use SLLH\StyleCIBridge\ConfigBridge; + +$header = << -return Symfony\CS\Config\Config::create() - ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) - ->fixers(array( - '-unalign_double_arrow', - '-unalign_equals', - 'align_double_arrow', - 'newline_after_open_tag', - 'ordered_use', - 'long_array_syntax', - )) +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +// PHP-CS-Fixer 1.x +if (class_exists('Symfony\CS\Fixer\Contrib\HeaderCommentFixer')) { + \Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header); +} + +$config = ConfigBridge::create() ->setUsingCache(true) - ->finder($finder) ; + +// PHP-CS-Fixer 2.x +if (method_exists($config, 'setRules')) { + $config->setRules(array_merge($config->getRules(), array( + 'header_comment' => array('header' => $header) + ))); +} + +return $config; diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 000000000..8b1384c41 --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,27 @@ +# DO NOT EDIT THIS FILE! +# +# It's auto-generated by sonata-project/dev-kit package. +# +# Package `sllh/php-cs-fixer-styleci-bridge` is required to get it working. + +preset: symfony + +enabled: + - combine_consecutive_unsets + - long_array_syntax + - newline_after_open_tag + - no_php4_constructor + - no_useless_else + - ordered_class_elements + - ordered_use +# Comment strict rules for the moment. Should be uncomment later to see StyleCI PR results +# - strict +# - strict_param +# - php_unit_construct +# - php_unit_strict + +finder: + exclude: + - 'Tests/Fixtures' + # ecommerce special case: + - 'Resources/skeleton' diff --git a/.travis.yml b/.travis.yml index b6551dd09..a69f901e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,63 +1,75 @@ +# DO NOT EDIT THIS FILE! +# +# It's auto-generated by sonata-project/dev-kit package. + +branches: + only: + - master + language: php php: + - '5.3' + - '5.4' + - '5.5' + - '5.6' + - '7.0' + - nightly - hhvm sudo: false cache: + pip: true directories: - - $HOME/.composer/cache - - $HOME/.cache/pip + - $HOME/.composer/cache/files env: global: - - PATH="$HOME/.composer/vendor/bin:$PATH" + - PATH="$HOME/.local/bin:$PATH" - SYMFONY_DEPRECATIONS_HELPER=weak + - TARGET=test + - UPSTREAM_URL=https://github.com/sonata-project/ecommerce.git + - XMLLINT_INDENT=" " matrix: fast_finish: true include: - - php: 5.3 - env: SYMFONY_VERSION=2.8.* - - php: 5.4 - env: SYMFONY_VERSION=2.8.* - - php: 5.6 - env: SYMFONY_VERSION=2.8.* CS_FIXER=run - - php: 5.3 - env: SYMFONY_VERSION=2.3.* COMPOSER_FLAGS="--prefer-lowest" - - php: 5.6 - env: SYMFONY_VERSION=2.3.* - - php: 5.6 - env: SYMFONY_VERSION=2.7.* - - php: 5.6 - env: SYMFONY_VERSION=2.8.* - - php: 5.5 - env: SYMFONY_VERSION="3.0.*" ACL_VERSION="dev-master" - - php: 5.6 - env: SYMFONY_VERSION="3.0.*" ACL_VERSION="dev-master" - - php: 7.0 - env: SYMFONY_VERSION="3.0.*" ACL_VERSION="dev-master" - + - php: '7.0' + env: TARGET=docs + - php: '7.0' + env: TARGET=lint + - php: '5.3' + env: COMPOSER_FLAGS="--prefer-lowest" + - php: '7.0' + env: SYMFONY=2.3.* + - php: '7.0' + env: SYMFONY=2.7.* + - php: '7.0' + env: SYMFONY=2.8.* + - php: '7.0' + env: SYMFONY=dev-master@dev + - php: '7.0' + env: SYMFONY_DEPRECATIONS_HELPER=0 allow_failures: + - php: nightly - php: hhvm + - env: SYMFONY_DEPRECATIONS_HELPER=0 + - env: SYMFONY=dev-master@dev + +before_install: + - git remote add upstream ${UPSTREAM_URL} && git fetch --all + - if [[ -x .travis/check_relevant_${TARGET}.sh && "$TRAVIS_PULL_REQUEST" != "false" ]]; then export RELEVANT=$(.travis/check_relevant_${TARGET}.sh); fi; + - if [[ ! -z ${RELEVANT} ]];then exit 0; fi; + - if [ -x .travis/before_install_${TARGET}.sh ]; then .travis/before_install_${TARGET}.sh; fi; + +install: + - if [ -x .travis/install_${TARGET}.sh ]; then .travis/install_${TARGET}.sh; fi; before_script: - - (phpenv config-rm xdebug.ini || exit 0) - - mkdir -p ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d && echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - composer selfupdate - - composer config -q -g github-oauth.github.com $GITHUB_OAUTH_TOKEN - - composer global require phpunit/phpunit:@stable fabpot/php-cs-fixer --no-update - - composer global update --prefer-dist --no-interaction - - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; - - if [ "$ACL_VERSION" != "" ]; then composer require "symfony/security-acl:${ACL_VERSION}" --no-update; fi; - - travis_wait composer update --prefer-dist --no-interaction $COMPOSER_FLAGS - - export PATH=$HOME/.local/bin:$PATH - - pip install -r docs/requirements.txt --user `whoami` - -script: - - if [ "$CS_FIXER" = "run" ]; then make cs_dry_run ; fi; - - make test - -notifications: - webhooks: https://sonata-project.org/bundles/ecommerce/master/travis + - if [ -x .travis/before_script_${TARGET}.sh ]; then .travis/before_script_${TARGET}.sh; fi; + +script: make $TARGET + +after_success: + - if [ -x .travis/after_success_${TARGET}.sh ]; then .travis/after_success_${TARGET}.sh; fi; diff --git a/.travis/after_success_test.sh b/.travis/after_success_test.sh new file mode 100755 index 000000000..87158518b --- /dev/null +++ b/.travis/after_success_test.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +set -ev + +coveralls -v diff --git a/.travis/before_install_test.sh b/.travis/before_install_test.sh new file mode 100755 index 000000000..616712a3f --- /dev/null +++ b/.travis/before_install_test.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env sh +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 + + 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; diff --git a/.travis/before_script_test.sh b/.travis/before_script_test.sh new file mode 100755 index 000000000..329e9d9c1 --- /dev/null +++ b/.travis/before_script_test.sh @@ -0,0 +1,6 @@ +#!/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 diff --git a/.travis/check_relevant_docs.sh b/.travis/check_relevant_docs.sh new file mode 100755 index 000000000..9e618c4e2 --- /dev/null +++ b/.travis/check_relevant_docs.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ev + +RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.rst') + +if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi; diff --git a/.travis/check_relevant_lint.sh b/.travis/check_relevant_lint.sh new file mode 100755 index 000000000..42be76763 --- /dev/null +++ b/.travis/check_relevant_lint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ev + +RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.json' '*.yml' '*.xml' '*.xliff') + +if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi; diff --git a/.travis/check_relevant_test.sh b/.travis/check_relevant_test.sh new file mode 100755 index 000000000..a4ad29036 --- /dev/null +++ b/.travis/check_relevant_test.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -ev + +RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.php' '*.yml' '*.xml' '*.twig' '*.js' '*.css' '*.json') + +if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi; diff --git a/.travis/install_docs.sh b/.travis/install_docs.sh new file mode 100755 index 000000000..e638352b6 --- /dev/null +++ b/.travis/install_docs.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +set -ev + +pip install -r Resources/doc/requirements.txt --user $(whoami) diff --git a/.travis/install_lint.sh b/.travis/install_lint.sh new file mode 100755 index 000000000..ab8f0f390 --- /dev/null +++ b/.travis/install_lint.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +set -ev + +composer global require sllh/composer-lint:@stable --prefer-dist --no-interaction + +gem install yaml-lint diff --git a/.travis/install_test.sh b/.travis/install_test.sh new file mode 100755 index 000000000..b692108bb --- /dev/null +++ b/.travis/install_test.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env sh +set -ev + +mkdir --parents "${HOME}/bin" + +# PHPUnit install +if [ ${TRAVIS_PHP_VERSION} '<' '5.6' ]; then + PHPUNIT_PHAR=phpunit-old.phar +else + PHPUNIT_PHAR=phpunit.phar +fi +wget "https://phar.phpunit.de/${PHPUNIT_PHAR}" --output-document="${HOME}/bin/phpunit" +chmod u+x "${HOME}/bin/phpunit" + +# Coveralls client install +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 +composer update --prefer-dist --no-interaction --prefer-stable ${COMPOSER_FLAGS} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 044c54c27..7bec32a53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,53 +1,286 @@ -Sonata respects the symfony’s conventions about contributing to the code. So before going further please review the [contributing documentation of Symfony](http://symfony.com/doc/current/contributing/code/patches.html#make-a-pull-request). +# Sonata project contribution -## Reporting bugs +Thanks for your interest in Sonata projects! -If you happen to find a bug, we kindly request you to report it. However, before submitting it, please: +## Summary - * Check the [project documentation available online](https://sonata-project.org/bundles/) +* [Issues](#issues) +* [Pull Requests](#pull-requests) +* [Label rules]() -Then, if it appears that it’s a real bug, you may report it using Github by following these 3 points: +## Issues - * Check if the bug is not already reported! - * A clear title to resume the issue - * A description of the workflow needed to reproduce the bug, +First, check if you are up to date: is your version still supported, and are +you using the latest patch version? -> _NOTE:_ Don’t hesitate giving as much information as you can (OS, PHP version extensions …) +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), +using the `sonata` tags. -## Pull requests +If you happen to find a bug, we kindly request you report it. However, +before submitting it, please check the [project documentation available +online](https://sonata-project.org/bundles/). -### Matching coding standards +Then, if it appears that it is indeed a real bug, you may report it using +Github by following these points are taken care of: -Before each commit, be sure to match sonata coding standards by running the following command for fix: +* Check if the bug is not already reported! +* The title sums up the issue with clarity. +* A description of the workflow needed to reproduce the bug. Please try to make + sentences, dumping an error message by itself is frowned upon. +* If your issue is an error page, you must provide us with a stack trace. With + recent versions of Symfony, you can even get stack traces as plain text at the +end of the page. Just look for "Stack Trace (Plain Text)", and copy/paste what +you see. **Do not** make a screenshot of the stack trace, as screenshots are +not indexed by search engines and will make it difficult for other people to +find your bug report. If you have an issue when using the Symfony CLI, +use the `-vvv` option to get a stack trace. +* Screenshots should be considered additional data, and therefore, you should + always provide a textual description of the bug. It is strongly recommended +to provide them when reporting UI-related bugs. +* If you need to provide code, make sure you know how to get syntactic + coloration, in particular with [fenced code +blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/). +When you feel the code is to long, use external code pastebin like +https://gist.github.com/ or http://hastebin.com/ . If this is not sufficient, +just create a repository to show the issue. + +> _NOTE:_ Don't hesitate to give as much information as you can (OS, PHP +> version, extensions...) + +## Pull Requests + +All the sonata team will be glad to review your code changes propositions! :smile: + +But please, read the following before. + +### The content + +#### 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. + +Please [install PHP Coding Standard Fixer](http://cs.sensiolabs.org/#installation) +and run this command before committing your modifications: ```bash -make cs +php-cs-fixer fix --verbose ``` -And then, add fixed file to your commit before push. +#### The documentation + +The documentation is mostly written with the `rst` format. You can test the doc rendering with the `make docs` command. + +If your PR contains a new feature, you must add documentation for it. + +#### The tests + +If your PR contains a fix, tests should be added to prove the bug. + +If your PR contains an addition, a new feature, this one has to be fully covered by tests. + +Some rules have to be respected about the test: + +* Annotations about coverage are prohibited. This concerns: + * `@covers` + * `@coversDefaultClass` + * `@coversNothing` + * `@codeCoverageIgnore` + * `@codeCoverageIgnoreStart` + * `@codeCoverageIgnoreEnd` +* All test methods should be prefixed by `test`. Example: `public function testItReturnsNull()`. +* All test method names must be in camel case format. +* As opposed, the `@test` annotation is prohibited. +* 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()`. + +### Writing a Pull Request + +#### The subject -Be sure to add only **your modified files**. If another files are fixed by cs tools, just revert it before commit. +Ideally, a Pull Request should concern one and **only one** subject, so that it +remains clear, and independent changes can be merged quickly. -### Sending a Pull Request +If you want to fix a typo and improve the performance of a process, you should +try as much as possible to do it in a **separate** PR, so that we can quickly +merge one while discussing the other. -When you send a PR, just make sure that: +The goal is to have a clear commit history and make a possible revert easier. -* You add valid test cases. -* Tests are green. -* The related documentation is up-to-date. -* You make the PR on the same branch you based your changes on. If you see commits -that you did not make in your PR, you're doing it wrong. -* Also don't forget to add a comment when you update a PR with a ping to the maintainer (``@username``), so he/she will get a notification. +If you found an issue/typo while writing your change that is not related to +your work, please do another PR for that. In some rare cases, you might be +forced to do it on the same PR. In this kind of situation, please add a comment +on your PR explaining why you feel it is the case. -## Contributing to the documentation +#### The Change log -You need to install the python tool to check and validate the sphinx syntax: +For each PR, a change log must be provided. - pip install -r Resources/doc/requirements.txt +There are few cases where no change log is necessary: -and you can check the documentation with the command: +* When you fix a bug on an unreleased feature. +* When your PR concerns only the documentation (fix or improvement). - cd Resources/doc/ - rm -rf _build && sphinx-build -W -b html -d _build/doctrees . _build/html +**Do not** edit the `CHANGELOG.md` directly though, because having every +contributor write PR with changes in the same file, at roughly the same line is +a recipe for conflicts. Instead, fill in the dedicated section that should +appear in a textaread when submitting your PR. -The html will be available in the ``_build/html`` folder. +Your note can be put on one of these sections: + +* `Added` for new features. +* `Changed` for changes in existing functionality. +* `Deprecated` for deprecation of features that will be removed in next major release. +* `Removed` for deprecated features removed in this release. +* `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/) + +#### The 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. + +Here is a short table resuming on which you have to start: + +Kind of modification | Backward Compatible (BC) | Type of release | Branch to target | Label | +-------------------- | ------------------------ | --------------- | ----------------------- | ----- | +Bug fixes | Yes | Patch | `master` | | +Bug fixes | No (Only if no choice) | Major | `master` | | +Feature | Yes | Minor | `master` | | +Feature | No (Only if no choice) | Major | `master` | | +Deprecation | Yes (Have to) | Minor | `master` | | +Deprecation removal | No (Can't be) | Major | `master` | | + +Notes: + * Branch `master` is the branch of the **latest stable** minor release and + has to be used for Backward compatible PRs. + * If you PR is not **Backward Compatible** but can be, it **must** be: + * Changing a function/method signature? Prefer create a new one and deprecate the old one. + * Code deletion? Don't. Please deprecate it instead. + * If your BC PR is accepted, you can do a new one on the `master` branch which removes the deprecated code. + * SYMFONY DOC REF (same logic)? + +If you have a non-BC PR to propose, please try to create a related BC PR first. +This BC PR should mark every piece of code that needs to be removed / uncommented / reworked +in the corresponding non-BC PR with the following marker comment : `NEXT_MAJOR`. +When the BC PR is merged in the stable branch, wait for the stable branch to be +merged in the unstable branch, and then work on your non-BC PR. + +For instance, assuming you want to introduce a new method to an existing interface, you should do something like this: + +```php + Date: Fri, 24 Jun 2016 14:58:04 +0200 Subject: [PATCH 2/4] Applied fixes from StyleCI (#376) --- src/BasketBundle/Block/BasketBlockService.php | 4 +- .../Controller/Api/BasketController.php | 90 ++-- .../Controller/BasketController.php | 44 +- .../Compiler/GlobalVariableCompilerPass.php | 2 +- .../DependencyInjection/Configuration.php | 2 +- .../SonataBasketExtension.php | 42 +- src/BasketBundle/Entity/BaseBasket.php | 2 +- src/BasketBundle/Entity/BaseBasketElement.php | 2 +- src/BasketBundle/Form/AddressType.php | 70 ++-- .../Form/ApiBasketElementParentType.php | 2 +- .../Form/ApiBasketElementType.php | 4 +- src/BasketBundle/Form/ApiBasketParentType.php | 2 +- src/BasketBundle/Form/ApiBasketType.php | 8 +- src/BasketBundle/Form/BasketType.php | 2 +- src/BasketBundle/Form/PaymentType.php | 14 +- src/BasketBundle/Form/ShippingType.php | 8 +- .../Serializer/BasketSerializerHandler.php | 2 +- src/BasketBundle/SonataBasketBundle.php | 16 +- src/BasketBundle/Twig/GlobalVariables.php | 2 +- src/Component/Basket/BaseBasketFactory.php | 26 +- src/Component/Basket/Basket.php | 20 +- src/Component/Basket/BasketBuilder.php | 17 +- .../Basket/BasketBuilderInterface.php | 9 + src/Component/Basket/BasketElement.php | 50 +-- .../Basket/BasketElementInterface.php | 2 +- src/Component/Basket/BasketElementManager.php | 9 + .../Basket/BasketElementManagerInterface.php | 9 + src/Component/Basket/BasketEntityFactory.php | 2 +- .../Basket/BasketFactoryInterface.php | 9 + src/Component/Basket/BasketInterface.php | 2 +- src/Component/Basket/BasketManager.php | 9 + .../Basket/BasketManagerInterface.php | 2 +- src/Component/Basket/BasketSessionFactory.php | 8 +- .../Basket/InvalidBasketStateException.php | 2 +- .../Basket/InvalidProductException.php | 2 +- src/Component/Basket/Loader.php | 2 +- src/Component/Currency/Currency.php | 3 +- .../Currency/CurrencyDataTransformer.php | 2 +- src/Component/Currency/CurrencyDetector.php | 14 +- .../Currency/CurrencyDetectorInterface.php | 2 +- .../Currency/CurrencyDoctrineType.php | 2 +- src/Component/Currency/CurrencyFormType.php | 2 +- src/Component/Currency/CurrencyInterface.php | 2 +- src/Component/Currency/CurrencyManager.php | 2 +- .../Currency/CurrencyManagerInterface.php | 2 +- .../Currency/CurrencyPriceCalculator.php | 9 + .../CurrencyPriceCalculatorInterface.php | 2 +- .../UnavailableForCurrencyException.php | 2 +- src/Component/Customer/AddressInterface.php | 6 +- .../Customer/AddressManagerInterface.php | 2 +- src/Component/Customer/CustomerInterface.php | 2 +- .../Customer/CustomerManagerInterface.php | 2 +- src/Component/Customer/CustomerSelector.php | 19 +- .../Customer/CustomerSelectorInterface.php | 9 + .../Delivery/BaseServiceDelivery.php | 14 +- src/Component/Delivery/FreeDelivery.php | 2 +- src/Component/Delivery/Pool.php | 2 +- src/Component/Delivery/Selector.php | 22 +- .../Delivery/ServiceDeliveryInterface.php | 14 +- .../ServiceDeliverySelectorInterface.php | 2 +- .../UndeliverableCountryException.php | 2 +- src/Component/Event/AddBasketElementEvent.php | 8 +- .../Event/AfterCalculatePriceEvent.php | 2 +- src/Component/Event/BasketEvents.php | 8 +- src/Component/Event/BasketTransformEvent.php | 2 +- .../Event/BeforeCalculatePriceEvent.php | 6 +- src/Component/Event/InvoiceTransformEvent.php | 2 +- src/Component/Event/OrderTransformEvent.php | 2 +- src/Component/Event/PaymentEvent.php | 6 +- src/Component/Event/PaymentEvents.php | 8 +- src/Component/Event/TransformerEvents.php | 12 +- src/Component/Form/Basket.php | 2 +- src/Component/Form/BasketValidator.php | 4 +- .../BasketResizeFormListener.php | 34 +- .../Transformer/DeliveryMethodTransformer.php | 2 +- .../Transformer/PaymentMethodTransformer.php | 2 +- .../Form/Transformer/QuantityTransformer.php | 14 +- .../Transformer/SerializeDataTransformer.php | 2 +- .../Form/Type/DeliveryChoiceType.php | 2 +- .../Form/Type/VariationChoiceType.php | 12 +- src/Component/Generator/Mustache.php | 4 +- src/Component/Generator/MysqlReference.php | 2 +- .../Generator/ReferenceInterface.php | 2 +- .../Invoice/InvoiceElementInterface.php | 2 +- .../InvoiceElementManagerInterface.php | 2 +- src/Component/Invoice/InvoiceInterface.php | 6 +- .../Invoice/InvoiceManagerInterface.php | 2 +- .../Invoice/InvoiceStatusRenderer.php | 2 +- src/Component/Order/OrderElementInterface.php | 2 +- .../Order/OrderElementManagerInterface.php | 2 +- src/Component/Order/OrderInterface.php | 14 +- src/Component/Order/OrderManagerInterface.php | 2 +- src/Component/Order/OrderStatusRenderer.php | 2 +- src/Component/Payment/BasePayment.php | 2 +- src/Component/Payment/BasePaypal.php | 60 +-- src/Component/Payment/CheckPayment.php | 12 +- src/Component/Payment/Debug/DebugPayment.php | 10 +- .../Payment/InvalidTransactionException.php | 2 +- src/Component/Payment/Ogone/OgonePayment.php | 106 ++--- src/Component/Payment/PassPayment.php | 10 +- src/Component/Payment/PaymentHandler.php | 24 +- .../Payment/PaymentHandlerInterface.php | 2 +- src/Component/Payment/PaymentInterface.php | 2 +- .../Payment/PaymentNotFoundException.php | 2 +- .../Payment/PaymentSelectorInterface.php | 2 +- src/Component/Payment/Paypal.php | 66 +-- src/Component/Payment/Pool.php | 2 +- .../NodeScelliusTransactionGenerator.php | 2 +- .../OrderScelliusTransactionGenerator.php | 2 +- .../Payment/Scellius/ScelliusPayment.php | 394 +++++++++--------- .../ScelliusTransactionGeneratorInterface.php | 2 +- src/Component/Payment/Selector.php | 2 +- .../Payment/TransactionInterface.php | 20 +- .../Payment/TransactionManagerInterface.php | 2 +- src/Component/Product/AddBasket.php | 4 +- src/Component/Product/DeliveryInterface.php | 2 +- .../Product/DeliveryManagerInterface.php | 2 +- src/Component/Product/PackageInterface.php | 2 +- .../Product/PackageManagerInterface.php | 2 +- src/Component/Product/Pool.php | 2 +- .../Product/PriceComputableInterface.php | 2 +- .../Product/ProductCategoryInterface.php | 3 +- .../ProductCategoryManagerInterface.php | 2 +- .../Product/ProductCollectionInterface.php | 10 + .../ProductCollectionManagerInterface.php | 2 +- src/Component/Product/ProductDefinition.php | 4 +- src/Component/Product/ProductFinder.php | 2 +- .../Product/ProductFinderInterface.php | 2 +- src/Component/Product/ProductInterface.php | 16 +- .../Product/ProductManagerInterface.php | 2 +- .../Product/ProductProviderInterface.php | 2 +- src/Component/Product/SeoProductIterator.php | 2 +- .../Status/StatusClassRendererInterface.php | 2 +- .../Subscriber/ORMInheritanceSubscriber.php | 4 +- src/Component/Transformer/BaseTransformer.php | 2 +- .../Transformer/BasketTransformer.php | 8 +- .../Transformer/InvoiceTransformer.php | 6 +- .../Transformer/OrderTransformer.php | 10 +- src/Component/Transformer/Pool.php | 2 +- src/CustomerBundle/Admin/AddressAdmin.php | 2 +- src/CustomerBundle/Admin/CustomerAdmin.php | 6 +- .../CustomerAddressBreadcrumbBlockService.php | 4 +- .../Block/RecentCustomersBlockService.php | 20 +- .../Controller/Api/AddressController.php | 12 +- .../Controller/Api/CustomerController.php | 82 ++-- .../Controller/CustomerController.php | 12 +- .../DependencyInjection/Configuration.php | 2 +- .../SonataCustomerExtension.php | 44 +- src/CustomerBundle/Entity/AddressManager.php | 2 +- src/CustomerBundle/Entity/BaseAddress.php | 66 +-- src/CustomerBundle/Entity/BaseCustomer.php | 21 +- src/CustomerBundle/Entity/CustomerManager.php | 2 +- src/CustomerBundle/Form/Type/AddressType.php | 56 +-- .../Form/Type/AddressTypeType.php | 3 +- .../Form/Type/ApiAddressType.php | 2 +- .../Form/Type/ApiCustomerType.php | 2 +- .../Serializer/CustomerSerializerHandler.php | 2 +- src/CustomerBundle/SonataCustomerBundle.php | 8 +- .../Twig/Extension/AddressExtension.php | 18 +- .../DependencyInjection/Configuration.php | 2 +- .../SonataDeliveryExtension.php | 11 +- src/DeliveryBundle/SonataDeliveryBundle.php | 2 +- src/InvoiceBundle/Admin/InvoiceAdmin.php | 2 +- .../Controller/Api/InvoiceController.php | 8 +- .../Controller/InvoiceController.php | 4 +- .../DependencyInjection/Configuration.php | 2 +- .../SonataInvoiceExtension.php | 50 +-- src/InvoiceBundle/Entity/BaseInvoice.php | 38 +- .../Entity/BaseInvoiceElement.php | 2 +- .../Entity/InvoiceElementManager.php | 2 +- src/InvoiceBundle/Entity/InvoiceManager.php | 2 +- .../Form/Type/InvoiceStatusType.php | 3 +- .../Serializer/InvoiceSerializerHandler.php | 2 +- src/InvoiceBundle/SonataInvoiceBundle.php | 2 +- src/OrderBundle/Admin/OrderAdmin.php | 2 +- src/OrderBundle/Admin/OrderElementAdmin.php | 2 +- .../UserOrderBreadcrumbBlockService.php | 4 +- .../Block/RecentOrdersBlockService.php | 24 +- .../Controller/Api/OrderController.php | 10 +- .../Controller/OrderCRUDController.php | 9 + .../Controller/OrderController.php | 6 +- .../Compiler/StatusRendererCompilerPass.php | 2 +- .../DependencyInjection/Configuration.php | 2 +- .../SonataOrderExtension.php | 42 +- src/OrderBundle/Entity/BaseOrder.php | 57 +-- src/OrderBundle/Entity/BaseOrderElement.php | 25 +- .../Entity/OrderElementManager.php | 2 +- src/OrderBundle/Entity/OrderManager.php | 2 +- src/OrderBundle/Form/Type/OrderStatusType.php | 3 +- .../OrderElementSerializerHandler.php | 2 +- .../Serializer/OrderSerializerHandler.php | 2 +- src/OrderBundle/SonataOrderBundle.php | 2 +- .../Consumer/PaymentProcessOrderConsumer.php | 16 +- .../PaymentProcessOrderElementConsumer.php | 14 +- .../Controller/DebugPaymentController.php | 2 +- .../Controller/PaymentController.php | 2 +- .../DependencyInjection/Configuration.php | 24 +- .../SonataPaymentExtension.php | 32 +- src/PaymentBundle/Entity/BaseTransaction.php | 26 +- .../Entity/TransactionManager.php | 2 +- .../Type/PaymentTransactionStatusType.php | 3 +- src/PaymentBundle/SonataPaymentBundle.php | 2 +- .../DependencyInjection/Configuration.php | 2 +- .../SonataPriceExtension.php | 2 +- src/PriceBundle/SonataPriceBundle.php | 4 +- src/ProductBundle/Admin/DeliveryAdmin.php | 40 +- src/ProductBundle/Admin/ProductAdmin.php | 128 +++--- .../Admin/ProductCategoryAdmin.php | 40 +- .../Admin/ProductCollectionAdmin.php | 40 +- .../Admin/ProductVariationAdmin.php | 10 +- .../Block/CatalogBreadcrumbBlockService.php | 14 +- .../Block/CategoriesMenuBlockService.php | 6 +- .../Block/FiltersMenuBlockService.php | 4 +- .../Block/RecentProductsBlockService.php | 20 +- .../Block/SimilarProductsBlockService.php | 22 +- .../Block/VariationsFormBlockService.php | 50 +-- .../Command/GenerateProductCommand.php | 26 +- .../Controller/Api/ProductController.php | 108 ++--- .../Controller/BaseProductController.php | 18 +- .../Controller/CatalogController.php | 22 +- .../Controller/CategoryAdminController.php | 2 +- .../Controller/CategoryController.php | 6 +- .../Controller/CollectionAdminController.php | 2 +- .../Controller/CollectionController.php | 6 +- .../Controller/ProductAdminController.php | 8 +- .../Controller/ProductController.php | 26 +- .../ProductVariationAdminController.php | 12 +- .../AddProductProviderCompilerPass.php | 2 +- .../DependencyInjection/Configuration.php | 2 +- .../SonataProductExtension.php | 178 ++++---- src/ProductBundle/Entity/BaseDelivery.php | 34 +- src/ProductBundle/Entity/BasePackage.php | 2 +- src/ProductBundle/Entity/BaseProduct.php | 54 +-- .../Entity/BaseProductCategory.php | 2 +- .../Entity/BaseProductCollection.php | 2 +- src/ProductBundle/Entity/DeliveryManager.php | 2 +- src/ProductBundle/Entity/PackageManager.php | 2 +- .../Entity/ProductCategoryManager.php | 2 +- .../Entity/ProductCollectionManager.php | 2 +- src/ProductBundle/Entity/ProductManager.php | 118 +++--- .../Entity/ProductSetManager.php | 2 +- .../Form/Type/ApiProductParentType.php | 2 +- .../Form/Type/ApiProductType.php | 6 +- .../Form/Type/ProductDeliveryStatusType.php | 3 +- src/ProductBundle/Menu/ProductMenuBuilder.php | 14 +- .../Model/BaseProductProvider.php | 52 +-- .../Model/DoctrineModelManager.php | 2 +- .../Repository/BaseProductRepository.php | 2 +- src/ProductBundle/Seo/Services/Facebook.php | 13 +- .../Seo/Services/ServiceInterface.php | 9 + src/ProductBundle/Seo/Services/Twitter.php | 9 + .../Serializer/ProductSerializerHandler.php | 2 +- src/ProductBundle/SonataProductBundle.php | 10 +- .../Twig/Extension/ProductExtension.php | 18 +- .../Block/BasketBlockServiceTest.php | 2 +- .../Controller/Api/BasketControllerTest.php | 2 +- tests/BasketBundle/Entity/BaseBasketTest.php | 2 +- .../BasketBundle/Entity/BasketElementTest.php | 2 +- .../Form/ApiBasketElementTypeTest.php | 2 +- tests/BasketBundle/Form/ApiBasketTypeTest.php | 2 +- tests/BasketBundle/Resources/XliffTest.php | 2 +- tests/Component/Basket/Address.php | 2 +- .../Basket/BaseBasketFactoryTest.php | 2 +- tests/Component/Basket/BasketBuilderTest.php | 2 +- .../Basket/BasketElementManagerTest.php | 2 +- tests/Component/Basket/BasketElementTest.php | 2 +- .../Basket/BasketEntityFactoryTest.php | 2 +- tests/Component/Basket/BasketManagerTest.php | 43 +- .../Basket/BasketSessionFactoryTest.php | 2 +- tests/Component/Basket/BasketTest.php | 4 +- tests/Component/Basket/Delivery.php | 2 +- tests/Component/Basket/LoaderTest.php | 12 +- tests/Component/Basket/Order.php | 2 +- tests/Component/Basket/Payment.php | 2 +- tests/Component/Basket/Product.php | 2 +- .../Currency/CurrencyDataTransformerTest.php | 2 +- .../Currency/CurrencyDetectorTest.php | 2 +- .../Currency/CurrencyDoctrineTypeTest.php | 8 +- .../Currency/CurrencyFormTypeTest.php | 2 +- .../Currency/CurrencyManagerTest.php | 2 +- .../Currency/CurrencyPriceCalculatorTest.php | 2 +- tests/Component/Currency/CurrencyTest.php | 2 +- .../Customer/CustomerSelectorTest.php | 2 +- tests/Component/Customer/ValidUser.php | 2 +- tests/Component/Delivery/BaseDeliveryTest.php | 18 +- tests/Component/Delivery/FreeDeliveryTest.php | 2 +- tests/Component/Delivery/SelectorTest.php | 20 +- .../Delivery/ServiceDeliveryTest.php | 14 +- tests/Component/Form/BasketValidatorTest.php | 2 +- .../BasketResizeFormListenerTest.php | 4 +- .../DeliveryMethodTransformerTest.php | 2 +- .../PaymentMethodTransformerTest.php | 2 +- tests/Component/Generator/MustacheTest.php | 2 +- .../Generator/MysqlReferenceTest.php | 2 +- .../Invoice/InvoiceStatusRendererTest.php | 4 +- .../Order/OrderStatusRendererTest.php | 2 +- tests/Component/Payment/BasePaymentTest.php | 2 +- tests/Component/Payment/CheckPaymentTest.php | 2 +- tests/Component/Payment/DebugPaymentTest.php | 32 +- .../Payment/Ogone/OgonePaymentTest.php | 118 +++--- tests/Component/Payment/PassPaymentTest.php | 2 +- .../Component/Payment/PaymentHandlerTest.php | 44 +- tests/Component/Payment/PaypalTest.php | 38 +- tests/Component/Payment/PoolTest.php | 2 +- .../NodeScelliusTransactionGeneratorTest.php | 2 +- .../OrderScelliusTransactionGeneratorTest.php | 2 +- .../Payment/Scellius/ScelliusPaymentTest.php | 67 +-- tests/Component/Payment/SelectorTest.php | 2 +- .../Product/BaseProductServiceTest.php | 54 +-- tests/Component/Product/ProductFinderTest.php | 2 +- tests/Component/Product/ProductPoolTest.php | 2 +- .../ORMInheritanceSubscriberTest.php | 2 +- .../Transformer/BasketTransformerTest.php | 14 +- .../Transformer/InvoiceTransformerTest.php | 9 + .../Transformer/OrderTransformerTest.php | 2 +- tests/Component/Transformer/PoolTest.php | 2 +- .../Block/RecentCustomersBlockServiceTest.php | 2 +- .../Controller/Api/AddressControllerTest.php | 2 +- .../Controller/Api/CustomerControllerTest.php | 6 +- .../Entity/AddressManagerTest.php | 43 +- .../Entity/BaseCustomerTest.php | 2 +- .../Entity/CustomerManagerTest.php | 43 +- tests/CustomerBundle/Resources/XliffTest.php | 2 +- .../Twig/Extension/AddressExtensionTest.php | 22 +- tests/DeliveryBundle/Resources/XliffTest.php | 2 +- .../Controller/Api/InvoiceControllerTest.php | 4 +- .../InvoiceBundle/Entity/BaseInvoiceTest.php | 2 +- .../Entity/InvoiceManagerTest.php | 43 +- tests/InvoiceBundle/Resources/XliffTest.php | 2 +- .../Controller/Api/OrderControllerTest.php | 4 +- tests/OrderBundle/Entity/BaseOrderTest.php | 2 +- tests/OrderBundle/Entity/OrderManagerTest.php | 43 +- tests/OrderBundle/Resources/XliffTest.php | 2 +- ...PaymentProcessOrderElementConsumerTest.php | 4 +- .../Entity/BaseTransactionTest.php | 12 +- tests/PaymentBundle/Resources/XliffTest.php | 2 +- .../SonataPriceExtensionTest.php | 2 +- tests/PriceBundle/Resources/XliffTest.php | 2 +- .../Command/GenerateProductCommandTest.php | 2 +- .../Controller/Api/ProductControllerTest.php | 14 +- .../DependencyInjection/ConfigurationTest.php | 24 +- .../ProductBundle/Entity/BaseProductTest.php | 2 +- .../Entity/ProductManagerTest.php | 40 +- .../Form/Type/ApiProductTypeTest.php | 2 +- .../Menu/ProductMenuBuilderTest.php | 2 +- .../Model/BaseProductProviderTest.php | 6 +- tests/ProductBundle/Resources/XliffTest.php | 2 +- .../Seo/Services/FacebookTest.php | 9 + .../Seo/Services/TwitterTest.php | 9 + tests/bootstrap.php | 6 +- 350 files changed, 2392 insertions(+), 2187 deletions(-) diff --git a/src/BasketBundle/Block/BasketBlockService.php b/src/BasketBundle/Block/BasketBlockService.php index abf8ea038..e5bb4b568 100644 --- a/src/BasketBundle/Block/BasketBlockService.php +++ b/src/BasketBundle/Block/BasketBlockService.php @@ -1,7 +1,7 @@ * @@ -30,7 +30,7 @@ class BasketBlockService extends BaseBlockService public function execute(BlockContextInterface $blockContext, Response $response = null) { return $this->renderResponse($blockContext->getTemplate(), array( - 'block' => $blockContext->getBlock(), + 'block' => $blockContext->getBlock(), ), $response); } diff --git a/src/BasketBundle/Controller/Api/BasketController.php b/src/BasketBundle/Controller/Api/BasketController.php index 1a4a4b437..40c2cc888 100644 --- a/src/BasketBundle/Controller/Api/BasketController.php +++ b/src/BasketBundle/Controller/Api/BasketController.php @@ -1,7 +1,7 @@ * @@ -72,11 +72,11 @@ class BasketController */ public function __construct(BasketManagerInterface $basketManager, BasketElementManagerInterface $basketElementManager, ProductManagerInterface $productManager, BasketBuilderInterface $basketBuilder, FormFactoryInterface $formFactory) { - $this->basketManager = $basketManager; + $this->basketManager = $basketManager; $this->basketElementManager = $basketElementManager; - $this->productManager = $productManager; - $this->basketBuilder = $basketBuilder; - $this->formFactory = $formFactory; + $this->productManager = $productManager; + $this->basketBuilder = $basketBuilder; + $this->formFactory = $formFactory; } /** @@ -103,9 +103,9 @@ public function getBasketsAction(ParamFetcherInterface $paramFetcher) $supportedCriteria = array( ); - $page = $paramFetcher->get('page'); - $limit = $paramFetcher->get('count'); - $sort = $paramFetcher->get('orderBy'); + $page = $paramFetcher->get('page'); + $limit = $paramFetcher->get('count'); + $sort = $paramFetcher->get('orderBy'); $criteria = array_intersect_key($paramFetcher->all(), $supportedCriteria); foreach ($criteria as $key => $value) { @@ -258,43 +258,6 @@ public function deleteBasketAction($id) return array('deleted' => true); } - /** - * Write a basket, this method is used by both POST and PUT action methods. - * - * @param Request $request Symfony request - * @param int|null $id A basket identifier - * - * @return \FOS\RestBundle\View\View|FormInterface - */ - protected function handleWriteBasket($request, $id = null) - { - $basket = $id ? $this->getBasket($id) : null; - - $form = $this->formFactory->createNamed(null, 'sonata_basket_api_form_basket', $basket, array( - 'csrf_protection' => false, - )); - - $form->bind($request); - - if ($form->isValid()) { - $basket = $form->getData(); - if ($basket->getCustomerId()) { - $this->checkExistingCustomerBasket($basket->getCustomerId()); - } - $this->basketManager->save($basket); - - $view = \FOS\RestBundle\View\View::create($basket); - $serializationContext = SerializationContext::create(); - $serializationContext->setGroups(array('sonata_api_read')); - $serializationContext->enableMaxDepthChecks(); - $view->setSerializationContext($serializationContext); - - return $view; - } - - return $form; - } - /** * Adds a basket element to a basket. * @@ -404,6 +367,43 @@ public function deleteBasketBasketelementsAction($basketId, $elementId) return $view; } + /** + * Write a basket, this method is used by both POST and PUT action methods. + * + * @param Request $request Symfony request + * @param int|null $id A basket identifier + * + * @return \FOS\RestBundle\View\View|FormInterface + */ + protected function handleWriteBasket($request, $id = null) + { + $basket = $id ? $this->getBasket($id) : null; + + $form = $this->formFactory->createNamed(null, 'sonata_basket_api_form_basket', $basket, array( + 'csrf_protection' => false, + )); + + $form->bind($request); + + if ($form->isValid()) { + $basket = $form->getData(); + if ($basket->getCustomerId()) { + $this->checkExistingCustomerBasket($basket->getCustomerId()); + } + $this->basketManager->save($basket); + + $view = \FOS\RestBundle\View\View::create($basket); + $serializationContext = SerializationContext::create(); + $serializationContext->setGroups(array('sonata_api_read')); + $serializationContext->enableMaxDepthChecks(); + $view->setSerializationContext($serializationContext); + + return $view; + } + + return $form; + } + /** * Write a basket element, this method is used by both POST and PUT action methods. * diff --git a/src/BasketBundle/Controller/BasketController.php b/src/BasketBundle/Controller/BasketController.php index 4815b7801..2ca181304 100644 --- a/src/BasketBundle/Controller/BasketController.php +++ b/src/BasketBundle/Controller/BasketController.php @@ -1,7 +1,7 @@ * @@ -56,7 +56,7 @@ public function indexAction($form = null) return $this->render('SonataBasketBundle:Basket:index.html.twig', array( 'basket' => $this->get('sonata.basket'), - 'form' => $form->createView(), + 'form' => $form->createView(), )); } @@ -97,7 +97,7 @@ public function updateAction() public function addProductAction() { $request = $this->get('request'); - $params = $request->get('add_basket'); + $params = $request->get('add_basket'); if ($request->getMethod() != 'POST') { throw new MethodNotAllowedException(array('POST')); @@ -114,7 +114,7 @@ public function addProductAction() $provider = $this->get('sonata.product.pool')->getProvider($product); $formBuilder = $this->get('form.factory')->createNamedBuilder('add_basket', 'form', null, array( - 'data_class' => $this->container->getParameter('sonata.basket.basket_element.class'), + 'data_class' => $this->container->getParameter('sonata.basket.basket_element.class'), 'csrf_protection' => false, )); @@ -144,22 +144,22 @@ public function addProductAction() if ($request->isXmlHttpRequest() && $provider->getOption('product_add_modal')) { return $this->render('SonataBasketBundle:Basket:add_product_popin.html.twig', array( 'basketElement' => $basketElement, - 'locale' => $basket->getLocale(), - 'product' => $product, - 'price' => $price, - 'currency' => $currency, - 'quantity' => $quantity, - 'provider' => $provider, + 'locale' => $basket->getLocale(), + 'product' => $product, + 'price' => $price, + 'currency' => $currency, + 'quantity' => $quantity, + 'provider' => $provider, )); - } else { - return new RedirectResponse($this->generateUrl('sonata_basket_index')); } + + return new RedirectResponse($this->generateUrl('sonata_basket_index')); } // an error occur, forward the request to the view return $this->forward('SonataProductBundle:Product:view', array( 'productId' => $product, - 'slug' => $product->getSlug(), + 'slug' => $product->getSlug(), )); } @@ -251,9 +251,9 @@ public function paymentStepAction() $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_payment_title', array(), 'SonataBasketBundle')); return $this->render('SonataBasketBundle:Basket:payment_step.html.twig', array( - 'basket' => $basket, - 'form' => $form->createView(), - 'customer' => $customer, + 'basket' => $basket, + 'form' => $form->createView(), + 'customer' => $customer, )); } @@ -306,8 +306,8 @@ public function deliveryStepAction() $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_delivery_title', array(), 'SonataBasketBundle')); return $this->render($template, array( - 'basket' => $basket, - 'form' => $form->createView(), + 'basket' => $basket, + 'form' => $form->createView(), 'customer' => $customer, )); } @@ -372,9 +372,9 @@ public function deliveryAddressStepAction() $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_delivery_title', array(), 'SonataBasketBundle')); return $this->render($template, array( - 'form' => $form->createView(), + 'form' => $form->createView(), 'addresses' => $addresses, - 'basket' => $basket, + 'basket' => $basket, )); } @@ -437,7 +437,7 @@ public function paymentAddressStepAction() $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_payment_title', array(), 'SonataBasketBundle')); return $this->render($template, array( - 'form' => $form->createView(), + 'form' => $form->createView(), 'addresses' => $addresses, )); } @@ -476,7 +476,7 @@ public function finalReviewStepAction() $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('basket_review_title', array(), 'SonataBasketBundle')); return $this->render('SonataBasketBundle:Basket:final_review_step.html.twig', array( - 'basket' => $basket, + 'basket' => $basket, 'tac_error' => $this->get('request')->getMethod() == 'POST', )); } diff --git a/src/BasketBundle/DependencyInjection/Compiler/GlobalVariableCompilerPass.php b/src/BasketBundle/DependencyInjection/Compiler/GlobalVariableCompilerPass.php index e7cfd5217..779c5f03f 100644 --- a/src/BasketBundle/DependencyInjection/Compiler/GlobalVariableCompilerPass.php +++ b/src/BasketBundle/DependencyInjection/Compiler/GlobalVariableCompilerPass.php @@ -1,7 +1,7 @@ * diff --git a/src/BasketBundle/DependencyInjection/Configuration.php b/src/BasketBundle/DependencyInjection/Configuration.php index c1665f0a1..b6d304f66 100644 --- a/src/BasketBundle/DependencyInjection/Configuration.php +++ b/src/BasketBundle/DependencyInjection/Configuration.php @@ -1,7 +1,7 @@ * diff --git a/src/BasketBundle/DependencyInjection/SonataBasketExtension.php b/src/BasketBundle/DependencyInjection/SonataBasketExtension.php index fb61c4639..173136aaa 100644 --- a/src/BasketBundle/DependencyInjection/SonataBasketExtension.php +++ b/src/BasketBundle/DependencyInjection/SonataBasketExtension.php @@ -1,7 +1,7 @@ * @@ -84,43 +84,43 @@ public function registerDoctrineMapping(array $config) $collector = DoctrineCollector::getInstance(); $collector->addAssociation($config['class']['basket'], 'mapManyToOne', array( - 'fieldName' => 'customer', + 'fieldName' => 'customer', 'targetEntity' => $config['class']['customer'], - 'cascade' => array(), - 'mappedBy' => null, - 'inversedBy' => null, - 'joinColumns' => array( + 'cascade' => array(), + 'mappedBy' => null, + 'inversedBy' => null, + 'joinColumns' => array( array( - 'name' => 'customer_id', + 'name' => 'customer_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', - 'unique' => true, + 'onDelete' => 'CASCADE', + 'unique' => true, ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['basket'], 'mapOneToMany', array( - 'fieldName' => 'basketElements', - 'targetEntity' => $config['class']['basket_element'], - 'cascade' => array( + 'fieldName' => 'basketElements', + 'targetEntity' => $config['class']['basket_element'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'basket', + 'mappedBy' => 'basket', 'orphanRemoval' => true, )); $collector->addAssociation($config['class']['basket_element'], 'mapManyToOne', array( - 'fieldName' => 'basket', - 'targetEntity' => $config['class']['basket'], - 'cascade' => array(), - 'mappedBy' => null, - 'inversedBy' => 'basketElements', - 'joinColumns' => array( + 'fieldName' => 'basket', + 'targetEntity' => $config['class']['basket'], + 'cascade' => array(), + 'mappedBy' => null, + 'inversedBy' => 'basketElements', + 'joinColumns' => array( array( - 'name' => 'basket_id', + 'name' => 'basket_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', + 'onDelete' => 'CASCADE', ), ), 'orphanRemoval' => false, diff --git a/src/BasketBundle/Entity/BaseBasket.php b/src/BasketBundle/Entity/BaseBasket.php index dfb6b420a..b0fc0d29c 100644 --- a/src/BasketBundle/Entity/BaseBasket.php +++ b/src/BasketBundle/Entity/BaseBasket.php @@ -1,7 +1,7 @@ * diff --git a/src/BasketBundle/Entity/BaseBasketElement.php b/src/BasketBundle/Entity/BaseBasketElement.php index 239d73ca4..f6dff42c5 100644 --- a/src/BasketBundle/Entity/BaseBasketElement.php +++ b/src/BasketBundle/Entity/BaseBasketElement.php @@ -1,7 +1,7 @@ * diff --git a/src/BasketBundle/Form/AddressType.php b/src/BasketBundle/Form/AddressType.php index fa74cddc8..523ecd027 100644 --- a/src/BasketBundle/Form/AddressType.php +++ b/src/BasketBundle/Form/AddressType.php @@ -1,7 +1,7 @@ * @@ -45,7 +45,7 @@ class AddressType extends AbstractType public function __construct($addressClass, BasketInterface $basket) { $this->addressClass = $addressClass; - $this->basket = $basket; + $this->basket = $basket; } /** @@ -66,12 +66,12 @@ public function buildForm(FormBuilderInterface $builder, array $options) } $builder->add('addresses', 'entity', array( - 'choices' => $addresses, + 'choices' => $addresses, 'preferred_choices' => array($defaultAddress), - 'class' => $this->addressClass, - 'expanded' => true, - 'multiple' => false, - 'mapped' => false, + 'class' => $this->addressClass, + 'expanded' => true, + 'multiple' => false, + 'mapped' => false, )) ->add('useSelected', 'submit', array( 'attr' => array( @@ -79,7 +79,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'style' => 'margin-bottom:20px;', ), 'translation_domain' => 'SonataBasketBundle', - 'validation_groups' => false, + 'validation_groups' => false, )); } @@ -87,7 +87,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) if (isset($options['types'])) { $builder->add('type', 'choice', array( - 'choices' => $options['types'], + 'choices' => $options['types'], 'translation_domain' => 'SonataCustomerBundle', ) ); } @@ -122,38 +122,14 @@ public function buildView(FormView $view, FormInterface $form, array $options) $view->vars['addresses'] = $options['addresses']; } - /** - * Returns basket elements delivery countries. - * - * @return array - */ - protected function getBasketDeliveryCountries() - { - $countries = array(); - - foreach ($this->basket->getBasketElements() as $basketElement) { - $product = $basketElement->getProduct(); - - foreach ($product->getDeliveries() as $delivery) { - $code = $delivery->getCountryCode(); - - if (!isset($countries[$code])) { - $countries[$code] = Intl::getRegionBundle()->getCountryName($code); - } - } - } - - return $countries; - } - /** * {@inheritdoc} */ public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => $this->addressClass, - 'addresses' => array(), + 'data_class' => $this->addressClass, + 'addresses' => array(), 'validation_groups' => array('front'), )); } @@ -173,4 +149,28 @@ public function getName() { return $this->getBlockPrefix(); } + + /** + * Returns basket elements delivery countries. + * + * @return array + */ + protected function getBasketDeliveryCountries() + { + $countries = array(); + + foreach ($this->basket->getBasketElements() as $basketElement) { + $product = $basketElement->getProduct(); + + foreach ($product->getDeliveries() as $delivery) { + $code = $delivery->getCountryCode(); + + if (!isset($countries[$code])) { + $countries[$code] = Intl::getRegionBundle()->getCountryName($code); + } + } + } + + return $countries; + } } diff --git a/src/BasketBundle/Form/ApiBasketElementParentType.php b/src/BasketBundle/Form/ApiBasketElementParentType.php index 2264565a2..40f875695 100644 --- a/src/BasketBundle/Form/ApiBasketElementParentType.php +++ b/src/BasketBundle/Form/ApiBasketElementParentType.php @@ -1,7 +1,7 @@ * diff --git a/src/BasketBundle/Form/ApiBasketElementType.php b/src/BasketBundle/Form/ApiBasketElementType.php index 580b5ca12..c11f6db9b 100644 --- a/src/BasketBundle/Form/ApiBasketElementType.php +++ b/src/BasketBundle/Form/ApiBasketElementType.php @@ -1,7 +1,7 @@ * @@ -54,7 +54,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => $this->class, + 'data_class' => $this->class, 'csrf_protection' => false, )); } diff --git a/src/BasketBundle/Form/ApiBasketParentType.php b/src/BasketBundle/Form/ApiBasketParentType.php index 2cd2f75f1..ae9f57fad 100644 --- a/src/BasketBundle/Form/ApiBasketParentType.php +++ b/src/BasketBundle/Form/ApiBasketParentType.php @@ -1,7 +1,7 @@ * diff --git a/src/BasketBundle/Form/ApiBasketType.php b/src/BasketBundle/Form/ApiBasketType.php index 5367f6b79..ec2790999 100644 --- a/src/BasketBundle/Form/ApiBasketType.php +++ b/src/BasketBundle/Form/ApiBasketType.php @@ -1,7 +1,7 @@ * @@ -41,7 +41,7 @@ class ApiBasketType extends AbstractType */ public function __construct($class, CurrencyFormType $currencyFormType) { - $this->class = $class; + $this->class = $class; $this->currencyFormType = $currencyFormType; } @@ -61,8 +61,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => $this->class, - 'csrf_protection' => false, + 'data_class' => $this->class, + 'csrf_protection' => false, 'validation_groups' => array('api'), )); } diff --git a/src/BasketBundle/Form/BasketType.php b/src/BasketBundle/Form/BasketType.php index b6989cd8e..2a65f9d89 100644 --- a/src/BasketBundle/Form/BasketType.php +++ b/src/BasketBundle/Form/BasketType.php @@ -1,7 +1,7 @@ * diff --git a/src/BasketBundle/Form/PaymentType.php b/src/BasketBundle/Form/PaymentType.php index e4c5b47f8..6835dcc9b 100644 --- a/src/BasketBundle/Form/PaymentType.php +++ b/src/BasketBundle/Form/PaymentType.php @@ -1,7 +1,7 @@ * @@ -47,9 +47,9 @@ class PaymentType extends AbstractType */ public function __construct(AddressManagerInterface $addressManager, PaymentPool $paymentPool, PaymentSelectorInterface $paymentSelector) { - $this->addressManager = $addressManager; - $this->paymentSelector = $paymentSelector; - $this->paymentPool = $paymentPool; + $this->addressManager = $addressManager; + $this->paymentSelector = $paymentSelector; + $this->paymentPool = $paymentPool; } /** @@ -65,7 +65,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $addresses = $this->addressManager->findBy(array( 'customer' => $basket->getCustomer()->getId(), - 'type' => AddressInterface::TYPE_BILLING, + 'type' => AddressInterface::TYPE_BILLING, )); /* @@ -93,8 +93,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) $basket->setPaymentMethod($method ?: null); $sub = $builder->create('paymentMethod', 'choice', array( - 'expanded' => true, - 'choice_list' => new SimpleChoiceList($choices), + 'expanded' => true, + 'choice_list' => new SimpleChoiceList($choices), )); $sub->addViewTransformer(new PaymentMethodTransformer($this->paymentPool), true); diff --git a/src/BasketBundle/Form/ShippingType.php b/src/BasketBundle/Form/ShippingType.php index 434290c43..3203c4fe3 100644 --- a/src/BasketBundle/Form/ShippingType.php +++ b/src/BasketBundle/Form/ShippingType.php @@ -1,7 +1,7 @@ * @@ -41,7 +41,7 @@ class ShippingType extends AbstractType public function __construct(DeliveryPool $deliveryPool, ServiceDeliverySelectorInterface $deliverySelector) { $this->deliverySelector = $deliverySelector; - $this->deliveryPool = $deliveryPool; + $this->deliveryPool = $deliveryPool; } /** @@ -72,8 +72,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) $basket->setDeliveryMethod($method ?: null); $sub = $builder->create('deliveryMethod', 'choice', array( - 'expanded' => true, - 'choice_list' => new SimpleChoiceList($choices), + 'expanded' => true, + 'choice_list' => new SimpleChoiceList($choices), )); $sub->addViewTransformer(new DeliveryMethodTransformer($this->deliveryPool), true); diff --git a/src/BasketBundle/Serializer/BasketSerializerHandler.php b/src/BasketBundle/Serializer/BasketSerializerHandler.php index bcecc730f..7e9b83f86 100644 --- a/src/BasketBundle/Serializer/BasketSerializerHandler.php +++ b/src/BasketBundle/Serializer/BasketSerializerHandler.php @@ -1,7 +1,7 @@ * diff --git a/src/BasketBundle/SonataBasketBundle.php b/src/BasketBundle/SonataBasketBundle.php index 2e74f0083..b167b961c 100644 --- a/src/BasketBundle/SonataBasketBundle.php +++ b/src/BasketBundle/SonataBasketBundle.php @@ -1,7 +1,7 @@ * @@ -42,13 +42,13 @@ public function boot() public function registerFormMapping() { FormHelper::registerFormTypeMapping(array( - 'sonata_basket_basket' => 'Sonata\BasketBundle\Form\BasketType', - 'sonata_basker_address' => 'Sonata\BasketBundle\Form\Type\AddressType', - 'sonata_basket_shipping' => 'Sonata\BasketBundle\Form\ShippingType', - 'sonata_basket_payment' => 'Sonata\BasketBundle\Form\PaymentType', - 'sonata_basket_api_form_basket' => 'Sonata\BasketBundle\Form\ApiBasketType', - 'sonata_basket_api_form_basket_element' => 'Sonata\BasketBundle\Form\ApiBasketElementType', - 'sonata_basket_api_form_basket_parent' => 'Sonata\BasketBundle\Form\ApiBasketParentType', + 'sonata_basket_basket' => 'Sonata\BasketBundle\Form\BasketType', + 'sonata_basker_address' => 'Sonata\BasketBundle\Form\Type\AddressType', + 'sonata_basket_shipping' => 'Sonata\BasketBundle\Form\ShippingType', + 'sonata_basket_payment' => 'Sonata\BasketBundle\Form\PaymentType', + 'sonata_basket_api_form_basket' => 'Sonata\BasketBundle\Form\ApiBasketType', + 'sonata_basket_api_form_basket_element' => 'Sonata\BasketBundle\Form\ApiBasketElementType', + 'sonata_basket_api_form_basket_parent' => 'Sonata\BasketBundle\Form\ApiBasketParentType', 'sonata_basket_api_form_basket_element_parent' => 'Sonata\BasketBundle\Form\ApiBasketElementParentType', )); } diff --git a/src/BasketBundle/Twig/GlobalVariables.php b/src/BasketBundle/Twig/GlobalVariables.php index 064ca2392..8c8bd9cc0 100644 --- a/src/BasketBundle/Twig/GlobalVariables.php +++ b/src/BasketBundle/Twig/GlobalVariables.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Basket/BaseBasketFactory.php b/src/Component/Basket/BaseBasketFactory.php index 0c2959e3f..212a52023 100644 --- a/src/Component/Basket/BaseBasketFactory.php +++ b/src/Component/Basket/BaseBasketFactory.php @@ -1,7 +1,7 @@ * @@ -57,10 +57,10 @@ abstract class BaseBasketFactory implements BasketFactoryInterface, LogoutHandle */ public function __construct(BasketManagerInterface $basketManager, BasketBuilderInterface $basketBuilder, CurrencyDetectorInterface $currencyDetector, SessionInterface $session) { - $this->basketManager = $basketManager; - $this->basketBuilder = $basketBuilder; + $this->basketManager = $basketManager; + $this->basketBuilder = $basketBuilder; $this->currencyDetector = $currencyDetector; - $this->session = $session; + $this->session = $session; } /** @@ -82,6 +82,15 @@ public function load(CustomerInterface $customer) return $basket; } + /** + * {@inheritdoc} + */ + public function logout(Request $request, Response $response, TokenInterface $token) + { + // Remove anonymous basket + $this->session->remove($this->getSessionVarName()); + } + /** * Retrieved basket associated with $customer from session. * @@ -110,15 +119,6 @@ protected function storeInSession(BasketInterface $basket) $this->session->set($this->getSessionVarName($basket->getCustomer()), $basket); } - /** - * {@inheritdoc} - */ - public function logout(Request $request, Response $response, TokenInterface $token) - { - // Remove anonymous basket - $this->session->remove($this->getSessionVarName()); - } - /** * Get the name of the session variable. * diff --git a/src/Component/Basket/Basket.php b/src/Component/Basket/Basket.php index 534905fb6..6ca22a89e 100644 --- a/src/Component/Basket/Basket.php +++ b/src/Component/Basket/Basket.php @@ -1,7 +1,7 @@ * @@ -483,7 +483,7 @@ public function getVatAmounts() $amounts[$rate]['amount'] = bcadd($amounts[$rate]['amount'], $basketElement->getVatAmount()); } else { $amounts[$rate] = array( - 'rate' => $rate, + 'rate' => $rate, 'amount' => $basketElement->getVatAmount(), ); } @@ -589,14 +589,14 @@ public function clean() public function getSerializationFields() { $arrayRep = array( - 'basketElements' => $this->getBasketElements(), - 'positions' => $this->positions, - 'paymentMethodCode' => $this->paymentMethodCode, - 'cptElement' => $this->cptElement, - 'deliveryMethodCode' => $this->deliveryMethodCode, - 'options' => $this->options, - 'locale' => $this->locale, - 'currency' => $this->currency, + 'basketElements' => $this->getBasketElements(), + 'positions' => $this->positions, + 'paymentMethodCode' => $this->paymentMethodCode, + 'cptElement' => $this->cptElement, + 'deliveryMethodCode' => $this->deliveryMethodCode, + 'options' => $this->options, + 'locale' => $this->locale, + 'currency' => $this->currency, ); if (null !== $this->deliveryAddressId) { diff --git a/src/Component/Basket/BasketBuilder.php b/src/Component/Basket/BasketBuilder.php index 9c228e58d..f65e422ea 100644 --- a/src/Component/Basket/BasketBuilder.php +++ b/src/Component/Basket/BasketBuilder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Basket; use Sonata\Component\Customer\AddressManagerInterface; @@ -37,10 +46,10 @@ class BasketBuilder implements BasketBuilderInterface */ public function __construct(Pool $productPool, AddressManagerInterface $addressManager, DeliveryPool $deliveryPool, PaymentPool $paymentPool) { - $this->productPool = $productPool; - $this->addressManager = $addressManager; - $this->deliveryPool = $deliveryPool; - $this->paymentPool = $paymentPool; + $this->productPool = $productPool; + $this->addressManager = $addressManager; + $this->deliveryPool = $deliveryPool; + $this->paymentPool = $paymentPool; } /** diff --git a/src/Component/Basket/BasketBuilderInterface.php b/src/Component/Basket/BasketBuilderInterface.php index 875472922..319929741 100644 --- a/src/Component/Basket/BasketBuilderInterface.php +++ b/src/Component/Basket/BasketBuilderInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Basket; interface BasketBuilderInterface diff --git a/src/Component/Basket/BasketElement.php b/src/Component/Basket/BasketElement.php index 1f32e5e1b..ae67ee4a4 100644 --- a/src/Component/Basket/BasketElement.php +++ b/src/Component/Basket/BasketElement.php @@ -1,7 +1,7 @@ * @@ -112,12 +112,12 @@ public function getName() */ public function setProduct($productCode, ProductInterface $product) { - $this->product = $product; - $this->productId = $product->getId(); - $this->productCode = $productCode; - $this->name = $product->getName(); - $this->price = $product->getPrice(); - $this->options = $product->getOptions(); + $this->product = $product; + $this->productId = $product->getId(); + $this->productCode = $productCode; + $this->name = $product->getName(); + $this->price = $product->getPrice(); + $this->options = $product->getOptions(); } /** @@ -359,16 +359,16 @@ public function getDelete() public function serialize() { return serialize(array( - 'productId' => $this->productId, - 'position' => $this->position, - 'unitPrice' => $this->unitPrice, - 'price' => $this->price, + 'productId' => $this->productId, + 'position' => $this->position, + 'unitPrice' => $this->unitPrice, + 'price' => $this->price, 'priceIncludingVat' => $this->priceIncludingVat, - 'quantity' => $this->quantity, - 'vatRate' => $this->vatRate, - 'options' => $this->options, - 'name' => $this->name, - 'productCode' => $this->productCode, + 'quantity' => $this->quantity, + 'vatRate' => $this->vatRate, + 'options' => $this->options, + 'name' => $this->name, + 'productCode' => $this->productCode, )); } @@ -379,16 +379,16 @@ public function unserialize($data) { $data = unserialize($data); - $this->productId = $data['productId']; - $this->position = $data['position']; - $this->unitPrice = $data['unitPrice']; - $this->price = $data['price']; + $this->productId = $data['productId']; + $this->position = $data['position']; + $this->unitPrice = $data['unitPrice']; + $this->price = $data['price']; $this->priceIncludingVat = $data['priceIncludingVat']; - $this->vatRate = $data['vatRate']; - $this->quantity = $data['quantity']; - $this->options = $data['options']; - $this->name = $data['name']; - $this->productCode = $data['productCode']; + $this->vatRate = $data['vatRate']; + $this->quantity = $data['quantity']; + $this->options = $data['options']; + $this->name = $data['name']; + $this->productCode = $data['productCode']; } /** diff --git a/src/Component/Basket/BasketElementInterface.php b/src/Component/Basket/BasketElementInterface.php index cae33a9d4..a7ece0f4e 100644 --- a/src/Component/Basket/BasketElementInterface.php +++ b/src/Component/Basket/BasketElementInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Basket/BasketElementManager.php b/src/Component/Basket/BasketElementManager.php index ff7271b26..12bb4c92b 100644 --- a/src/Component/Basket/BasketElementManager.php +++ b/src/Component/Basket/BasketElementManager.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Basket; use Sonata\CoreBundle\Model\BaseEntityManager; diff --git a/src/Component/Basket/BasketElementManagerInterface.php b/src/Component/Basket/BasketElementManagerInterface.php index e708017bb..41b0b067b 100644 --- a/src/Component/Basket/BasketElementManagerInterface.php +++ b/src/Component/Basket/BasketElementManagerInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Basket; use Sonata\CoreBundle\Model\ManagerInterface; diff --git a/src/Component/Basket/BasketEntityFactory.php b/src/Component/Basket/BasketEntityFactory.php index 16cb06392..56870c8ed 100644 --- a/src/Component/Basket/BasketEntityFactory.php +++ b/src/Component/Basket/BasketEntityFactory.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Basket/BasketFactoryInterface.php b/src/Component/Basket/BasketFactoryInterface.php index 16618e465..391330019 100644 --- a/src/Component/Basket/BasketFactoryInterface.php +++ b/src/Component/Basket/BasketFactoryInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Basket; use Sonata\Component\Customer\CustomerInterface; diff --git a/src/Component/Basket/BasketInterface.php b/src/Component/Basket/BasketInterface.php index d073ca2fb..e57d978a5 100644 --- a/src/Component/Basket/BasketInterface.php +++ b/src/Component/Basket/BasketInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Basket/BasketManager.php b/src/Component/Basket/BasketManager.php index 2d8b5e49e..8a0f6ad61 100644 --- a/src/Component/Basket/BasketManager.php +++ b/src/Component/Basket/BasketManager.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Basket; use Doctrine\ORM\NoResultException; diff --git a/src/Component/Basket/BasketManagerInterface.php b/src/Component/Basket/BasketManagerInterface.php index 479aa644e..876e00a31 100644 --- a/src/Component/Basket/BasketManagerInterface.php +++ b/src/Component/Basket/BasketManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Basket/BasketSessionFactory.php b/src/Component/Basket/BasketSessionFactory.php index 6ce37316f..fcbf96ac3 100644 --- a/src/Component/Basket/BasketSessionFactory.php +++ b/src/Component/Basket/BasketSessionFactory.php @@ -1,7 +1,7 @@ * @@ -45,10 +45,10 @@ class BasketSessionFactory extends BaseBasketFactory */ public function __construct(BasketManagerInterface $basketManager, BasketBuilderInterface $basketBuilder, CurrencyDetectorInterface $currencyDetector, SessionInterface $session) { - $this->basketManager = $basketManager; - $this->basketBuilder = $basketBuilder; + $this->basketManager = $basketManager; + $this->basketBuilder = $basketBuilder; $this->currencyDetector = $currencyDetector; - $this->session = $session; + $this->session = $session; } /** diff --git a/src/Component/Basket/InvalidBasketStateException.php b/src/Component/Basket/InvalidBasketStateException.php index 8a21af78f..27dcfb82b 100644 --- a/src/Component/Basket/InvalidBasketStateException.php +++ b/src/Component/Basket/InvalidBasketStateException.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Basket/InvalidProductException.php b/src/Component/Basket/InvalidProductException.php index e7fbfc9e8..3fc536200 100644 --- a/src/Component/Basket/InvalidProductException.php +++ b/src/Component/Basket/InvalidProductException.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Basket/Loader.php b/src/Component/Basket/Loader.php index 920dcb39a..612311603 100644 --- a/src/Component/Basket/Loader.php +++ b/src/Component/Basket/Loader.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/Currency.php b/src/Component/Currency/Currency.php index 9b2489146..b33436bee 100644 --- a/src/Component/Currency/Currency.php +++ b/src/Component/Currency/Currency.php @@ -1,7 +1,7 @@ * @@ -48,6 +48,7 @@ public function setLabel($label) return $this; } + /** * {@inheritdoc} */ diff --git a/src/Component/Currency/CurrencyDataTransformer.php b/src/Component/Currency/CurrencyDataTransformer.php index 77d35ef39..9e77cf807 100644 --- a/src/Component/Currency/CurrencyDataTransformer.php +++ b/src/Component/Currency/CurrencyDataTransformer.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/CurrencyDetector.php b/src/Component/Currency/CurrencyDetector.php index 3847f637a..5653fc076 100644 --- a/src/Component/Currency/CurrencyDetector.php +++ b/src/Component/Currency/CurrencyDetector.php @@ -1,13 +1,13 @@ -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ + * This file is part of the Sonata Project package. + * + * (c) Thomas Rabaix + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Sonata\Component\Currency; diff --git a/src/Component/Currency/CurrencyDetectorInterface.php b/src/Component/Currency/CurrencyDetectorInterface.php index 90d87c95f..e0f99bd97 100644 --- a/src/Component/Currency/CurrencyDetectorInterface.php +++ b/src/Component/Currency/CurrencyDetectorInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/CurrencyDoctrineType.php b/src/Component/Currency/CurrencyDoctrineType.php index 560e78bd1..7400cb00f 100644 --- a/src/Component/Currency/CurrencyDoctrineType.php +++ b/src/Component/Currency/CurrencyDoctrineType.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/CurrencyFormType.php b/src/Component/Currency/CurrencyFormType.php index 3fde9fd68..66d15dff0 100644 --- a/src/Component/Currency/CurrencyFormType.php +++ b/src/Component/Currency/CurrencyFormType.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/CurrencyInterface.php b/src/Component/Currency/CurrencyInterface.php index 18b8d0970..6fd748d5d 100644 --- a/src/Component/Currency/CurrencyInterface.php +++ b/src/Component/Currency/CurrencyInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/CurrencyManager.php b/src/Component/Currency/CurrencyManager.php index 18e7b3ad3..b81047057 100644 --- a/src/Component/Currency/CurrencyManager.php +++ b/src/Component/Currency/CurrencyManager.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/CurrencyManagerInterface.php b/src/Component/Currency/CurrencyManagerInterface.php index 770231340..7e24d01a6 100644 --- a/src/Component/Currency/CurrencyManagerInterface.php +++ b/src/Component/Currency/CurrencyManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/CurrencyPriceCalculator.php b/src/Component/Currency/CurrencyPriceCalculator.php index 80a110c73..08c143829 100644 --- a/src/Component/Currency/CurrencyPriceCalculator.php +++ b/src/Component/Currency/CurrencyPriceCalculator.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Currency; use Sonata\Component\Product\ProductInterface; diff --git a/src/Component/Currency/CurrencyPriceCalculatorInterface.php b/src/Component/Currency/CurrencyPriceCalculatorInterface.php index bdc150a18..fd97b50ed 100644 --- a/src/Component/Currency/CurrencyPriceCalculatorInterface.php +++ b/src/Component/Currency/CurrencyPriceCalculatorInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Currency/UnavailableForCurrencyException.php b/src/Component/Currency/UnavailableForCurrencyException.php index b29ef5c01..021bc1522 100644 --- a/src/Component/Currency/UnavailableForCurrencyException.php +++ b/src/Component/Currency/UnavailableForCurrencyException.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Customer/AddressInterface.php b/src/Component/Customer/AddressInterface.php index 13ea3e980..179cc734e 100644 --- a/src/Component/Customer/AddressInterface.php +++ b/src/Component/Customer/AddressInterface.php @@ -1,7 +1,7 @@ * @@ -13,9 +13,9 @@ interface AddressInterface { - const TYPE_BILLING = 1; + const TYPE_BILLING = 1; const TYPE_DELIVERY = 2; - const TYPE_CONTACT = 3; + const TYPE_CONTACT = 3; public function getId(); diff --git a/src/Component/Customer/AddressManagerInterface.php b/src/Component/Customer/AddressManagerInterface.php index 07dd9010a..b45c4c353 100644 --- a/src/Component/Customer/AddressManagerInterface.php +++ b/src/Component/Customer/AddressManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Customer/CustomerInterface.php b/src/Component/Customer/CustomerInterface.php index a21b38924..978a134fa 100644 --- a/src/Component/Customer/CustomerInterface.php +++ b/src/Component/Customer/CustomerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Customer/CustomerManagerInterface.php b/src/Component/Customer/CustomerManagerInterface.php index c8c7158e9..095d3b599 100644 --- a/src/Component/Customer/CustomerManagerInterface.php +++ b/src/Component/Customer/CustomerManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Customer/CustomerSelector.php b/src/Component/Customer/CustomerSelector.php index 1023ed0a1..19320e4f0 100644 --- a/src/Component/Customer/CustomerSelector.php +++ b/src/Component/Customer/CustomerSelector.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Customer; use FOS\UserBundle\Model\UserInterface; @@ -38,10 +47,10 @@ class CustomerSelector implements CustomerSelectorInterface */ public function __construct(CustomerManagerInterface $customerManager, SessionInterface $session, SecurityContextInterface $securityContext, LocaleDetectorInterface $localeDetector) { - $this->customerManager = $customerManager; - $this->session = $session; - $this->securityContext = $securityContext; - $this->locale = $localeDetector->getLocale(); + $this->customerManager = $customerManager; + $this->session = $session; + $this->securityContext = $securityContext; + $this->locale = $localeDetector->getLocale(); } /** @@ -54,7 +63,7 @@ public function __construct(CustomerManagerInterface $customerManager, SessionIn public function get() { $customer = null; - $user = null; + $user = null; if (true === $this->securityContext->isGranted('IS_AUTHENTICATED_FULLY')) { // user is authenticated diff --git a/src/Component/Customer/CustomerSelectorInterface.php b/src/Component/Customer/CustomerSelectorInterface.php index 75da13227..1a7a385b0 100644 --- a/src/Component/Customer/CustomerSelectorInterface.php +++ b/src/Component/Customer/CustomerSelectorInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Customer; interface CustomerSelectorInterface diff --git a/src/Component/Delivery/BaseServiceDelivery.php b/src/Component/Delivery/BaseServiceDelivery.php index 97c3809da..b2c54fd12 100644 --- a/src/Component/Delivery/BaseServiceDelivery.php +++ b/src/Component/Delivery/BaseServiceDelivery.php @@ -1,7 +1,7 @@ * @@ -61,12 +61,12 @@ abstract class BaseServiceDelivery implements ServiceDeliveryInterface public static function getStatusList() { return array( - self::STATUS_OPEN => 'status_open', - self::STATUS_PENDING => 'status_pending', - self::STATUS_SENT => 'status_sent', - self::STATUS_CANCELLED => 'status_cancelled', - self::STATUS_COMPLETED => 'status_completed', - self::STATUS_RETURNED => 'status_returned', + self::STATUS_OPEN => 'status_open', + self::STATUS_PENDING => 'status_pending', + self::STATUS_SENT => 'status_sent', + self::STATUS_CANCELLED => 'status_cancelled', + self::STATUS_COMPLETED => 'status_completed', + self::STATUS_RETURNED => 'status_returned', ); } diff --git a/src/Component/Delivery/FreeDelivery.php b/src/Component/Delivery/FreeDelivery.php index 29be9cfc4..09f06fa00 100644 --- a/src/Component/Delivery/FreeDelivery.php +++ b/src/Component/Delivery/FreeDelivery.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Delivery/Pool.php b/src/Component/Delivery/Pool.php index aaf12f92c..0dcf9984e 100644 --- a/src/Component/Delivery/Pool.php +++ b/src/Component/Delivery/Pool.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Delivery/Selector.php b/src/Component/Delivery/Selector.php index c49202bf8..f4bd7cfd6 100644 --- a/src/Component/Delivery/Selector.php +++ b/src/Component/Delivery/Selector.php @@ -1,7 +1,7 @@ * @@ -71,16 +71,6 @@ public function getLogger() return $this->logger; } - /** - * @param string $message - */ - protected function log($message) - { - if ($this->logger) { - $this->logger->info($message); - } - } - /** * @return ProductPool */ @@ -176,4 +166,14 @@ public static function sort(ServiceDeliveryInterface $a, ServiceDeliveryInterfac return $a->getPriority() > $b->getPriority() ? -1 : 1; } + + /** + * @param string $message + */ + protected function log($message) + { + if ($this->logger) { + $this->logger->info($message); + } + } } diff --git a/src/Component/Delivery/ServiceDeliveryInterface.php b/src/Component/Delivery/ServiceDeliveryInterface.php index 61b9153d3..4c2f69350 100644 --- a/src/Component/Delivery/ServiceDeliveryInterface.php +++ b/src/Component/Delivery/ServiceDeliveryInterface.php @@ -1,7 +1,7 @@ * @@ -15,12 +15,12 @@ interface ServiceDeliveryInterface { - const STATUS_OPEN = 1; // Not processed yet - const STATUS_PENDING = 2; // Packing - const STATUS_SENT = 3; // In transit - const STATUS_CANCELLED = 4; // Delivery cancelled - const STATUS_COMPLETED = 5; // Delivered - const STATUS_RETURNED = 6; // Returned to sender + const STATUS_OPEN = 1; // Not processed yet + const STATUS_PENDING = 2; // Packing + const STATUS_SENT = 3; // In transit + const STATUS_CANCELLED = 4; // Delivery cancelled + const STATUS_COMPLETED = 5; // Delivered + const STATUS_RETURNED = 6; // Returned to sender /** * @return float the delivery base price diff --git a/src/Component/Delivery/ServiceDeliverySelectorInterface.php b/src/Component/Delivery/ServiceDeliverySelectorInterface.php index 8e5c815ff..5165432a0 100644 --- a/src/Component/Delivery/ServiceDeliverySelectorInterface.php +++ b/src/Component/Delivery/ServiceDeliverySelectorInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Delivery/UndeliverableCountryException.php b/src/Component/Delivery/UndeliverableCountryException.php index 6e4d586c0..33e6a801b 100644 --- a/src/Component/Delivery/UndeliverableCountryException.php +++ b/src/Component/Delivery/UndeliverableCountryException.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Event/AddBasketElementEvent.php b/src/Component/Event/AddBasketElementEvent.php index fe67b30b5..3464a8593 100644 --- a/src/Component/Event/AddBasketElementEvent.php +++ b/src/Component/Event/AddBasketElementEvent.php @@ -1,7 +1,7 @@ * @@ -55,9 +55,9 @@ class AddBasketElementEvent extends Event */ public function __construct(BasketInterface $basket, BasketElementInterface $basketElement, ProductInterface $product, ProductProviderInterface $productProvider) { - $this->basket = $basket; - $this->basketElement = $basketElement; - $this->product = $product; + $this->basket = $basket; + $this->basketElement = $basketElement; + $this->product = $product; $this->productProvider = $productProvider; } diff --git a/src/Component/Event/AfterCalculatePriceEvent.php b/src/Component/Event/AfterCalculatePriceEvent.php index 5d017f91f..119af2864 100644 --- a/src/Component/Event/AfterCalculatePriceEvent.php +++ b/src/Component/Event/AfterCalculatePriceEvent.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Event/BasketEvents.php b/src/Component/Event/BasketEvents.php index f2cb3032e..1b2a24fef 100644 --- a/src/Component/Event/BasketEvents.php +++ b/src/Component/Event/BasketEvents.php @@ -1,7 +1,7 @@ * @@ -19,12 +19,12 @@ */ final class BasketEvents { - const PRE_ADD_PRODUCT = 'sonata.ecommerce.basket.pre_add_product'; + const PRE_ADD_PRODUCT = 'sonata.ecommerce.basket.pre_add_product'; const POST_ADD_PRODUCT = 'sonata.ecommerce.basket.post_add_product'; - const PRE_MERGE_PRODUCT = 'sonata.ecommerce.basket.pre_merge_product'; + const PRE_MERGE_PRODUCT = 'sonata.ecommerce.basket.pre_merge_product'; const POST_MERGE_PRODUCT = 'sonata.ecommerce.basket.post_merge_product'; - const PRE_CALCULATE_PRICE = 'sonata.ecommerce.basket.pre_calculate_price'; + const PRE_CALCULATE_PRICE = 'sonata.ecommerce.basket.pre_calculate_price'; const POST_CALCULATE_PRICE = 'sonata.ecommerce.basket.post_calculate_price'; } diff --git a/src/Component/Event/BasketTransformEvent.php b/src/Component/Event/BasketTransformEvent.php index 718aaa65e..2cf85bbe0 100644 --- a/src/Component/Event/BasketTransformEvent.php +++ b/src/Component/Event/BasketTransformEvent.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Event/BeforeCalculatePriceEvent.php b/src/Component/Event/BeforeCalculatePriceEvent.php index 83ffc1cfb..0cecc6a8f 100644 --- a/src/Component/Event/BeforeCalculatePriceEvent.php +++ b/src/Component/Event/BeforeCalculatePriceEvent.php @@ -1,7 +1,7 @@ * @@ -51,9 +51,9 @@ class BeforeCalculatePriceEvent extends Event */ public function __construct(ProductInterface $product, CurrencyInterface $currency, $vat, $quantity) { - $this->product = $product; + $this->product = $product; $this->currency = $currency; - $this->vat = $vat; + $this->vat = $vat; $this->quantity = $quantity; } diff --git a/src/Component/Event/InvoiceTransformEvent.php b/src/Component/Event/InvoiceTransformEvent.php index b4d8b21be..e88bc79ef 100644 --- a/src/Component/Event/InvoiceTransformEvent.php +++ b/src/Component/Event/InvoiceTransformEvent.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Event/OrderTransformEvent.php b/src/Component/Event/OrderTransformEvent.php index 60417db28..469830282 100644 --- a/src/Component/Event/OrderTransformEvent.php +++ b/src/Component/Event/OrderTransformEvent.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Event/PaymentEvent.php b/src/Component/Event/PaymentEvent.php index 72b9937dd..f6dd8bbd0 100644 --- a/src/Component/Event/PaymentEvent.php +++ b/src/Component/Event/PaymentEvent.php @@ -1,7 +1,7 @@ * @@ -48,9 +48,9 @@ class PaymentEvent extends Event */ public function __construct(OrderInterface $order, TransactionInterface $transaction = null, Response $response = null) { - $this->order = $order; + $this->order = $order; $this->transaction = $transaction; - $this->response = $response; + $this->response = $response; } /** diff --git a/src/Component/Event/PaymentEvents.php b/src/Component/Event/PaymentEvents.php index 0d4209465..1bcbc6ae5 100644 --- a/src/Component/Event/PaymentEvents.php +++ b/src/Component/Event/PaymentEvents.php @@ -1,7 +1,7 @@ * @@ -19,18 +19,18 @@ */ final class PaymentEvents { - const PRE_ERROR = 'sonata.ecommerce.payment.pre_error'; + const PRE_ERROR = 'sonata.ecommerce.payment.pre_error'; // Sent just before adding the order to the message queue const POST_ERROR = 'sonata.ecommerce.payment.post_error'; const CONFIRMATION = 'sonata.ecommerce.payment.confirmation'; - const PRE_CALLBACK = 'sonata.ecommerce.payment.pre_callback'; + const PRE_CALLBACK = 'sonata.ecommerce.payment.pre_callback'; // Sent just before adding the order to the message queue const POST_CALLBACK = 'sonata.ecommerce.payment.post_callback'; - const PRE_SENDBANK = 'sonata.ecommerce.payment.pre_sendbank'; + const PRE_SENDBANK = 'sonata.ecommerce.payment.pre_sendbank'; const POST_SENDBANK = 'sonata.ecommerce.payment.post_sendbank'; } diff --git a/src/Component/Event/TransformerEvents.php b/src/Component/Event/TransformerEvents.php index 3d5b5852d..b6dab1c90 100644 --- a/src/Component/Event/TransformerEvents.php +++ b/src/Component/Event/TransformerEvents.php @@ -1,7 +1,7 @@ * @@ -19,10 +19,10 @@ */ final class TransformerEvents { - const PRE_BASKET_TO_ORDER_TRANSFORM = 'sonata.ecommerce.pre_basket_to_order_transform'; - const POST_BASKET_TO_ORDER_TRANSFORM = 'sonata.ecommerce.pre_basket_to_order_transform'; - const PRE_ORDER_TO_BASKET_TRANSFORM = 'sonata.ecommerce.pre_order_to_basket_transform'; - const POST_ORDER_TO_BASKET_TRANSFORM = 'sonata.ecommerce.pre_order_to_basket_transform'; - const PRE_ORDER_TO_INVOICE_TRANSFORM = 'sonata.ecommerce.pre_order_to_invoice_transform'; + const PRE_BASKET_TO_ORDER_TRANSFORM = 'sonata.ecommerce.pre_basket_to_order_transform'; + const POST_BASKET_TO_ORDER_TRANSFORM = 'sonata.ecommerce.pre_basket_to_order_transform'; + const PRE_ORDER_TO_BASKET_TRANSFORM = 'sonata.ecommerce.pre_order_to_basket_transform'; + const POST_ORDER_TO_BASKET_TRANSFORM = 'sonata.ecommerce.pre_order_to_basket_transform'; + const PRE_ORDER_TO_INVOICE_TRANSFORM = 'sonata.ecommerce.pre_order_to_invoice_transform'; const POST_ORDER_TO_INVOICE_TRANSFORM = 'sonata.ecommerce.pre_order_to_invoice_transform'; } diff --git a/src/Component/Form/Basket.php b/src/Component/Form/Basket.php index a4f1b8e11..d31847c45 100644 --- a/src/Component/Form/Basket.php +++ b/src/Component/Form/Basket.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Form/BasketValidator.php b/src/Component/Form/BasketValidator.php index e3b21b3ba..c290f0a69 100644 --- a/src/Component/Form/BasketValidator.php +++ b/src/Component/Form/BasketValidator.php @@ -1,7 +1,7 @@ * @@ -38,7 +38,7 @@ class BasketValidator extends ConstraintValidator */ public function __construct(ProductPool $productPool, ConstraintValidatorFactory $constraintValidatorFactory) { - $this->productPool = $productPool; + $this->productPool = $productPool; $this->constraintValidatorFactory = $constraintValidatorFactory; } diff --git a/src/Component/Form/EventListener/BasketResizeFormListener.php b/src/Component/Form/EventListener/BasketResizeFormListener.php index 45a8d8c1f..911cbf148 100644 --- a/src/Component/Form/EventListener/BasketResizeFormListener.php +++ b/src/Component/Form/EventListener/BasketResizeFormListener.php @@ -1,7 +1,7 @@ * @@ -37,8 +37,8 @@ class BasketResizeFormListener implements EventSubscriberInterface public function __construct(FormFactoryInterface $factory, BasketInterface $basket) { - $this->factory = $factory; - $this->basket = $basket; + $this->factory = $factory; + $this->basket = $basket; } /** @@ -48,7 +48,7 @@ public static function getSubscribedEvents() { return array( FormEvents::PRE_SET_DATA => 'preSetData', - FormEvents::PRE_SUBMIT => 'preBind', + FormEvents::PRE_SUBMIT => 'preBind', ); } @@ -63,6 +63,17 @@ public function preSetData(FormEvent $event) $this->buildBasketElements($form, $basketElements); } + /** + * @param FormEvent $event + */ + public function preBind(FormEvent $event) + { + $form = $event->getForm(); + $data = $event->getData(); + + $this->buildBasketElements($form, $this->basket->getBasketElements()); + } + /** * @throws \Symfony\Component\Form\Exception\UnexpectedTypeException * @@ -81,8 +92,8 @@ private function buildBasketElements($form, $basketElements) foreach ($basketElements as $basketElement) { $basketElementBuilder = $this->factory->createNamedBuilder($basketElement->getPosition(), 'form', $basketElement, array( - 'property_path' => '['.$basketElement->getPosition().']', - 'auto_initialize' => false, + 'property_path' => '['.$basketElement->getPosition().']', + 'auto_initialize' => false, )); $basketElementBuilder->setErrorBubbling(false); @@ -92,15 +103,4 @@ private function buildBasketElements($form, $basketElements) $form->add($basketElementBuilder->getForm()); } } - - /** - * @param FormEvent $event - */ - public function preBind(FormEvent $event) - { - $form = $event->getForm(); - $data = $event->getData(); - - $this->buildBasketElements($form, $this->basket->getBasketElements()); - } } diff --git a/src/Component/Form/Transformer/DeliveryMethodTransformer.php b/src/Component/Form/Transformer/DeliveryMethodTransformer.php index cb8ddb56d..ce98fc9bb 100644 --- a/src/Component/Form/Transformer/DeliveryMethodTransformer.php +++ b/src/Component/Form/Transformer/DeliveryMethodTransformer.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Form/Transformer/PaymentMethodTransformer.php b/src/Component/Form/Transformer/PaymentMethodTransformer.php index bc33596f5..3ca61b8cb 100644 --- a/src/Component/Form/Transformer/PaymentMethodTransformer.php +++ b/src/Component/Form/Transformer/PaymentMethodTransformer.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Form/Transformer/QuantityTransformer.php b/src/Component/Form/Transformer/QuantityTransformer.php index f3ed235eb..f926bc03d 100644 --- a/src/Component/Form/Transformer/QuantityTransformer.php +++ b/src/Component/Form/Transformer/QuantityTransformer.php @@ -1,13 +1,13 @@ -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ + * This file is part of the Sonata Project package. + * + * (c) Thomas Rabaix + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Sonata\Component\Form\Transformer; diff --git a/src/Component/Form/Transformer/SerializeDataTransformer.php b/src/Component/Form/Transformer/SerializeDataTransformer.php index f95349599..f9b736d53 100644 --- a/src/Component/Form/Transformer/SerializeDataTransformer.php +++ b/src/Component/Form/Transformer/SerializeDataTransformer.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Form/Type/DeliveryChoiceType.php b/src/Component/Form/Type/DeliveryChoiceType.php index 26034e011..5c5ef9aa0 100644 --- a/src/Component/Form/Type/DeliveryChoiceType.php +++ b/src/Component/Form/Type/DeliveryChoiceType.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Form/Type/VariationChoiceType.php b/src/Component/Form/Type/VariationChoiceType.php index c373ea7e6..2b9236d02 100644 --- a/src/Component/Form/Type/VariationChoiceType.php +++ b/src/Component/Form/Type/VariationChoiceType.php @@ -1,7 +1,7 @@ * @@ -49,7 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) array('translation_domain' => 'SonataProductBundle'), $options['field_options'], array( - 'label' => sprintf('form_%s', $choiceTitle), + 'label' => sprintf('form_%s', $choiceTitle), 'choices' => $choiceValues, ) ) @@ -63,11 +63,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'field_options' => array(), - 'product' => null, - 'fields' => null, + 'field_options' => array(), + 'product' => null, + 'fields' => null, 'csrf_protection' => false, - 'method' => 'GET', + 'method' => 'GET', )); $resolver->setRequired(array('product', 'fields')); diff --git a/src/Component/Generator/Mustache.php b/src/Component/Generator/Mustache.php index b823b230d..c9f14d0fa 100644 --- a/src/Component/Generator/Mustache.php +++ b/src/Component/Generator/Mustache.php @@ -1,9 +1,9 @@ + * (c) Thomas Rabaix * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Component/Generator/MysqlReference.php b/src/Component/Generator/MysqlReference.php index 6d5c74b88..7d63bb506 100644 --- a/src/Component/Generator/MysqlReference.php +++ b/src/Component/Generator/MysqlReference.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Generator/ReferenceInterface.php b/src/Component/Generator/ReferenceInterface.php index 9b20d6e2a..5e31ae564 100644 --- a/src/Component/Generator/ReferenceInterface.php +++ b/src/Component/Generator/ReferenceInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Invoice/InvoiceElementInterface.php b/src/Component/Invoice/InvoiceElementInterface.php index ee4b57f1b..c8c71885e 100644 --- a/src/Component/Invoice/InvoiceElementInterface.php +++ b/src/Component/Invoice/InvoiceElementInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Invoice/InvoiceElementManagerInterface.php b/src/Component/Invoice/InvoiceElementManagerInterface.php index b09ae5c1b..1ffebb709 100644 --- a/src/Component/Invoice/InvoiceElementManagerInterface.php +++ b/src/Component/Invoice/InvoiceElementManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Invoice/InvoiceInterface.php b/src/Component/Invoice/InvoiceInterface.php index 7568fcf04..cf25d7668 100644 --- a/src/Component/Invoice/InvoiceInterface.php +++ b/src/Component/Invoice/InvoiceInterface.php @@ -1,7 +1,7 @@ * @@ -16,8 +16,8 @@ interface InvoiceInterface { - const STATUS_OPEN = 0; // created but not paid - const STATUS_PAID = 1; // the invoice has been paid + const STATUS_OPEN = 0; // created but not paid + const STATUS_PAID = 1; // the invoice has been paid const STATUS_CONFLICT = 2; // there is a conflict about this invoice /** diff --git a/src/Component/Invoice/InvoiceManagerInterface.php b/src/Component/Invoice/InvoiceManagerInterface.php index 43cbbb3d9..172ff70c8 100644 --- a/src/Component/Invoice/InvoiceManagerInterface.php +++ b/src/Component/Invoice/InvoiceManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Invoice/InvoiceStatusRenderer.php b/src/Component/Invoice/InvoiceStatusRenderer.php index d3450198e..64f1e7ee6 100644 --- a/src/Component/Invoice/InvoiceStatusRenderer.php +++ b/src/Component/Invoice/InvoiceStatusRenderer.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Order/OrderElementInterface.php b/src/Component/Order/OrderElementInterface.php index c99b0b9d5..9740e0385 100644 --- a/src/Component/Order/OrderElementInterface.php +++ b/src/Component/Order/OrderElementInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Order/OrderElementManagerInterface.php b/src/Component/Order/OrderElementManagerInterface.php index 632ac6c04..57be1cdcc 100644 --- a/src/Component/Order/OrderElementManagerInterface.php +++ b/src/Component/Order/OrderElementManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Order/OrderInterface.php b/src/Component/Order/OrderInterface.php index a9331cb9f..7aad4e05a 100644 --- a/src/Component/Order/OrderInterface.php +++ b/src/Component/Order/OrderInterface.php @@ -1,7 +1,7 @@ * @@ -16,12 +16,12 @@ interface OrderInterface { - const STATUS_OPEN = 0; // created but not validated - const STATUS_PENDING = 1; // waiting from action from the user - const STATUS_VALIDATED = 2; // the order is validated does not mean the payment is ok - const STATUS_CANCELLED = 3; // the order is cancelled - const STATUS_ERROR = 4; // the order has an error - const STATUS_STOPPED = 5; // use if the subscription has been cancelled/stopped + const STATUS_OPEN = 0; // created but not validated + const STATUS_PENDING = 1; // waiting from action from the user + const STATUS_VALIDATED = 2; // the order is validated does not mean the payment is ok + const STATUS_CANCELLED = 3; // the order is cancelled + const STATUS_ERROR = 4; // the order has an error + const STATUS_STOPPED = 5; // use if the subscription has been cancelled/stopped /** * @return int the order id diff --git a/src/Component/Order/OrderManagerInterface.php b/src/Component/Order/OrderManagerInterface.php index b3384b840..7330ffc89 100644 --- a/src/Component/Order/OrderManagerInterface.php +++ b/src/Component/Order/OrderManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Order/OrderStatusRenderer.php b/src/Component/Order/OrderStatusRenderer.php index a4f551d6d..d74138b53 100644 --- a/src/Component/Order/OrderStatusRenderer.php +++ b/src/Component/Order/OrderStatusRenderer.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/BasePayment.php b/src/Component/Payment/BasePayment.php index 3da84c4a6..2da447b1e 100644 --- a/src/Component/Payment/BasePayment.php +++ b/src/Component/Payment/BasePayment.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/BasePaypal.php b/src/Component/Payment/BasePaypal.php index 02f9cf4b8..f3e9e2e4c 100644 --- a/src/Component/Payment/BasePaypal.php +++ b/src/Component/Payment/BasePaypal.php @@ -1,7 +1,7 @@ * @@ -27,15 +27,15 @@ */ abstract class BasePaypal extends BasePayment { - const PAYMENT_STATUS_CANCELED_REVERSAL = 'Canceled_Reversal'; - const PAYMENT_STATUS_COMPLETED = 'Completed'; - const PAYMENT_STATUS_DENIED = 'Denied'; - const PAYMENT_STATUS_FAILED = 'Failed'; - const PAYMENT_STATUS_PENDING = 'Pending'; - const PAYMENT_STATUS_REFUNDED = 'Refunded'; - const PAYMENT_STATUS_REVERSED = 'Reversed'; - const PAYMENT_STATUS_PROCESSED = 'Processed'; - const PAYMENT_STATUS_VOIDED = 'Voided'; + const PAYMENT_STATUS_CANCELED_REVERSAL = 'Canceled_Reversal'; + const PAYMENT_STATUS_COMPLETED = 'Completed'; + const PAYMENT_STATUS_DENIED = 'Denied'; + const PAYMENT_STATUS_FAILED = 'Failed'; + const PAYMENT_STATUS_PENDING = 'Pending'; + const PAYMENT_STATUS_REFUNDED = 'Refunded'; + const PAYMENT_STATUS_REVERSED = 'Reversed'; + const PAYMENT_STATUS_PROCESSED = 'Processed'; + const PAYMENT_STATUS_VOIDED = 'Voided'; /** * @var RouterInterface @@ -122,10 +122,10 @@ public function getOrderReference(TransactionInterface $transaction) */ public function checkPaypalFiles() { - $key_file = $this->getOption('key_file'); - $cert_file = $this->getOption('cert_file'); - $paypal_cert_file = $this->getOption('paypal_cert_file'); - $openssl = $this->getOption('openssl'); + $key_file = $this->getOption('key_file'); + $cert_file = $this->getOption('cert_file'); + $paypal_cert_file = $this->getOption('paypal_cert_file'); + $openssl = $this->getOption('openssl'); // key file if (!file_exists($key_file)) { @@ -210,10 +210,10 @@ public function encryptViaBuffer($hash) { $this->checkPaypalFiles(); - $key_file = $this->getOption('key_file'); - $cert_file = $this->getOption('cert_file'); - $paypal_cert_file = $this->getOption('paypal_cert_file'); - $openssl = $this->getOption('openssl'); + $key_file = $this->getOption('key_file'); + $cert_file = $this->getOption('cert_file'); + $paypal_cert_file = $this->getOption('paypal_cert_file'); + $openssl = $this->getOption('openssl'); $openssl_cmd = "$openssl smime -sign -signer $cert_file -inkey $key_file ". "-outform der -nodetach -binary | $openssl smime -encrypt ". @@ -271,9 +271,9 @@ public function encryptViaFile($hash) { $this->checkPaypalFiles(); - $key_file = $this->getOption('key_file'); - $cert_file = $this->getOption('cert_file'); - $openssl = $this->getOption('openssl'); + $key_file = $this->getOption('key_file'); + $cert_file = $this->getOption('cert_file'); + $openssl = $this->getOption('openssl'); $paypal_cert_file = $this->getOption('paypal_cert_file'); // create tmp file @@ -321,15 +321,15 @@ public function encryptViaFile($hash) public static function getPaymentStatusList() { return array( - self::PAYMENT_STATUS_CANCELED_REVERSAL => 'A reversal has been cancelled. For example, you won a dispute with the customer, and the funds for the transaction that was reversed have been returned to you', - self::PAYMENT_STATUS_COMPLETED => 'The payment has been completed, and the funds have been added successfully to your account balance', - self::PAYMENT_STATUS_DENIED => 'You denied the payment. This happens only if the payment was previously pending because of possible reasons', - self::PAYMENT_STATUS_FAILED => 'The payment has failed. This happens only if the payment was made from your customer’s bank account.', - self::PAYMENT_STATUS_PENDING => 'The payment is pending. See pending_reason for more information.', - self::PAYMENT_STATUS_REFUNDED => 'You refunded the payment.', - self::PAYMENT_STATUS_REVERSED => 'A payment was reversed due to a chargeback or other type of reversal. The funds have been removed from your account balance and returned to the buyer. The reason for the reversal is specified in the ReasonCode element.', - self::PAYMENT_STATUS_PROCESSED => 'A payment has been accepted.', - self::PAYMENT_STATUS_VOIDED => 'This authorization has been voided.', + self::PAYMENT_STATUS_CANCELED_REVERSAL => 'A reversal has been cancelled. For example, you won a dispute with the customer, and the funds for the transaction that was reversed have been returned to you', + self::PAYMENT_STATUS_COMPLETED => 'The payment has been completed, and the funds have been added successfully to your account balance', + self::PAYMENT_STATUS_DENIED => 'You denied the payment. This happens only if the payment was previously pending because of possible reasons', + self::PAYMENT_STATUS_FAILED => 'The payment has failed. This happens only if the payment was made from your customer’s bank account.', + self::PAYMENT_STATUS_PENDING => 'The payment is pending. See pending_reason for more information.', + self::PAYMENT_STATUS_REFUNDED => 'You refunded the payment.', + self::PAYMENT_STATUS_REVERSED => 'A payment was reversed due to a chargeback or other type of reversal. The funds have been removed from your account balance and returned to the buyer. The reason for the reversal is specified in the ReasonCode element.', + self::PAYMENT_STATUS_PROCESSED => 'A payment has been accepted.', + self::PAYMENT_STATUS_VOIDED => 'This authorization has been voided.', ); } diff --git a/src/Component/Payment/CheckPayment.php b/src/Component/Payment/CheckPayment.php index 16bbf15c6..59c7bf414 100644 --- a/src/Component/Payment/CheckPayment.php +++ b/src/Component/Payment/CheckPayment.php @@ -1,7 +1,7 @@ * @@ -39,8 +39,8 @@ class CheckPayment extends BasePayment */ public function __construct(RouterInterface $router, LoggerInterface $logger, Browser $browser) { - $this->router = $router; - $this->logger = $logger; + $this->router = $router; + $this->logger = $logger; $this->browser = $browser; } @@ -142,9 +142,9 @@ public function isCallbackValid(TransactionInterface $transaction) public function sendbank(OrderInterface $order) { $params = array( - 'bank' => $this->getCode(), - 'reference' => $order->getReference(), - 'check' => $this->generateUrlCheck($order), + 'bank' => $this->getCode(), + 'reference' => $order->getReference(), + 'check' => $this->generateUrlCheck($order), ); // call the callback handler ... diff --git a/src/Component/Payment/Debug/DebugPayment.php b/src/Component/Payment/Debug/DebugPayment.php index 2e08c1f79..2546778cb 100644 --- a/src/Component/Payment/Debug/DebugPayment.php +++ b/src/Component/Payment/Debug/DebugPayment.php @@ -1,7 +1,7 @@ * @@ -31,7 +31,7 @@ class DebugPayment extends PassPayment public function sendbank(OrderInterface $order) { return new RedirectResponse($this->router->generate('sonata_payment_debug', array( - 'check' => $this->generateUrlCheck($order), + 'check' => $this->generateUrlCheck($order), 'reference' => $order->getReference(), ))); } @@ -47,10 +47,10 @@ public function sendbank(OrderInterface $order) public function processCallback(OrderInterface $order, $action) { $params = array( - 'bank' => $this->getCode(), + 'bank' => $this->getCode(), 'reference' => $order->getReference(), - 'check' => $this->generateUrlCheck($order), - 'action' => $action, + 'check' => $this->generateUrlCheck($order), + 'action' => $action, ); $url = $this->router->generate($this->getOption('url_callback'), $params, UrlGeneratorInterface::ABSOLUTE_URL); diff --git a/src/Component/Payment/InvalidTransactionException.php b/src/Component/Payment/InvalidTransactionException.php index 50b8f0f55..8b60ea869 100644 --- a/src/Component/Payment/InvalidTransactionException.php +++ b/src/Component/Payment/InvalidTransactionException.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/Ogone/OgonePayment.php b/src/Component/Payment/Ogone/OgonePayment.php index 136cfccab..53c712922 100644 --- a/src/Component/Payment/Ogone/OgonePayment.php +++ b/src/Component/Payment/Ogone/OgonePayment.php @@ -1,7 +1,7 @@ * @@ -50,9 +50,9 @@ class OgonePayment extends BasePayment */ public function __construct(RouterInterface $router, LoggerInterface $logger, EngineInterface $templating, $debug) { - $this->templating = $templating; - $this->router = $router; - $this->debug = $debug; + $this->templating = $templating; + $this->router = $router; + $this->debug = $debug; $this->setLogger($logger); } @@ -79,20 +79,20 @@ public function isBasketValid(BasketInterface $basket) public function isRequestValid(TransactionInterface $transaction) { $params = array( - 'orderID' => $transaction->get('orderID'), - 'currency' => $transaction->get('currency'), - 'amount' => $transaction->get('amount'), - 'PM' => $transaction->get('PM'), + 'orderID' => $transaction->get('orderID'), + 'currency' => $transaction->get('currency'), + 'amount' => $transaction->get('amount'), + 'PM' => $transaction->get('PM'), 'ACCEPTANCE' => $transaction->get('ACCEPTANCE'), - 'STATUS' => $transaction->get('STATUS'), - 'CARDNO' => $transaction->get('CARDNO'), - 'ED' => $transaction->get('ED'), - 'CN' => $transaction->get('CN'), - 'TRXDATE' => $transaction->get('TRXDATE'), - 'PAYID' => $transaction->get('PAYID'), - 'NCERROR' => $transaction->get('NCERROR'), - 'BRAND' => $transaction->get('BRAND'), - 'IP' => $transaction->get('IP'), + 'STATUS' => $transaction->get('STATUS'), + 'CARDNO' => $transaction->get('CARDNO'), + 'ED' => $transaction->get('ED'), + 'CN' => $transaction->get('CN'), + 'TRXDATE' => $transaction->get('TRXDATE'), + 'PAYID' => $transaction->get('PAYID'), + 'NCERROR' => $transaction->get('NCERROR'), + 'BRAND' => $transaction->get('BRAND'), + 'IP' => $transaction->get('IP'), ); $sha1 = $this->getShaSign($params, true); @@ -159,10 +159,10 @@ public function isCallbackValid(TransactionInterface $transaction) public function sendbank(OrderInterface $order) { return $this->templating->renderResponse($this->getOption('template'), array( - 'form_url' => $this->getOption('form_url'), - 'shasign' => $this->getShaSign($this->getFormParameters($order)), - 'fields' => $this->getFormParameters($order), - 'debug' => $this->debug, + 'form_url' => $this->getOption('form_url'), + 'shasign' => $this->getShaSign($this->getFormParameters($order)), + 'fields' => $this->getFormParameters($order), + 'debug' => $this->debug, )); } @@ -239,36 +239,36 @@ protected function getShaSign(array $params, $out = false) protected function getFormParameters(OrderInterface $order) { return array( - 'PSPID' => $this->getOption('pspid'), - 'orderId' => $order->getReference(), - 'amount' => $order->getTotalInc() * 100, - 'currency' => $order->getCurrency()->getLabel(), - 'language' => $order->getLocale(), - 'CN' => $order->getBillingName(), - 'EMAIL' => $order->getBillingEmail(), - 'ownerZIP' => $order->getBillingPostcode(), - 'owneraddress' => $this->getAddress($order), - 'ownercty' => $order->getBillingCity(), - 'ownertelno' => $order->getBillingPhone() ?: $order->getBillingMobile(), - - 'homeurl' => $this->getOption('home_url'), - 'catalogurl' => $this->getOption('catalog_url'), - - 'COMPLUS' => '', - 'PARAMPLUS' => 'bank='.$this->getCode(), - 'PARAMVAR' => '', - - 'PM' => 'CreditCard', - 'WIN3DS' => 'MAINW', - 'PMLIST' => 'VISA;MasterCard;CB', - 'PMListType' => 2, - - 'accepturl' => $this->generateAbsoluteUrlFromOption('url_callback', $order), - 'declineurl' => $this->generateAbsoluteUrlFromOption('url_callback', $order), - 'exceptionurl' => $this->generateAbsoluteUrlFromOption('url_return_ko', $order), - 'cancelurl' => $this->generateAbsoluteUrlFromOption('url_return_ko', $order), - - 'operation' => $this->getOperation(), + 'PSPID' => $this->getOption('pspid'), + 'orderId' => $order->getReference(), + 'amount' => $order->getTotalInc() * 100, + 'currency' => $order->getCurrency()->getLabel(), + 'language' => $order->getLocale(), + 'CN' => $order->getBillingName(), + 'EMAIL' => $order->getBillingEmail(), + 'ownerZIP' => $order->getBillingPostcode(), + 'owneraddress' => $this->getAddress($order), + 'ownercty' => $order->getBillingCity(), + 'ownertelno' => $order->getBillingPhone() ?: $order->getBillingMobile(), + + 'homeurl' => $this->getOption('home_url'), + 'catalogurl' => $this->getOption('catalog_url'), + + 'COMPLUS' => '', + 'PARAMPLUS' => 'bank='.$this->getCode(), + 'PARAMVAR' => '', + + 'PM' => 'CreditCard', + 'WIN3DS' => 'MAINW', + 'PMLIST' => 'VISA;MasterCard;CB', + 'PMListType' => 2, + + 'accepturl' => $this->generateAbsoluteUrlFromOption('url_callback', $order), + 'declineurl' => $this->generateAbsoluteUrlFromOption('url_callback', $order), + 'exceptionurl' => $this->generateAbsoluteUrlFromOption('url_return_ko', $order), + 'cancelurl' => $this->generateAbsoluteUrlFromOption('url_return_ko', $order), + + 'operation' => $this->getOperation(), ); } @@ -283,9 +283,9 @@ protected function generateAbsoluteUrlFromOption($optionKey, OrderInterface $ord return $this->router->generate( $this->getOption($optionKey), array( - 'bank' => $this->getCode(), + 'bank' => $this->getCode(), 'reference' => $order->getReference(), - 'check' => $this->generateUrlCheck($order), + 'check' => $this->generateUrlCheck($order), ), UrlGeneratorInterface::ABSOLUTE_URL ); diff --git a/src/Component/Payment/PassPayment.php b/src/Component/Payment/PassPayment.php index e8d5d8c34..1561b41c7 100644 --- a/src/Component/Payment/PassPayment.php +++ b/src/Component/Payment/PassPayment.php @@ -1,7 +1,7 @@ * @@ -141,9 +141,9 @@ public function isCallbackValid(TransactionInterface $transaction) public function sendbank(OrderInterface $order) { $params = array( - 'bank' => $this->getCode(), - 'reference' => $order->getReference(), - 'check' => $this->generateUrlCheck($order), + 'bank' => $this->getCode(), + 'reference' => $order->getReference(), + 'check' => $this->generateUrlCheck($order), ); // call the callback handler ... @@ -155,7 +155,7 @@ public function sendbank(OrderInterface $order) // redirect the user to the correct page $response = new Response('', 302, array( - 'Location' => $this->router->generate($this->getOption($routeName), $params, UrlGeneratorInterface::ABSOLUTE_URL), + 'Location' => $this->router->generate($this->getOption($routeName), $params, UrlGeneratorInterface::ABSOLUTE_URL), 'Content-Type' => 'text/plain', )); diff --git a/src/Component/Payment/PaymentHandler.php b/src/Component/Payment/PaymentHandler.php index 2bc9c0ad6..3d85b653c 100644 --- a/src/Component/Payment/PaymentHandler.php +++ b/src/Component/Payment/PaymentHandler.php @@ -1,7 +1,7 @@ * @@ -74,12 +74,12 @@ class PaymentHandler implements PaymentHandlerInterface */ public function __construct(OrderManagerInterface $orderManager, PaymentSelectorInterface $paymentSelector, ReferenceInterface $referenceGenerator, TransactionManagerInterface $transactionManager, BackendInterface $notificationBackend, EventDispatcherInterface $eventDispatcher) { - $this->orderManager = $orderManager; - $this->paymentSelector = $paymentSelector; - $this->referenceGenerator = $referenceGenerator; - $this->transactionManager = $transactionManager; + $this->orderManager = $orderManager; + $this->paymentSelector = $paymentSelector; + $this->referenceGenerator = $referenceGenerator; + $this->transactionManager = $transactionManager; $this->notificationBackend = $notificationBackend; - $this->eventDispatcher = $eventDispatcher; + $this->eventDispatcher = $eventDispatcher; } /** @@ -89,7 +89,7 @@ public function handleError(Request $request, BasketInterface $basket) { // retrieve the transaction $transaction = $this->createTransaction($request); - $order = $this->getValidOrder($transaction); + $order = $this->getValidOrder($transaction); $event = new PaymentEvent($order, $transaction); $this->getEventDispatcher()->dispatch(PaymentEvents::PRE_ERROR, $event); @@ -112,7 +112,7 @@ public function handleError(Request $request, BasketInterface $basket) $this->getEventDispatcher()->dispatch(PaymentEvents::POST_ERROR, $event); $this->notificationBackend->createAndPublish('sonata_payment_order_process', array( - 'order_id' => $order->getId(), + 'order_id' => $order->getId(), 'transaction_id' => $transaction->getId(), )); @@ -125,7 +125,7 @@ public function handleError(Request $request, BasketInterface $basket) public function handleConfirmation(Request $request) { $transaction = $this->createTransaction($request); - $order = $this->getValidOrder($transaction); + $order = $this->getValidOrder($transaction); $event = new PaymentEvent($order, $transaction); $this->getEventDispatcher()->dispatch(PaymentEvents::CONFIRMATION, $event); @@ -162,7 +162,7 @@ public function getPaymentCallbackResponse(Request $request) { // retrieve the transaction $transaction = $this->createTransaction($request); - $order = $this->getValidOrder($transaction); + $order = $this->getValidOrder($transaction); $event = new PaymentEvent($order, $transaction); $this->getEventDispatcher()->dispatch(PaymentEvents::PRE_CALLBACK, $event); @@ -177,7 +177,7 @@ public function getPaymentCallbackResponse(Request $request) $this->getEventDispatcher()->dispatch(PaymentEvents::POST_CALLBACK, $event); $this->notificationBackend->createAndPublish('sonata_payment_order_process', array( - 'order_id' => $order->getId(), + 'order_id' => $order->getId(), 'transaction_id' => $transaction->getId(), )); @@ -207,7 +207,7 @@ protected function getValidOrder(TransactionInterface $transaction) $payment = $this->getPayment($transaction->getPaymentCode()); // retrieve the related order - $reference = $payment->getOrderReference($transaction); + $reference = $payment->getOrderReference($transaction); if (!$reference) { throw new InvalidTransactionException(); diff --git a/src/Component/Payment/PaymentHandlerInterface.php b/src/Component/Payment/PaymentHandlerInterface.php index ccac5dd87..dc5b70cf5 100644 --- a/src/Component/Payment/PaymentHandlerInterface.php +++ b/src/Component/Payment/PaymentHandlerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/PaymentInterface.php b/src/Component/Payment/PaymentInterface.php index 3197fd93b..f234075fa 100644 --- a/src/Component/Payment/PaymentInterface.php +++ b/src/Component/Payment/PaymentInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/PaymentNotFoundException.php b/src/Component/Payment/PaymentNotFoundException.php index 7d30e0e44..390fde1d9 100644 --- a/src/Component/Payment/PaymentNotFoundException.php +++ b/src/Component/Payment/PaymentNotFoundException.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/PaymentSelectorInterface.php b/src/Component/Payment/PaymentSelectorInterface.php index 9ea2b8f37..c1dbf329a 100644 --- a/src/Component/Payment/PaymentSelectorInterface.php +++ b/src/Component/Payment/PaymentSelectorInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/Paypal.php b/src/Component/Payment/Paypal.php index fcd040384..0d22a4d74 100644 --- a/src/Component/Payment/Paypal.php +++ b/src/Component/Payment/Paypal.php @@ -1,7 +1,7 @@ * @@ -40,43 +40,43 @@ public function sendbank(OrderInterface $order) { $params = array( 'order' => $order->getReference(), - 'bank' => $this->getCode(), + 'bank' => $this->getCode(), 'check' => $this->generateUrlCheck($order), ); $fields = array( // paypal specific - 'cmd' => '_xclick', - 'charset' => 'utf-8', - 'business' => $this->getOption('account'), - 'cert_id' => $this->getOption('cert_id'), - 'no_shipping' => '1', // client cannot add shipping address - 'lc' => 'EN', // user interface language - 'no_note' => '1', // no comment on paypal + 'cmd' => '_xclick', + 'charset' => 'utf-8', + 'business' => $this->getOption('account'), + 'cert_id' => $this->getOption('cert_id'), + 'no_shipping' => '1', // client cannot add shipping address + 'lc' => 'EN', // user interface language + 'no_note' => '1', // no comment on paypal // invoice information - 'invoice' => $order->getReference(), - 'amount' => $order->getTotalInc(), + 'invoice' => $order->getReference(), + 'amount' => $order->getTotalInc(), 'currency_code' => $order->getCurrency(), - 'item_name' => 'Order '.$order->getReference(), - 'bn' => 'Sonata/1.0', // Assign Build Notation for PayPal Support + 'item_name' => 'Order '.$order->getReference(), + 'bn' => 'Sonata/1.0', // Assign Build Notation for PayPal Support // user information, for prepopulated form (paypal side) - 'first_name' => $order->getBillingName(), - 'last_name' => '', - 'address1' => $order->getBillingAddress1(), - 'address2' => $order->getBillingAddress2(), - 'city' => $order->getBillingCity(), - 'zip' => $order->getBillingPostcode(), - 'country' => $order->getBillingCountryCode(), + 'first_name' => $order->getBillingName(), + 'last_name' => '', + 'address1' => $order->getBillingAddress1(), + 'address2' => $order->getBillingAddress2(), + 'city' => $order->getBillingCity(), + 'zip' => $order->getBillingPostcode(), + 'country' => $order->getBillingCountryCode(), // Callback information - 'custom' => $this->generateUrlCheck($order), - 'notify_url' => $this->router->generate($this->getOption('url_callback'), $params, UrlGeneratorInterface::ABSOLUTE_URL), + 'custom' => $this->generateUrlCheck($order), + 'notify_url' => $this->router->generate($this->getOption('url_callback'), $params, UrlGeneratorInterface::ABSOLUTE_URL), // user link 'cancel_return' => $this->router->generate($this->getOption('url_return_ko'), $params, UrlGeneratorInterface::ABSOLUTE_URL), - 'return' => $this->router->generate($this->getOption('url_return_ok'), $params, UrlGeneratorInterface::ABSOLUTE_URL), + 'return' => $this->router->generate($this->getOption('url_return_ok'), $params, UrlGeneratorInterface::ABSOLUTE_URL), ); if ($this->getOption('debug', false)) { @@ -142,7 +142,7 @@ public function encrypt($hash) */ public function isCallbackValid(TransactionInterface $transaction) { - $order = $transaction->getOrder(); + $order = $transaction->getOrder(); if (!$this->isRequestValid($transaction)) { $transaction->setState(TransactionInterface::STATE_KO); @@ -324,15 +324,15 @@ public function isAddableProduct(BasketInterface $basket, ProductInterface $prod public static function getPendingReasonsList() { return array( - self::PENDING_REASON_ADDRESS => 'The payment is pending because your customer did not include a confirmed shipping address and your Payment Receiving Preferences is set yo allow you to manually accept or deny each of these payments. To change your preference, go to the Preferences section of your Profile.', - self::PENDING_REASON_AUTHORIZATION => 'You set Authorization on SetExpressCheckoutRequest and have not yet captured funds.', - self::PENDING_REASON_ECHECK => 'The payment is pending because it was made by an eCheck that has not yet cleared. ', - self::PENDING_REASON_INTL => 'The payment is pending because you hold a non-U.S. account and do not have a withdrawal mechanism. You must manually accept or deny this payment from your Account Overview.', - self::PENDING_REASON_MULTICURRENCY => 'You do not have a balance in the currency sent, and you do not have your Payment Receiving Preferences set to automatically convert and accept this payment. You must manually accept or deny this payment.', - self::PENDING_REASON_UNILATERAL => 'The payment is pending because it was made to an email address that is not yet registered or confirmed. upgrade: The payment is pending because it was made via credit card and you must upgrade your account to Business or Premier status in order to receive the funds. upgrade can also mean that you have reached the monthly limit for transactions on your account. ', - self::PENDING_REASON_UPGRADE => 'The payment is pending because it was made via credit card and you must upgrade your account to Business or Premier status in order to receive the funds. upgrade can also mean that you have reached the monthly limit for transactions on your account.', - self::PENDING_REASON_VERIFY => 'The payment is pending because you are not yet verified. You must verify your account before you can accept this payment. ', - self::PENDING_REASON_OTHER => 'The payment is pending for a reason other than those listed above. For more information, contact PayPal Customer Service.', + self::PENDING_REASON_ADDRESS => 'The payment is pending because your customer did not include a confirmed shipping address and your Payment Receiving Preferences is set yo allow you to manually accept or deny each of these payments. To change your preference, go to the Preferences section of your Profile.', + self::PENDING_REASON_AUTHORIZATION => 'You set Authorization on SetExpressCheckoutRequest and have not yet captured funds.', + self::PENDING_REASON_ECHECK => 'The payment is pending because it was made by an eCheck that has not yet cleared. ', + self::PENDING_REASON_INTL => 'The payment is pending because you hold a non-U.S. account and do not have a withdrawal mechanism. You must manually accept or deny this payment from your Account Overview.', + self::PENDING_REASON_MULTICURRENCY => 'You do not have a balance in the currency sent, and you do not have your Payment Receiving Preferences set to automatically convert and accept this payment. You must manually accept or deny this payment.', + self::PENDING_REASON_UNILATERAL => 'The payment is pending because it was made to an email address that is not yet registered or confirmed. upgrade: The payment is pending because it was made via credit card and you must upgrade your account to Business or Premier status in order to receive the funds. upgrade can also mean that you have reached the monthly limit for transactions on your account. ', + self::PENDING_REASON_UPGRADE => 'The payment is pending because it was made via credit card and you must upgrade your account to Business or Premier status in order to receive the funds. upgrade can also mean that you have reached the monthly limit for transactions on your account.', + self::PENDING_REASON_VERIFY => 'The payment is pending because you are not yet verified. You must verify your account before you can accept this payment. ', + self::PENDING_REASON_OTHER => 'The payment is pending for a reason other than those listed above. For more information, contact PayPal Customer Service.', ); } } diff --git a/src/Component/Payment/Pool.php b/src/Component/Payment/Pool.php index d9ca08e71..9594170ff 100644 --- a/src/Component/Payment/Pool.php +++ b/src/Component/Payment/Pool.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/Scellius/NodeScelliusTransactionGenerator.php b/src/Component/Payment/Scellius/NodeScelliusTransactionGenerator.php index 13eecb6aa..f734001e2 100644 --- a/src/Component/Payment/Scellius/NodeScelliusTransactionGenerator.php +++ b/src/Component/Payment/Scellius/NodeScelliusTransactionGenerator.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/Scellius/OrderScelliusTransactionGenerator.php b/src/Component/Payment/Scellius/OrderScelliusTransactionGenerator.php index e084c6f45..9b9ace25d 100644 --- a/src/Component/Payment/Scellius/OrderScelliusTransactionGenerator.php +++ b/src/Component/Payment/Scellius/OrderScelliusTransactionGenerator.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/Scellius/ScelliusPayment.php b/src/Component/Payment/Scellius/ScelliusPayment.php index 1ee5d7058..5c0b8a278 100644 --- a/src/Component/Payment/Scellius/ScelliusPayment.php +++ b/src/Component/Payment/Scellius/ScelliusPayment.php @@ -1,7 +1,7 @@ * @@ -54,9 +54,9 @@ class ScelliusPayment extends BasePayment */ public function __construct(RouterInterface $router, LoggerInterface $logger, EngineInterface $templating, ScelliusTransactionGeneratorInterface $transactionGenerator, $debug) { - $this->templating = $templating; - $this->router = $router; - $this->debug = $debug; + $this->templating = $templating; + $this->router = $router; + $this->debug = $debug; $this->transactionGenerator = $transactionGenerator; $this->setLogger($logger); @@ -121,7 +121,7 @@ public static function getCVVResponseCode() '53' => 'Le numéro de contrôle est absent de la demande d’autorisation', '55' => 'La banque de l’internaute n’est pas certifiée, le contrôle n’a pu être effectué.', 'NO' => 'Pas de cryptogramme sur la carte.', - '' => 'Pour les cartes AMEX, American Express ne retourne pas de code réponse spécifique à la vérification du numéro de contrôle.'. + '' => 'Pour les cartes AMEX, American Express ne retourne pas de code réponse spécifique à la vérification du numéro de contrôle.'. 'Si le code sécurité de la carte est faux, American Express retourne un code 05 dans le champ RESPONSE_CODE.'. 'Pour les cartes FINAREF, Finaref ne retourne pas de code réponse spécifique à la vérification du numéro de contrôle. ', ); @@ -137,7 +137,7 @@ public static function getBankCodeResponses() $responses = array(); $responses[] = array( - 'banks' => array('CB', 'VISA', 'MASTERCARD', 'AMEX'), + 'banks' => array('CB', 'VISA', 'MASTERCARD', 'AMEX'), 'messages' => array( array('00' => 'Transaction approuvée ou traitée avec succès'), array('02' => 'Contacter l\'émetteur de carte'), @@ -176,7 +176,7 @@ public static function getBankCodeResponses() ); $responses[] = array( - 'banks' => array('AMEX'), + 'banks' => array('AMEX'), 'messages' => array( '00' => 'Transaction approuvée ou traitée avec succès', '02' => 'Dépassement de plafond', @@ -187,7 +187,7 @@ public static function getBankCodeResponses() ); $responses[] = array( - 'banks' => array('FINAREF'), + 'banks' => array('FINAREF'), 'messages' => array( '00' => 'Transaction approuvée', '03' => 'Commerçant inconnu - Identifiant de commerçant incorrect', @@ -229,45 +229,45 @@ public static function getLanguageCodes() public static function getPaymentMeans() { return array( - 'CB' => array('name' => 'Carte Bleue', 'network' => 'CB Nationale'), - 'VISA' => array('name' => 'VISA', 'network' => 'CB Internationale'), - 'MASTERCARD' => array('name' => 'MASTERCARD', 'network' => 'CB Internationale'), - 'AMEX' => array('name' => 'AMEX', 'network' => 'American Express'), - 'DINERS' => array('name' => 'DINER\'S CLUB', 'network' => 'DINERS'), - 'FINAREF' => array('name' => 'FINAREF', 'network' => 'FINAREF'), - 'FNAC' => array('name' => 'FNAC', 'network' => 'FINAREF'), - 'CYRILLUS' => array('name' => 'CYRILLUS', 'network' => 'FINAREF'), - 'PRINTEMPS' => array('name' => 'PRINTEMPS', 'network' => 'FINAREF'), - 'KANGOUROU' => array('name' => 'KANGOUROU', 'network' => 'FINAREF'), - 'SURCOUF' => array('name' => 'SURCOUF', 'network' => 'FINAREF'), - 'POCKETCARD' => array('name' => 'POCKETCARD (Belgique)', 'network' => 'FINAREF'), - 'CONFORAMA' => array('name' => 'CONFORAMA', 'network' => 'FINAREF'), - 'NUITEA' => array('name' => 'NUITEA', 'network' => 'CETELEM'), - 'AURORE' => array('name' => 'AURORE', 'network' => 'CETELEM'), - 'PASS' => array('name' => 'PASS', 'network' => 'CETELEM'), - 'PLURIEL' => array('name' => 'PLURIEL', 'network' => 'FRANFINANCE'), - 'TOYSRUS' => array('name' => 'TOYSRUS', 'network' => 'FRANFINANCE'), - 'CONNEXION' => array('name' => 'CONNEXION', 'network' => 'FRANFINANCE'), - 'HYPERMEDIA' => array('name' => 'HYPERMEDIA', 'network' => 'FRANFINANCE'), - 'DELATOUR' => array('name' => 'DELATOUR', 'network' => 'FRANFINANCE'), - 'NORAUTO' => array('name' => 'NORAUTO', 'network' => 'FRANFINANCE'), - 'NOUVFRONT' => array('name' => 'NOUVELLES FRONTIERES', 'network' => 'FRANFINANCE'), - 'SERAP' => array('name' => 'SERAP', 'network' => 'FRANFINANCE'), - 'BOURBON' => array('name' => 'BOURBON', 'network' => 'FRANFINANCE'), - 'COFINOGA' => array('name' => 'COFINOGA', 'network' => 'COFINOGA'), - 'COFINOGA _BHV' => array('name' => 'BHV', 'network' => 'COFINOGA'), - 'COFINOGA _CASINOGEANT' => array('name' => 'CASINOGEANT', 'network' => 'COFINOGA'), - 'COFINOGA _DIAC' => array('name' => 'DIAC', 'network' => 'COFINOGA'), - 'COFINOGA _GL' => array('name' => 'GL', 'network' => 'COFINOGA'), - 'COFINOGA _GOSPORT' => array('name' => 'GOSPORT', 'network' => 'COFINOGA'), - 'COFINOGA _MONOPRIX' => array('name' => 'MONOPRIX', 'network' => 'COFINOGA'), - 'COFINOGA _MRBRICOLAGE' => array('name' => 'MRBRICOLAGE', 'network' => 'COFINOGA'), - 'COFINOGA _SOFICARTE' => array('name' => 'SOFICARTE', 'network' => 'COFINOGA'), - 'COFINOGA _SYGMA' => array('name' => 'SYGMA', 'network' => 'COFINOGA'), - 'JCB' => array('name' => 'JCB', 'network' => 'JCB - Japanese Credit Bureau'), - 'DELTA' => array('name' => 'DELTA', 'network' => 'NATWEST - GB'), - 'SWITCH' => array('name' => 'SWITCH', 'network' => 'NATWEST - GB'), - 'SOLO' => array('name' => 'SOLO', 'network' => 'NATWEST - GB'), + 'CB' => array('name' => 'Carte Bleue', 'network' => 'CB Nationale'), + 'VISA' => array('name' => 'VISA', 'network' => 'CB Internationale'), + 'MASTERCARD' => array('name' => 'MASTERCARD', 'network' => 'CB Internationale'), + 'AMEX' => array('name' => 'AMEX', 'network' => 'American Express'), + 'DINERS' => array('name' => 'DINER\'S CLUB', 'network' => 'DINERS'), + 'FINAREF' => array('name' => 'FINAREF', 'network' => 'FINAREF'), + 'FNAC' => array('name' => 'FNAC', 'network' => 'FINAREF'), + 'CYRILLUS' => array('name' => 'CYRILLUS', 'network' => 'FINAREF'), + 'PRINTEMPS' => array('name' => 'PRINTEMPS', 'network' => 'FINAREF'), + 'KANGOUROU' => array('name' => 'KANGOUROU', 'network' => 'FINAREF'), + 'SURCOUF' => array('name' => 'SURCOUF', 'network' => 'FINAREF'), + 'POCKETCARD' => array('name' => 'POCKETCARD (Belgique)', 'network' => 'FINAREF'), + 'CONFORAMA' => array('name' => 'CONFORAMA', 'network' => 'FINAREF'), + 'NUITEA' => array('name' => 'NUITEA', 'network' => 'CETELEM'), + 'AURORE' => array('name' => 'AURORE', 'network' => 'CETELEM'), + 'PASS' => array('name' => 'PASS', 'network' => 'CETELEM'), + 'PLURIEL' => array('name' => 'PLURIEL', 'network' => 'FRANFINANCE'), + 'TOYSRUS' => array('name' => 'TOYSRUS', 'network' => 'FRANFINANCE'), + 'CONNEXION' => array('name' => 'CONNEXION', 'network' => 'FRANFINANCE'), + 'HYPERMEDIA' => array('name' => 'HYPERMEDIA', 'network' => 'FRANFINANCE'), + 'DELATOUR' => array('name' => 'DELATOUR', 'network' => 'FRANFINANCE'), + 'NORAUTO' => array('name' => 'NORAUTO', 'network' => 'FRANFINANCE'), + 'NOUVFRONT' => array('name' => 'NOUVELLES FRONTIERES', 'network' => 'FRANFINANCE'), + 'SERAP' => array('name' => 'SERAP', 'network' => 'FRANFINANCE'), + 'BOURBON' => array('name' => 'BOURBON', 'network' => 'FRANFINANCE'), + 'COFINOGA' => array('name' => 'COFINOGA', 'network' => 'COFINOGA'), + 'COFINOGA _BHV' => array('name' => 'BHV', 'network' => 'COFINOGA'), + 'COFINOGA _CASINOGEANT' => array('name' => 'CASINOGEANT', 'network' => 'COFINOGA'), + 'COFINOGA _DIAC' => array('name' => 'DIAC', 'network' => 'COFINOGA'), + 'COFINOGA _GL' => array('name' => 'GL', 'network' => 'COFINOGA'), + 'COFINOGA _GOSPORT' => array('name' => 'GOSPORT', 'network' => 'COFINOGA'), + 'COFINOGA _MONOPRIX' => array('name' => 'MONOPRIX', 'network' => 'COFINOGA'), + 'COFINOGA _MRBRICOLAGE' => array('name' => 'MRBRICOLAGE', 'network' => 'COFINOGA'), + 'COFINOGA _SOFICARTE' => array('name' => 'SOFICARTE', 'network' => 'COFINOGA'), + 'COFINOGA _SYGMA' => array('name' => 'SYGMA', 'network' => 'COFINOGA'), + 'JCB' => array('name' => 'JCB', 'network' => 'JCB - Japanese Credit Bureau'), + 'DELTA' => array('name' => 'DELTA', 'network' => 'NATWEST - GB'), + 'SWITCH' => array('name' => 'SWITCH', 'network' => 'NATWEST - GB'), + 'SOLO' => array('name' => 'SOLO', 'network' => 'NATWEST - GB'), ); } @@ -389,77 +389,6 @@ public function sendConfirmationReceipt(TransactionInterface $transaction) return new Response(); } - /** - * @param TransactionInterface $transaction - * - * @throws \RuntimeException - * - * @return array - */ - private function getResponseData(TransactionInterface $transaction) - { - $cmd = sprintf('cd %s && %s pathfile=%s message=%s ', - $this->getOption('base_folder'), - $this->getOption('response_command'), - $this->getOption('pathfile'), - $this->encodeString($transaction->get('DATA')) - ); - - $this->logger->debug(sprintf('Response Command : %s', $cmd)); - - $process = new Process($cmd); - $process->run(); - - if (!$process->isSuccessful()) { - throw new \RuntimeException(sprintf('Error %d when executing Scellius command: "%s".', $process->getExitCode(), trim($process->getErrorOutput()))); - } - - //Sortie de la fonction : !code!error!v1!v2!v3!...!v29 - // - code = 0 : la fonction retourne les données de la transaction dans les variables v1, v2, ... - // : Ces variables sont décrites dans le GUIDE DU PROGRAMMEUR - // - code = -1 : La fonction retourne un message d'erreur dans la variable error - $data = explode('!', $process->getOutput()); - - if (count($data) != 33) { - throw new \RuntimeException('Invalid data count'); - } - - return array( - 'code' => $data[1], - 'error' => $data[2], - 'merchant_id' => $data[3], - 'merchant_country' => $data[4], - 'amount' => $data[5], - 'transaction_id' => $data[6], - 'payment_means' => $data[7], - 'transmission_date' => $data[8], - 'payment_time' => $data[9], - 'payment_date' => $data[10], - 'response_code' => $data[11], - 'payment_certificate' => $data[12], - 'authorisation_id' => $data[13], - 'currency_code' => $data[14], - 'card_number' => $data[15], - 'cvv_flag' => $data[16], - 'cvv_response_code' => $data[17], - 'bank_response_code' => $data[18], - 'complementary_code' => $data[19], - 'complementary_info' => $data[20], - 'return_context' => $data[21], - 'caddie' => $data[22], - 'receipt_complement' => $data[23], - 'merchant_language' => $data[24], - 'language' => $data[25], - 'customer_id' => $data[26], - 'order_id' => $data[27], - 'customer_email' => $data[28], - 'customer_ip_address' => $data[29], - 'capture_day' => $data[30], - 'capture_mode' => $data[31], - 'data' => $data[32], - ); - } - /** * {@inheritdoc} */ @@ -480,43 +409,6 @@ public function isCallbackValid(TransactionInterface $transaction) return false; } - /** - * @throws \RuntimeException - * - * @param $currency - * - * @return - */ - private function getCurrencyCode($currency) - { - $list = self::getCurrencyList(); - - if (isset($list[$currency])) { - return $list[$currency]['code']; - } - - throw new \RuntimeException('Invalid exception provided'); - } - - /** - * @throws \RuntimeException - * - * @param $amount - * @param $currency - * - * @return string - */ - private function getAmount($amount, $currency) - { - $list = self::getCurrencyList(); - - if (!isset($list[$currency])) { - throw new \RuntimeException('Invalid currency provided'); - } - - return (int) (100 * bcmul(1, $amount, $list[$currency]['fraction'])); - } - /** * @param \Sonata\Component\Order\OrderInterface $order * @@ -541,49 +433,49 @@ public function getLanguage(OrderInterface $order) public function sendbank(OrderInterface $order) { $params = array( - 'bank' => $this->getCode(), - 'reference' => $order->getReference(), - 'check' => $this->generateUrlCheck($order), + 'bank' => $this->getCode(), + 'reference' => $order->getReference(), + 'check' => $this->generateUrlCheck($order), ); $cmdLineParameters = array( // base configuration - 'merchant_id' => $this->getOption('merchant_id'), - 'merchant_country' => $this->getOption('merchant_country'), - 'pathfile' => $this->getOption('pathfile'), - 'language' => $this->getLanguage($order), - 'payment_means' => $this->getOption('payment_means'), - 'header_flag' => $this->getOption('header_flag'), - 'capture_day' => $this->getOption('capture_day'), - 'capture_mode' => $this->getOption('capture_mode'), - 'bgcolor' => $this->getOption('bgcolor'), - 'block_align' => $this->getOption('block_align'), - 'block_order' => $this->getOption('block_order'), - 'textcolor' => $this->getOption('textcolor'), - 'normal_return_logo' => $this->getOption('normal_return_logo'), - 'cancel_return_logo' => $this->getOption('cancel_return_logo'), - 'submit_logo' => $this->getOption('submit_logo'), - 'logo_id' => $this->getOption('logo_id'), - 'logo_id2' => $this->getOption('logo_id2'), - 'advert' => $this->getOption('advert'), - 'background_id' => $this->getOption('background_id'), - 'templatefile' => $this->getOption('templatefile'), + 'merchant_id' => $this->getOption('merchant_id'), + 'merchant_country' => $this->getOption('merchant_country'), + 'pathfile' => $this->getOption('pathfile'), + 'language' => $this->getLanguage($order), + 'payment_means' => $this->getOption('payment_means'), + 'header_flag' => $this->getOption('header_flag'), + 'capture_day' => $this->getOption('capture_day'), + 'capture_mode' => $this->getOption('capture_mode'), + 'bgcolor' => $this->getOption('bgcolor'), + 'block_align' => $this->getOption('block_align'), + 'block_order' => $this->getOption('block_order'), + 'textcolor' => $this->getOption('textcolor'), + 'normal_return_logo' => $this->getOption('normal_return_logo'), + 'cancel_return_logo' => $this->getOption('cancel_return_logo'), + 'submit_logo' => $this->getOption('submit_logo'), + 'logo_id' => $this->getOption('logo_id'), + 'logo_id2' => $this->getOption('logo_id2'), + 'advert' => $this->getOption('advert'), + 'background_id' => $this->getOption('background_id'), + 'templatefile' => $this->getOption('templatefile'), // runtime parameters - 'amount' => $this->getAmount($order->getTotalInc(), $order->getCurrency()->getLabel()), - 'currency_code' => $this->getCurrencyCode($order->getCurrency()->getLabel()), - 'transaction_id' => $this->transactionGenerator->generate($order), - 'normal_return_url' => $this->router->generate($this->getOption('url_return_ok'), $params, UrlGeneratorInterface::ABSOLUTE_URL), - 'cancel_return_url' => $this->router->generate($this->getOption('url_return_ko'), $params, UrlGeneratorInterface::ABSOLUTE_URL), - 'automatic_response_url' => $this->router->generate($this->getOption('url_callback'), $params, UrlGeneratorInterface::ABSOLUTE_URL), - 'caddie' => 'mon_caddie', - 'customer_id' => $order->getCustomer()->getId(), - 'customer_email' => $order->getCustomer()->getEmail(), - 'customer_ip_address' => '', - 'data' => $this->getOption('data'), - 'return_context' => '', - 'target' => '', - 'order_id' => $order->getReference(), + 'amount' => $this->getAmount($order->getTotalInc(), $order->getCurrency()->getLabel()), + 'currency_code' => $this->getCurrencyCode($order->getCurrency()->getLabel()), + 'transaction_id' => $this->transactionGenerator->generate($order), + 'normal_return_url' => $this->router->generate($this->getOption('url_return_ok'), $params, UrlGeneratorInterface::ABSOLUTE_URL), + 'cancel_return_url' => $this->router->generate($this->getOption('url_return_ko'), $params, UrlGeneratorInterface::ABSOLUTE_URL), + 'automatic_response_url' => $this->router->generate($this->getOption('url_callback'), $params, UrlGeneratorInterface::ABSOLUTE_URL), + 'caddie' => 'mon_caddie', + 'customer_id' => $order->getCustomer()->getId(), + 'customer_email' => $order->getCustomer()->getEmail(), + 'customer_ip_address' => '', + 'data' => $this->getOption('data'), + 'return_context' => '', + 'target' => '', + 'order_id' => $order->getReference(), ); // clean parameters @@ -614,20 +506,20 @@ public function sendbank(OrderInterface $order) if ($data[1] == 0) { $scellius = array( - 'valid' => true, + 'valid' => true, 'content' => $data[3], ); } else { $scellius = array( - 'valid' => false, + 'valid' => false, 'content' => $data[2], ); } return $this->templating->renderResponse($this->getOption('template'), array( - 'order' => $order, - 'scellius' => $scellius, - 'debug' => $this->debug, + 'order' => $order, + 'scellius' => $scellius, + 'debug' => $this->debug, 'parameters' => $cmdLineParameters, )); } @@ -655,4 +547,112 @@ public function applyTransactionId(TransactionInterface $transaction) { $transaction->setTransactionId('n/a'); } + + /** + * @param TransactionInterface $transaction + * + * @throws \RuntimeException + * + * @return array + */ + private function getResponseData(TransactionInterface $transaction) + { + $cmd = sprintf('cd %s && %s pathfile=%s message=%s ', + $this->getOption('base_folder'), + $this->getOption('response_command'), + $this->getOption('pathfile'), + $this->encodeString($transaction->get('DATA')) + ); + + $this->logger->debug(sprintf('Response Command : %s', $cmd)); + + $process = new Process($cmd); + $process->run(); + + if (!$process->isSuccessful()) { + throw new \RuntimeException(sprintf('Error %d when executing Scellius command: "%s".', $process->getExitCode(), trim($process->getErrorOutput()))); + } + + //Sortie de la fonction : !code!error!v1!v2!v3!...!v29 + // - code = 0 : la fonction retourne les données de la transaction dans les variables v1, v2, ... + // : Ces variables sont décrites dans le GUIDE DU PROGRAMMEUR + // - code = -1 : La fonction retourne un message d'erreur dans la variable error + $data = explode('!', $process->getOutput()); + + if (count($data) != 33) { + throw new \RuntimeException('Invalid data count'); + } + + return array( + 'code' => $data[1], + 'error' => $data[2], + 'merchant_id' => $data[3], + 'merchant_country' => $data[4], + 'amount' => $data[5], + 'transaction_id' => $data[6], + 'payment_means' => $data[7], + 'transmission_date' => $data[8], + 'payment_time' => $data[9], + 'payment_date' => $data[10], + 'response_code' => $data[11], + 'payment_certificate' => $data[12], + 'authorisation_id' => $data[13], + 'currency_code' => $data[14], + 'card_number' => $data[15], + 'cvv_flag' => $data[16], + 'cvv_response_code' => $data[17], + 'bank_response_code' => $data[18], + 'complementary_code' => $data[19], + 'complementary_info' => $data[20], + 'return_context' => $data[21], + 'caddie' => $data[22], + 'receipt_complement' => $data[23], + 'merchant_language' => $data[24], + 'language' => $data[25], + 'customer_id' => $data[26], + 'order_id' => $data[27], + 'customer_email' => $data[28], + 'customer_ip_address' => $data[29], + 'capture_day' => $data[30], + 'capture_mode' => $data[31], + 'data' => $data[32], + ); + } + + /** + * @throws \RuntimeException + * + * @param $currency + * + * @return + */ + private function getCurrencyCode($currency) + { + $list = self::getCurrencyList(); + + if (isset($list[$currency])) { + return $list[$currency]['code']; + } + + throw new \RuntimeException('Invalid exception provided'); + } + + /** + * @throws \RuntimeException + * + * @param $amount + * @param $currency + * + * @return string + */ + private function getAmount($amount, $currency) + { + $list = self::getCurrencyList(); + + if (!isset($list[$currency])) { + throw new \RuntimeException('Invalid currency provided'); + } + + return (int) (100 * bcmul(1, $amount, $list[$currency]['fraction'])); + } } diff --git a/src/Component/Payment/Scellius/ScelliusTransactionGeneratorInterface.php b/src/Component/Payment/Scellius/ScelliusTransactionGeneratorInterface.php index b91efd72f..d06b774d6 100644 --- a/src/Component/Payment/Scellius/ScelliusTransactionGeneratorInterface.php +++ b/src/Component/Payment/Scellius/ScelliusTransactionGeneratorInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/Selector.php b/src/Component/Payment/Selector.php index 78cbc3584..f4ed58ead 100644 --- a/src/Component/Payment/Selector.php +++ b/src/Component/Payment/Selector.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Payment/TransactionInterface.php b/src/Component/Payment/TransactionInterface.php index dbd0cfafe..19d4eb364 100644 --- a/src/Component/Payment/TransactionInterface.php +++ b/src/Component/Payment/TransactionInterface.php @@ -1,7 +1,7 @@ * @@ -28,16 +28,16 @@ interface TransactionInterface const STATE_OK = 1; const STATE_KO = 2; - const STATUS_ORDER_UNKNOWN = -1; // the order is unknown - const STATUS_OPEN = 0; // created but not validated - const STATUS_PENDING = 1; // the bank send a 'pending-like' status, so the payment is not validated, but the user payed - const STATUS_VALIDATED = 2; // the bank confirm the payment - const STATUS_CANCELLED = 3; // the user cancelled the payment - const STATUS_UNKNOWN = 4; // the bank sent a unknown code ... + const STATUS_ORDER_UNKNOWN = -1; // the order is unknown + const STATUS_OPEN = 0; // created but not validated + const STATUS_PENDING = 1; // the bank send a 'pending-like' status, so the payment is not validated, but the user payed + const STATUS_VALIDATED = 2; // the bank confirm the payment + const STATUS_CANCELLED = 3; // the user cancelled the payment + const STATUS_UNKNOWN = 4; // the bank sent a unknown code ... const STATUS_ERROR_VALIDATION = 9; // something wrong happen when the bank validate the postback - const STATUS_WRONG_CALLBACK = 10; // something wrong is sent from the bank. hack or the bank change something ... - const STATUS_WRONG_REQUEST = 11; // the callback request is not valid - const STATUS_ORDER_NOT_OPEN = 12; // the order is not open (so a previous transaction already alter the order) + const STATUS_WRONG_CALLBACK = 10; // something wrong is sent from the bank. hack or the bank change something ... + const STATUS_WRONG_REQUEST = 11; // the callback request is not valid + const STATUS_ORDER_NOT_OPEN = 12; // the order is not open (so a previous transaction already alter the order) /** * @param \Sonata\Component\Order\OrderInterface $order diff --git a/src/Component/Payment/TransactionManagerInterface.php b/src/Component/Payment/TransactionManagerInterface.php index 6b32521e8..0f17ee5c9 100644 --- a/src/Component/Payment/TransactionManagerInterface.php +++ b/src/Component/Payment/TransactionManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/AddBasket.php b/src/Component/Product/AddBasket.php index 7330b6931..5c4cf144a 100644 --- a/src/Component/Product/AddBasket.php +++ b/src/Component/Product/AddBasket.php @@ -1,9 +1,9 @@ project. + * This file is part of the Sonata Project package. * - * (c) + * (c) Thomas Rabaix * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Component/Product/DeliveryInterface.php b/src/Component/Product/DeliveryInterface.php index 940409e89..43821aef4 100644 --- a/src/Component/Product/DeliveryInterface.php +++ b/src/Component/Product/DeliveryInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/DeliveryManagerInterface.php b/src/Component/Product/DeliveryManagerInterface.php index 22a354b90..4abcc0c46 100644 --- a/src/Component/Product/DeliveryManagerInterface.php +++ b/src/Component/Product/DeliveryManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/PackageInterface.php b/src/Component/Product/PackageInterface.php index c7f68bbdc..dfefea4f8 100644 --- a/src/Component/Product/PackageInterface.php +++ b/src/Component/Product/PackageInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/PackageManagerInterface.php b/src/Component/Product/PackageManagerInterface.php index 3588bea3c..b26f84792 100644 --- a/src/Component/Product/PackageManagerInterface.php +++ b/src/Component/Product/PackageManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/Pool.php b/src/Component/Product/Pool.php index a571a70e8..7b248765d 100644 --- a/src/Component/Product/Pool.php +++ b/src/Component/Product/Pool.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/PriceComputableInterface.php b/src/Component/Product/PriceComputableInterface.php index b381436e8..186bfcf66 100644 --- a/src/Component/Product/PriceComputableInterface.php +++ b/src/Component/Product/PriceComputableInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/ProductCategoryInterface.php b/src/Component/Product/ProductCategoryInterface.php index 60e170d18..5282be952 100644 --- a/src/Component/Product/ProductCategoryInterface.php +++ b/src/Component/Product/ProductCategoryInterface.php @@ -1,7 +1,7 @@ * @@ -77,6 +77,7 @@ public function getCreatedAt(); * @param ProductInterface $product */ public function setProduct(ProductInterface $product); + /** * Get Product. * diff --git a/src/Component/Product/ProductCategoryManagerInterface.php b/src/Component/Product/ProductCategoryManagerInterface.php index 75193db2a..13e2ab536 100644 --- a/src/Component/Product/ProductCategoryManagerInterface.php +++ b/src/Component/Product/ProductCategoryManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/ProductCollectionInterface.php b/src/Component/Product/ProductCollectionInterface.php index fe3b77003..b4e8a6cc8 100644 --- a/src/Component/Product/ProductCollectionInterface.php +++ b/src/Component/Product/ProductCollectionInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Component\Product; /* @@ -63,6 +72,7 @@ public function getCreatedAt(); * @param ProductInterface $product */ public function setProduct(ProductInterface $product); + /** * Get Product. * diff --git a/src/Component/Product/ProductCollectionManagerInterface.php b/src/Component/Product/ProductCollectionManagerInterface.php index fb9f800d0..321a0b79c 100644 --- a/src/Component/Product/ProductCollectionManagerInterface.php +++ b/src/Component/Product/ProductCollectionManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/ProductDefinition.php b/src/Component/Product/ProductDefinition.php index e4a6a3535..0254242a4 100644 --- a/src/Component/Product/ProductDefinition.php +++ b/src/Component/Product/ProductDefinition.php @@ -1,7 +1,7 @@ * @@ -30,7 +30,7 @@ class ProductDefinition public function __construct(ProductProviderInterface $provider, ProductManagerInterface $manager) { $this->provider = $provider; - $this->manager = $manager; + $this->manager = $manager; } /** diff --git a/src/Component/Product/ProductFinder.php b/src/Component/Product/ProductFinder.php index d4247beb9..4b8bfb085 100644 --- a/src/Component/Product/ProductFinder.php +++ b/src/Component/Product/ProductFinder.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/ProductFinderInterface.php b/src/Component/Product/ProductFinderInterface.php index 6558472e2..cc99af6d7 100644 --- a/src/Component/Product/ProductFinderInterface.php +++ b/src/Component/Product/ProductFinderInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/ProductInterface.php b/src/Component/Product/ProductInterface.php index 877e5dbba..64680050a 100644 --- a/src/Component/Product/ProductInterface.php +++ b/src/Component/Product/ProductInterface.php @@ -1,7 +1,7 @@ * @@ -18,6 +18,13 @@ interface ProductInterface extends PriceComputableInterface { + /** + * Get Product name. + * + * @return string + */ + public function __toString(); + /** * Get id. * @@ -466,13 +473,6 @@ public function getOptions(); */ public function setOptions(array $options); - /** - * Get Product name. - * - * @return string - */ - public function __toString(); - /** * Return true if the Product is a master (parent of variation(s) or single product). * diff --git a/src/Component/Product/ProductManagerInterface.php b/src/Component/Product/ProductManagerInterface.php index e9acb2367..522e075f7 100644 --- a/src/Component/Product/ProductManagerInterface.php +++ b/src/Component/Product/ProductManagerInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/ProductProviderInterface.php b/src/Component/Product/ProductProviderInterface.php index 65272fa34..5ee597454 100644 --- a/src/Component/Product/ProductProviderInterface.php +++ b/src/Component/Product/ProductProviderInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Product/SeoProductIterator.php b/src/Component/Product/SeoProductIterator.php index e76090965..9676bcaec 100644 --- a/src/Component/Product/SeoProductIterator.php +++ b/src/Component/Product/SeoProductIterator.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Status/StatusClassRendererInterface.php b/src/Component/Status/StatusClassRendererInterface.php index ab004231f..0499fb4f5 100644 --- a/src/Component/Status/StatusClassRendererInterface.php +++ b/src/Component/Status/StatusClassRendererInterface.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Subscriber/ORMInheritanceSubscriber.php b/src/Component/Subscriber/ORMInheritanceSubscriber.php index d3b35c62b..f76b37f63 100644 --- a/src/Component/Subscriber/ORMInheritanceSubscriber.php +++ b/src/Component/Subscriber/ORMInheritanceSubscriber.php @@ -1,7 +1,7 @@ * @@ -29,7 +29,7 @@ class ORMInheritanceSubscriber implements EventSubscriber */ public function __construct($map, $productClass) { - $this->map = $map; + $this->map = $map; $this->productClass = $productClass; } diff --git a/src/Component/Transformer/BaseTransformer.php b/src/Component/Transformer/BaseTransformer.php index 9ffff8538..2725a4c65 100644 --- a/src/Component/Transformer/BaseTransformer.php +++ b/src/Component/Transformer/BaseTransformer.php @@ -1,7 +1,7 @@ * diff --git a/src/Component/Transformer/BasketTransformer.php b/src/Component/Transformer/BasketTransformer.php index 28bafefc9..bb07dc154 100644 --- a/src/Component/Transformer/BasketTransformer.php +++ b/src/Component/Transformer/BasketTransformer.php @@ -1,7 +1,7 @@ * @@ -57,9 +57,9 @@ class BasketTransformer extends BaseTransformer */ public function __construct(OrderManagerInterface $orderManager, ProductPool $productPool, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null) { - $this->productPool = $productPool; - $this->orderManager = $orderManager; - $this->logger = $logger; + $this->productPool = $productPool; + $this->orderManager = $orderManager; + $this->logger = $logger; $this->eventDispatcher = $eventDispatcher; } diff --git a/src/Component/Transformer/InvoiceTransformer.php b/src/Component/Transformer/InvoiceTransformer.php index d8d289299..b60358229 100644 --- a/src/Component/Transformer/InvoiceTransformer.php +++ b/src/Component/Transformer/InvoiceTransformer.php @@ -1,7 +1,7 @@ * @@ -52,8 +52,8 @@ class InvoiceTransformer extends BaseTransformer public function __construct(InvoiceElementManagerInterface $invoiceElementManager, DeliveryPool $deliveryPool, EventDispatcherInterface $eventDispatcher) { $this->invoiceElementManager = $invoiceElementManager; - $this->deliveryPool = $deliveryPool; - $this->eventDispatcher = $eventDispatcher; + $this->deliveryPool = $deliveryPool; + $this->eventDispatcher = $eventDispatcher; } /** diff --git a/src/Component/Transformer/OrderTransformer.php b/src/Component/Transformer/OrderTransformer.php index 0def26633..d3dc677bd 100644 --- a/src/Component/Transformer/OrderTransformer.php +++ b/src/Component/Transformer/OrderTransformer.php @@ -1,7 +1,7 @@ * @@ -43,7 +43,7 @@ class OrderTransformer extends BaseTransformer */ public function __construct(ProductPool $productPool, EventDispatcherInterface $eventDispatcher) { - $this->productPool = $productPool; + $this->productPool = $productPool; $this->eventDispatcher = $eventDispatcher; } @@ -69,10 +69,10 @@ public function transformIntoBasket(OrderInterface $order, BasketInterface $bask /* * @var $orderElement OrderElementInterface */ - $provider = $this->productPool->getProvider($orderElement->getProductType()); - $manager = $this->productPool->getManager($orderElement->getProductType()); + $provider = $this->productPool->getProvider($orderElement->getProductType()); + $manager = $this->productPool->getManager($orderElement->getProductType()); - $product = $manager->findOneBy(array('id' => $orderElement->getProductId())); + $product = $manager->findOneBy(array('id' => $orderElement->getProductId())); if (!$product) { continue; diff --git a/src/Component/Transformer/Pool.php b/src/Component/Transformer/Pool.php index 03cf22997..966e013ee 100644 --- a/src/Component/Transformer/Pool.php +++ b/src/Component/Transformer/Pool.php @@ -1,7 +1,7 @@ * diff --git a/src/CustomerBundle/Admin/AddressAdmin.php b/src/CustomerBundle/Admin/AddressAdmin.php index 3977d15e1..83e804e3d 100644 --- a/src/CustomerBundle/Admin/AddressAdmin.php +++ b/src/CustomerBundle/Admin/AddressAdmin.php @@ -1,7 +1,7 @@ * diff --git a/src/CustomerBundle/Admin/CustomerAdmin.php b/src/CustomerBundle/Admin/CustomerAdmin.php index 7045c68eb..5748fc861 100644 --- a/src/CustomerBundle/Admin/CustomerAdmin.php +++ b/src/CustomerBundle/Admin/CustomerAdmin.php @@ -1,7 +1,7 @@ * @@ -44,8 +44,8 @@ public function configureFormFields(FormMapper $formMapper) ->add('firstname') ->add('lastname') ->add('locale', 'locale') - ->add('birthDate', 'sonata_type_date_picker', array( - 'years' => range(1900, $now->format('Y')), + ->add('birthDate', 'sonata_type_date_picker', array( + 'years' => range(1900, $now->format('Y')), 'dp_min_date' => '1-1-1900', 'dp_max_date' => $now->format('c'), )) diff --git a/src/CustomerBundle/Block/Breadcrumb/CustomerAddressBreadcrumbBlockService.php b/src/CustomerBundle/Block/Breadcrumb/CustomerAddressBreadcrumbBlockService.php index 440fbca2f..b6465ea26 100644 --- a/src/CustomerBundle/Block/Breadcrumb/CustomerAddressBreadcrumbBlockService.php +++ b/src/CustomerBundle/Block/Breadcrumb/CustomerAddressBreadcrumbBlockService.php @@ -1,7 +1,7 @@ * @@ -37,7 +37,7 @@ protected function getMenu(BlockContextInterface $blockContext) $menu = $this->getRootMenu($blockContext); $menu->addChild('sonata_customer_addresses_breadcrumb', array( - 'route' => 'sonata_customer_addresses', + 'route' => 'sonata_customer_addresses', 'extras' => array('translation_domain' => 'SonataCustomerBundle'), )); diff --git a/src/CustomerBundle/Block/RecentCustomersBlockService.php b/src/CustomerBundle/Block/RecentCustomersBlockService.php index 7cd38ec16..c0f150a3e 100644 --- a/src/CustomerBundle/Block/RecentCustomersBlockService.php +++ b/src/CustomerBundle/Block/RecentCustomersBlockService.php @@ -1,7 +1,7 @@ * @@ -55,10 +55,10 @@ public function execute(BlockContextInterface $blockContext, Response $response ); return $this->renderResponse($blockContext->getTemplate(), array( - 'context' => $blockContext, - 'settings' => $blockContext->getSettings(), - 'block' => $blockContext->getBlock(), - 'customers' => $this->manager->findBy($criteria, array('createdAt' => 'DESC'), $blockContext->getSetting('number')), + 'context' => $blockContext, + 'settings' => $blockContext->getSettings(), + 'block' => $blockContext->getBlock(), + 'customers' => $this->manager->findBy($criteria, array('createdAt' => 'DESC'), $blockContext->getSetting('number')), 'admin_pool' => $this->adminPool, ), $response); } @@ -83,7 +83,7 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) array('mode', 'choice', array( 'choices' => array( 'public' => 'public', - 'admin' => 'admin', + 'admin' => 'admin', ), )), ), @@ -104,11 +104,11 @@ public function getName() public function setDefaultSettings(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'number' => 5, - 'mode' => 'public', - 'title' => 'Recent Customers', + 'number' => 5, + 'mode' => 'public', + 'title' => 'Recent Customers', // 'tags' => 'Recent Customers', - 'template' => 'SonataCustomerBundle:Block:recent_customers.html.twig', + 'template' => 'SonataCustomerBundle:Block:recent_customers.html.twig', )); } } diff --git a/src/CustomerBundle/Controller/Api/AddressController.php b/src/CustomerBundle/Controller/Api/AddressController.php index 19f122b72..207cd5cc0 100644 --- a/src/CustomerBundle/Controller/Api/AddressController.php +++ b/src/CustomerBundle/Controller/Api/AddressController.php @@ -1,7 +1,7 @@ * @@ -47,8 +47,8 @@ class AddressController */ public function __construct(AddressManagerInterface $addressManager, FormFactoryInterface $formFactory) { - $this->addressManager = $addressManager; - $this->formFactory = $formFactory; + $this->addressManager = $addressManager; + $this->formFactory = $formFactory; } /** @@ -76,9 +76,9 @@ public function getAddressesAction(ParamFetcherInterface $paramFetcher) 'customer' => '', ); - $page = $paramFetcher->get('page'); - $limit = $paramFetcher->get('count'); - $sort = $paramFetcher->get('orderBy'); + $page = $paramFetcher->get('page'); + $limit = $paramFetcher->get('count'); + $sort = $paramFetcher->get('orderBy'); $criteria = array_intersect_key($paramFetcher->all(), $supportedCriteria); foreach ($criteria as $key => $value) { diff --git a/src/CustomerBundle/Controller/Api/CustomerController.php b/src/CustomerBundle/Controller/Api/CustomerController.php index fcab9e3bd..1d251ae22 100644 --- a/src/CustomerBundle/Controller/Api/CustomerController.php +++ b/src/CustomerBundle/Controller/Api/CustomerController.php @@ -1,7 +1,7 @@ * @@ -65,9 +65,9 @@ class CustomerController public function __construct(CustomerManagerInterface $customerManager, OrderManagerInterface $orderManager, AddressManagerInterface $addressManager, FormFactoryInterface $formFactory) { $this->customerManager = $customerManager; - $this->orderManager = $orderManager; - $this->addressManager = $addressManager; - $this->formFactory = $formFactory; + $this->orderManager = $orderManager; + $this->addressManager = $addressManager; + $this->formFactory = $formFactory; } /** @@ -94,9 +94,9 @@ public function getCustomersAction(ParamFetcherInterface $paramFetcher) 'is_fake' => '', ); - $page = $paramFetcher->get('page'); - $limit = $paramFetcher->get('count'); - $sort = $paramFetcher->get('orderBy'); + $page = $paramFetcher->get('page'); + $limit = $paramFetcher->get('count'); + $sort = $paramFetcher->get('orderBy'); $criteria = array_intersect_key($paramFetcher->all(), $supportedCriteria); foreach ($criteria as $key => $value) { @@ -190,40 +190,6 @@ public function putCustomerAction($id, Request $request) return $this->handleWriteCustomer($request, $id); } - /** - * Write a customer, this method is used by both POST and PUT action methods. - * - * @param Request $request Symfony request - * @param int|null $id A customer identifier - * - * @return \FOS\RestBundle\View\View|FormInterface - */ - protected function handleWriteCustomer($request, $id = null) - { - $customer = $id ? $this->getCustomer($id) : null; - - $form = $this->formFactory->createNamed(null, 'sonata_customer_api_form_customer', $customer, array( - 'csrf_protection' => false, - )); - - $form->bind($request); - - if ($form->isValid()) { - $customer = $form->getData(); - $this->customerManager->save($customer); - - $view = \FOS\RestBundle\View\View::create($customer); - $serializationContext = SerializationContext::create(); - $serializationContext->setGroups(array('sonata_api_read')); - $serializationContext->enableMaxDepthChecks(); - $view->setSerializationContext($serializationContext); - - return $view; - } - - return $form; - } - /** * Deletes a customer. * @@ -359,6 +325,40 @@ public function postCustomerAddressAction($id, Request $request) return $form; } + /** + * Write a customer, this method is used by both POST and PUT action methods. + * + * @param Request $request Symfony request + * @param int|null $id A customer identifier + * + * @return \FOS\RestBundle\View\View|FormInterface + */ + protected function handleWriteCustomer($request, $id = null) + { + $customer = $id ? $this->getCustomer($id) : null; + + $form = $this->formFactory->createNamed(null, 'sonata_customer_api_form_customer', $customer, array( + 'csrf_protection' => false, + )); + + $form->bind($request); + + if ($form->isValid()) { + $customer = $form->getData(); + $this->customerManager->save($customer); + + $view = \FOS\RestBundle\View\View::create($customer); + $serializationContext = SerializationContext::create(); + $serializationContext->setGroups(array('sonata_api_read')); + $serializationContext->enableMaxDepthChecks(); + $view->setSerializationContext($serializationContext); + + return $view; + } + + return $form; + } + /** * Retrieves customer with id $id or throws an exception if it doesn't exist. * diff --git a/src/CustomerBundle/Controller/CustomerController.php b/src/CustomerBundle/Controller/CustomerController.php index f2955f311..ccc9e0218 100644 --- a/src/CustomerBundle/Controller/CustomerController.php +++ b/src/CustomerBundle/Controller/CustomerController.php @@ -1,7 +1,7 @@ * @@ -42,8 +42,8 @@ public function addressesAction() // This allows to specify the display order $addresses = array( $typeCodes[AddressInterface::TYPE_DELIVERY] => array(), - $typeCodes[AddressInterface::TYPE_BILLING] => array(), - $typeCodes[AddressInterface::TYPE_CONTACT] => array(), + $typeCodes[AddressInterface::TYPE_BILLING] => array(), + $typeCodes[AddressInterface::TYPE_CONTACT] => array(), ); if (null === $customer) { @@ -63,8 +63,8 @@ public function addressesAction() $this->get('session')->set('sonata_address_redirect', $this->generateUrl('sonata_customer_addresses')); return $this->render('SonataCustomerBundle:Addresses:list.html.twig', array( - 'addresses' => $addresses, - 'customer' => $customer, + 'addresses' => $addresses, + 'customer' => $customer, 'breadcrumb_context' => 'customer_address', )); } @@ -176,7 +176,7 @@ protected function updateAddress($id = null) } return $this->render($template, array( - 'form' => $form->createView(), + 'form' => $form->createView(), 'breadcrumb_context' => 'customer_address', )); } diff --git a/src/CustomerBundle/DependencyInjection/Configuration.php b/src/CustomerBundle/DependencyInjection/Configuration.php index e413734f8..d1446c47a 100644 --- a/src/CustomerBundle/DependencyInjection/Configuration.php +++ b/src/CustomerBundle/DependencyInjection/Configuration.php @@ -1,7 +1,7 @@ * diff --git a/src/CustomerBundle/DependencyInjection/SonataCustomerExtension.php b/src/CustomerBundle/DependencyInjection/SonataCustomerExtension.php index 8fb8dea0a..b4b42ab58 100644 --- a/src/CustomerBundle/DependencyInjection/SonataCustomerExtension.php +++ b/src/CustomerBundle/DependencyInjection/SonataCustomerExtension.php @@ -1,7 +1,7 @@ * @@ -87,56 +87,56 @@ public function registerDoctrineMapping(array $config) $collector = DoctrineCollector::getInstance(); $collector->addAssociation($config['class']['customer'], 'mapOneToMany', array( - 'fieldName' => 'addresses', + 'fieldName' => 'addresses', 'targetEntity' => $config['class']['address'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => 'customer', + 'mappedBy' => 'customer', 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['customer'], 'mapOneToMany', array( - 'fieldName' => 'orders', - 'targetEntity' => $config['class']['order'], - 'cascade' => array( + 'fieldName' => 'orders', + 'targetEntity' => $config['class']['order'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'customer', + 'mappedBy' => 'customer', 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['customer'], 'mapManyToOne', array( - 'fieldName' => 'user', + 'fieldName' => 'user', 'targetEntity' => $config['class']['user'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'inversedBy' => 'customers', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'customers', + 'joinColumns' => array( array( - 'name' => 'user_id', + 'name' => 'user_id', 'referencedColumnName' => $config['field']['customer']['user'], - 'onDelete' => 'SET NULL', + 'onDelete' => 'SET NULL', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['address'], 'mapManyToOne', array( - 'fieldName' => 'customer', + 'fieldName' => 'customer', 'targetEntity' => $config['class']['customer'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'inversedBy' => 'addresses', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'addresses', + 'joinColumns' => array( array( - 'name' => 'customer_id', + 'name' => 'customer_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', + 'onDelete' => 'CASCADE', ), ), 'orphanRemoval' => false, diff --git a/src/CustomerBundle/Entity/AddressManager.php b/src/CustomerBundle/Entity/AddressManager.php index 219952979..c6a269232 100644 --- a/src/CustomerBundle/Entity/AddressManager.php +++ b/src/CustomerBundle/Entity/AddressManager.php @@ -1,7 +1,7 @@ * diff --git a/src/CustomerBundle/Entity/BaseAddress.php b/src/CustomerBundle/Entity/BaseAddress.php index bfba4431d..e37251c92 100644 --- a/src/CustomerBundle/Entity/BaseAddress.php +++ b/src/CustomerBundle/Entity/BaseAddress.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\CustomerBundle\Entity; use Sonata\Component\Customer\AddressInterface; @@ -85,6 +94,16 @@ abstract class BaseAddress implements AddressInterface */ protected $customer; + public function __construct() + { + $this->setCurrent(false); + } + + public function __toString() + { + return $this->getName(); + } + /** * Formats an address in an array form. * @@ -97,13 +116,13 @@ public static function formatAddress(array $address, $sep = ', ') { $address = array_merge( array( - 'firstname' => '', - 'lastname' => '', - 'address1' => '', - 'address2' => '', - 'address3' => '', - 'postcode' => '', - 'city' => '', + 'firstname' => '', + 'lastname' => '', + 'address1' => '', + 'address2' => '', + 'address3' => '', + 'postcode' => '', + 'city' => '', 'country_code' => '', ), $address @@ -137,11 +156,6 @@ public static function formatAddress(array $address, $sep = ', ') return $fullAddress; } - public function __construct() - { - $this->setCurrent(false); - } - public function prePersist() { $this->setCreatedAt(new \DateTime()); @@ -156,9 +170,9 @@ public function preUpdate() public static function getTypesList() { return array( - self::TYPE_BILLING => 'type_billing', + self::TYPE_BILLING => 'type_billing', self::TYPE_DELIVERY => 'type_delivery', - self::TYPE_CONTACT => 'type_contact', + self::TYPE_CONTACT => 'type_contact', ); } @@ -198,6 +212,7 @@ public function getTypeCode() return isset($types[$this->getType()]) ? $types[$this->getType()] : null; } + /** * Get type. * @@ -454,15 +469,15 @@ public function getFullAddress($sep = ', ') public function getAddressArrayForRender() { return array( - 'id' => $this->getId(), - 'name' => $this->getName(), - 'firstname' => $this->getFirstName(), - 'lastname' => $this->getLastname(), - 'address1' => $this->getAddress1(), - 'address2' => $this->getAddress2(), - 'address3' => $this->getAddress3(), - 'postcode' => $this->getPostcode(), - 'city' => $this->getCity(), + 'id' => $this->getId(), + 'name' => $this->getName(), + 'firstname' => $this->getFirstName(), + 'lastname' => $this->getLastname(), + 'address1' => $this->getAddress1(), + 'address2' => $this->getAddress2(), + 'address3' => $this->getAddress3(), + 'postcode' => $this->getPostcode(), + 'city' => $this->getCity(), 'country_code' => $this->getCountryCode(), ); } @@ -484,9 +499,4 @@ public function getCustomer() { return $this->customer; } - - public function __toString() - { - return $this->getName(); - } } diff --git a/src/CustomerBundle/Entity/BaseCustomer.php b/src/CustomerBundle/Entity/BaseCustomer.php index 9ed6c046f..56e1bcab3 100644 --- a/src/CustomerBundle/Entity/BaseCustomer.php +++ b/src/CustomerBundle/Entity/BaseCustomer.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\CustomerBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; @@ -95,10 +104,10 @@ abstract class BaseCustomer implements CustomerInterface public function __construct() { - $this->title = self::TITLE_MR; - $this->addresses = new ArrayCollection(); - $this->orders = new ArrayCollection(); - $this->isFake = false; + $this->title = self::TITLE_MR; + $this->addresses = new ArrayCollection(); + $this->orders = new ArrayCollection(); + $this->isFake = false; } /** @@ -150,8 +159,8 @@ public static function getTitlesList() { return array( self::TITLE_MLLE => 'customer_title_mlle', - self::TITLE_MME => 'customer_title_mme', - self::TITLE_MR => 'customer_title_mr', + self::TITLE_MME => 'customer_title_mme', + self::TITLE_MR => 'customer_title_mr', ); } diff --git a/src/CustomerBundle/Entity/CustomerManager.php b/src/CustomerBundle/Entity/CustomerManager.php index 6ba512fc9..f011e9f8a 100644 --- a/src/CustomerBundle/Entity/CustomerManager.php +++ b/src/CustomerBundle/Entity/CustomerManager.php @@ -1,7 +1,7 @@ * diff --git a/src/CustomerBundle/Form/Type/AddressType.php b/src/CustomerBundle/Form/Type/AddressType.php index f74066106..d085e90bc 100644 --- a/src/CustomerBundle/Form/Type/AddressType.php +++ b/src/CustomerBundle/Form/Type/AddressType.php @@ -1,7 +1,7 @@ * @@ -49,9 +49,9 @@ class AddressType extends AbstractType */ public function __construct($class, $getter, $name, BasketInterface $basket) { - $this->class = $class; + $this->class = $class; $this->getter = $getter; - $this->name = $name; + $this->name = $name; $this->basket = $basket; } @@ -76,30 +76,6 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add('countryCode', 'country', $countryOptions); } - /** - * Returns basket elements delivery countries. - * - * @return array - */ - protected function getBasketDeliveryCountries() - { - $countries = array(); - - foreach ($this->basket->getBasketElements() as $basketElement) { - $product = $basketElement->getProduct(); - - foreach ($product->getDeliveries() as $delivery) { - $code = $delivery->getCountryCode(); - - if (!isset($countries[$code])) { - $countries[$code] = Intl::getRegionBundle()->getCountryName($code); - } - } - } - - return $countries; - } - /** * {@inheritdoc} */ @@ -131,7 +107,31 @@ public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'context' => 'default', - 'types' => call_user_func(array($this->class, $this->getter)), + 'types' => call_user_func(array($this->class, $this->getter)), )); } + + /** + * Returns basket elements delivery countries. + * + * @return array + */ + protected function getBasketDeliveryCountries() + { + $countries = array(); + + foreach ($this->basket->getBasketElements() as $basketElement) { + $product = $basketElement->getProduct(); + + foreach ($product->getDeliveries() as $delivery) { + $code = $delivery->getCountryCode(); + + if (!isset($countries[$code])) { + $countries[$code] = Intl::getRegionBundle()->getCountryName($code); + } + } + } + + return $countries; + } } diff --git a/src/CustomerBundle/Form/Type/AddressTypeType.php b/src/CustomerBundle/Form/Type/AddressTypeType.php index 6e4867f9f..d8954e6ba 100644 --- a/src/CustomerBundle/Form/Type/AddressTypeType.php +++ b/src/CustomerBundle/Form/Type/AddressTypeType.php @@ -1,13 +1,12 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. - * */ namespace Sonata\CustomerBundle\Form\Type; diff --git a/src/CustomerBundle/Form/Type/ApiAddressType.php b/src/CustomerBundle/Form/Type/ApiAddressType.php index 852590c4a..264924882 100644 --- a/src/CustomerBundle/Form/Type/ApiAddressType.php +++ b/src/CustomerBundle/Form/Type/ApiAddressType.php @@ -1,7 +1,7 @@ * diff --git a/src/CustomerBundle/Form/Type/ApiCustomerType.php b/src/CustomerBundle/Form/Type/ApiCustomerType.php index e9348ead5..0f4ce2754 100644 --- a/src/CustomerBundle/Form/Type/ApiCustomerType.php +++ b/src/CustomerBundle/Form/Type/ApiCustomerType.php @@ -1,7 +1,7 @@ * diff --git a/src/CustomerBundle/Serializer/CustomerSerializerHandler.php b/src/CustomerBundle/Serializer/CustomerSerializerHandler.php index ba60b9a0b..334eab475 100644 --- a/src/CustomerBundle/Serializer/CustomerSerializerHandler.php +++ b/src/CustomerBundle/Serializer/CustomerSerializerHandler.php @@ -1,7 +1,7 @@ * diff --git a/src/CustomerBundle/SonataCustomerBundle.php b/src/CustomerBundle/SonataCustomerBundle.php index d42131154..cc03996e9 100644 --- a/src/CustomerBundle/SonataCustomerBundle.php +++ b/src/CustomerBundle/SonataCustomerBundle.php @@ -1,7 +1,7 @@ * @@ -39,10 +39,10 @@ public function boot() public function registerFormMapping() { FormHelper::registerFormTypeMapping(array( - 'sonata_customer_address' => 'Sonata\CustomerBundle\Form\Type\AddressType', - 'sonata_customer_address_types' => 'Sonata\CustomerBundle\Form\Type\AddressTypeType', + 'sonata_customer_address' => 'Sonata\CustomerBundle\Form\Type\AddressType', + 'sonata_customer_address_types' => 'Sonata\CustomerBundle\Form\Type\AddressTypeType', 'sonata_customer_api_form_customer' => 'Sonata\CoreBundle\Form\Type\DoctrineORMSerializationType', - 'sonata_customer_api_form_address' => 'Sonata\CoreBundle\Form\Type\DoctrineORMSerializationType', + 'sonata_customer_api_form_address' => 'Sonata\CoreBundle\Form\Type\DoctrineORMSerializationType', )); } } diff --git a/src/CustomerBundle/Twig/Extension/AddressExtension.php b/src/CustomerBundle/Twig/Extension/AddressExtension.php index 5113b6a8e..a64129c68 100644 --- a/src/CustomerBundle/Twig/Extension/AddressExtension.php +++ b/src/CustomerBundle/Twig/Extension/AddressExtension.php @@ -1,7 +1,7 @@ * @@ -51,7 +51,7 @@ public function getFunctions() array($this, 'renderAddress'), array( 'needs_environment' => true, - 'is_safe' => array('html'), + 'is_safe' => array('html'), ) ), new \Twig_SimpleFunction('sonata_address_deliverable', array($this, 'isAddressDeliverable')), @@ -89,9 +89,9 @@ public function renderAddress(\Twig_Environment $environment, $address, $showNam if ($address instanceof AddressInterface) { $addressArray = array( - 'id' => $showEdit ? $address->getId() : '', - 'name' => $showName ? $address->getName() : '', - 'address' => $address->getFullAddressHtml(), + 'id' => $showEdit ? $address->getId() : '', + 'name' => $showName ? $address->getName() : '', + 'address' => $address->getFullAddressHtml(), ); } else { if ($showEdit && !array_key_exists('id', $address)) { @@ -104,17 +104,17 @@ public function renderAddress(\Twig_Environment $environment, $address, $showNam } $addressArray = array( - 'id' => $showEdit ? $address['id'] : '', - 'name' => $address['name'], + 'id' => $showEdit ? $address['id'] : '', + 'name' => $address['name'], 'address' => BaseAddress::formatAddress($address, '
'), ); } return $environment->render('SonataCustomerBundle:Addresses:_address.html.twig', array( - 'address' => $addressArray, + 'address' => $addressArray, 'showName' => $showName, 'showEdit' => $showEdit, - 'context' => $context, + 'context' => $context, ) ); } diff --git a/src/DeliveryBundle/DependencyInjection/Configuration.php b/src/DeliveryBundle/DependencyInjection/Configuration.php index 5d87174ba..d9ecb79fe 100644 --- a/src/DeliveryBundle/DependencyInjection/Configuration.php +++ b/src/DeliveryBundle/DependencyInjection/Configuration.php @@ -1,7 +1,7 @@ * diff --git a/src/DeliveryBundle/DependencyInjection/SonataDeliveryExtension.php b/src/DeliveryBundle/DependencyInjection/SonataDeliveryExtension.php index 101773ebb..52b27eee9 100644 --- a/src/DeliveryBundle/DependencyInjection/SonataDeliveryExtension.php +++ b/src/DeliveryBundle/DependencyInjection/SonataDeliveryExtension.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\DeliveryBundle\DependencyInjection; use Symfony\Component\Config\Definition\Processor; @@ -56,7 +65,7 @@ public function configureDelivery(ContainerBuilder $container, array $config) $pool = $container->getDefinition('sonata.delivery.pool'); $internal = array( - 'free_address_required' => 'sonata.delivery.method.free_address_required', + 'free_address_required' => 'sonata.delivery.method.free_address_required', 'free_address_not_required' => 'sonata.delivery.method.free_address_not_required', ); diff --git a/src/DeliveryBundle/SonataDeliveryBundle.php b/src/DeliveryBundle/SonataDeliveryBundle.php index c5cee83cd..c9baa69cb 100644 --- a/src/DeliveryBundle/SonataDeliveryBundle.php +++ b/src/DeliveryBundle/SonataDeliveryBundle.php @@ -1,7 +1,7 @@ * diff --git a/src/InvoiceBundle/Admin/InvoiceAdmin.php b/src/InvoiceBundle/Admin/InvoiceAdmin.php index 1d4500ecb..f0a515829 100644 --- a/src/InvoiceBundle/Admin/InvoiceAdmin.php +++ b/src/InvoiceBundle/Admin/InvoiceAdmin.php @@ -1,7 +1,7 @@ * diff --git a/src/InvoiceBundle/Controller/Api/InvoiceController.php b/src/InvoiceBundle/Controller/Api/InvoiceController.php index ef677bcc4..bfa9c9b0c 100644 --- a/src/InvoiceBundle/Controller/Api/InvoiceController.php +++ b/src/InvoiceBundle/Controller/Api/InvoiceController.php @@ -1,7 +1,7 @@ * @@ -68,9 +68,9 @@ public function getInvoicesAction(ParamFetcherInterface $paramFetcher) 'status' => '', ); - $page = $paramFetcher->get('page'); - $limit = $paramFetcher->get('count'); - $sort = $paramFetcher->get('orderBy'); + $page = $paramFetcher->get('page'); + $limit = $paramFetcher->get('count'); + $sort = $paramFetcher->get('orderBy'); $criteria = array_intersect_key($paramFetcher->all(), $supportedCriteria); foreach ($criteria as $key => $value) { diff --git a/src/InvoiceBundle/Controller/InvoiceController.php b/src/InvoiceBundle/Controller/InvoiceController.php index a38571404..9c2f1a5ba 100644 --- a/src/InvoiceBundle/Controller/InvoiceController.php +++ b/src/InvoiceBundle/Controller/InvoiceController.php @@ -1,7 +1,7 @@ * @@ -58,7 +58,7 @@ public function viewAction($reference) return $this->render('SonataInvoiceBundle:Invoice:view.html.twig', array( 'invoice' => $invoice, - 'order' => $order, + 'order' => $order, )); } diff --git a/src/InvoiceBundle/DependencyInjection/Configuration.php b/src/InvoiceBundle/DependencyInjection/Configuration.php index 1d1a25c5e..72926664f 100644 --- a/src/InvoiceBundle/DependencyInjection/Configuration.php +++ b/src/InvoiceBundle/DependencyInjection/Configuration.php @@ -1,7 +1,7 @@ * diff --git a/src/InvoiceBundle/DependencyInjection/SonataInvoiceExtension.php b/src/InvoiceBundle/DependencyInjection/SonataInvoiceExtension.php index aba5df2da..7eed3de02 100644 --- a/src/InvoiceBundle/DependencyInjection/SonataInvoiceExtension.php +++ b/src/InvoiceBundle/DependencyInjection/SonataInvoiceExtension.php @@ -1,7 +1,7 @@ * @@ -82,65 +82,65 @@ public function registerDoctrineMapping(array $config) * INVOICE */ $collector->addAssociation($config['class']['invoice'], 'mapManyToOne', array( - 'fieldName' => 'customer', - 'targetEntity' => $config['class']['customer'], - 'cascade' => array( + 'fieldName' => 'customer', + 'targetEntity' => $config['class']['customer'], + 'cascade' => array( 'persist', 'refresh', 'merge', 'detach', ), - 'mappedBy' => null, - 'joinColumns' => array( + 'mappedBy' => null, + 'joinColumns' => array( array( - 'name' => 'customer_id', + 'name' => 'customer_id', 'referencedColumnName' => 'id', - 'onDelete' => 'SET NULL', + 'onDelete' => 'SET NULL', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['invoice_element'], 'mapManyToOne', array( - 'fieldName' => 'invoice', - 'targetEntity' => $config['class']['invoice'], - 'cascade' => array( + 'fieldName' => 'invoice', + 'targetEntity' => $config['class']['invoice'], + 'cascade' => array( 'persist', 'refresh', 'merge', 'detach', ), - 'mappedBy' => null, - 'inversedBy' => 'invoiceElements', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'invoiceElements', + 'joinColumns' => array( array( - 'name' => 'invoice_id', + 'name' => 'invoice_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', + 'onDelete' => 'CASCADE', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['invoice'], 'mapOneToMany', array( - 'fieldName' => 'invoiceElements', - 'targetEntity' => $config['class']['invoice_element'], - 'cascade' => array( + 'fieldName' => 'invoiceElements', + 'targetEntity' => $config['class']['invoice_element'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'invoice', + 'mappedBy' => 'invoice', 'orphanRemoval' => true, )); $collector->addAssociation($config['class']['invoice_element'], 'mapManyToOne', array( - 'fieldName' => 'orderElement', + 'fieldName' => 'orderElement', 'targetEntity' => $config['class']['order_element'], - 'cascade' => array(), - 'joinColumns' => array( + 'cascade' => array(), + 'joinColumns' => array( array( - 'name' => 'order_element_id', + 'name' => 'order_element_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', + 'onDelete' => 'CASCADE', ), ), )); diff --git a/src/InvoiceBundle/Entity/BaseInvoice.php b/src/InvoiceBundle/Entity/BaseInvoice.php index 2729d8b53..da12aeac3 100644 --- a/src/InvoiceBundle/Entity/BaseInvoice.php +++ b/src/InvoiceBundle/Entity/BaseInvoice.php @@ -1,7 +1,7 @@ * @@ -141,6 +141,14 @@ public function __construct() $this->createdAt = new \DateTime(); } + /** + * @return string + */ + public function __toString() + { + return $this->getReference() ?: 'n/a'; + } + /** * Returns formatted billing address. * @@ -159,13 +167,13 @@ public function getFullBilling($sep = ', ') public function getBillingAsArray() { return array( - 'firstname' => $this->getName(), - 'lastname' => '', - 'address1' => $this->getAddress1(), - 'address2' => $this->getAddress2(), - 'address3' => $this->getAddress3(), - 'postcode' => $this->getPostcode(), - 'city' => $this->getCity(), + 'firstname' => $this->getName(), + 'lastname' => '', + 'address1' => $this->getAddress1(), + 'address2' => $this->getAddress2(), + 'address3' => $this->getAddress3(), + 'postcode' => $this->getPostcode(), + 'city' => $this->getCity(), 'country_code' => $this->getCountry(), ); } @@ -343,7 +351,7 @@ public function getVatAmounts() $amounts[$rate]['amount'] = bcadd($amounts[$rate]['amount'], $invoiceElement->getVatAmount()); } else { $amounts[$rate] = array( - 'rate' => $rate, + 'rate' => $rate, 'amount' => $invoiceElement->getVatAmount(), ); } @@ -616,14 +624,6 @@ public function setInvoiceElements(array $elements) $this->invoiceElements = $elements; } - /** - * @return string - */ - public function __toString() - { - return $this->getReference() ?: 'n/a'; - } - /** * @return string */ @@ -660,8 +660,8 @@ public function setLocale($locale) public static function getStatusList() { return array( - self::STATUS_OPEN => 'status_open', - self::STATUS_PAID => 'status_paid', + self::STATUS_OPEN => 'status_open', + self::STATUS_PAID => 'status_paid', self::STATUS_CONFLICT => 'status_conflict', ); } diff --git a/src/InvoiceBundle/Entity/BaseInvoiceElement.php b/src/InvoiceBundle/Entity/BaseInvoiceElement.php index 74281eb4c..12a9dc974 100644 --- a/src/InvoiceBundle/Entity/BaseInvoiceElement.php +++ b/src/InvoiceBundle/Entity/BaseInvoiceElement.php @@ -1,7 +1,7 @@ * diff --git a/src/InvoiceBundle/Entity/InvoiceElementManager.php b/src/InvoiceBundle/Entity/InvoiceElementManager.php index 94ee0340d..8d59323f6 100644 --- a/src/InvoiceBundle/Entity/InvoiceElementManager.php +++ b/src/InvoiceBundle/Entity/InvoiceElementManager.php @@ -1,7 +1,7 @@ * diff --git a/src/InvoiceBundle/Entity/InvoiceManager.php b/src/InvoiceBundle/Entity/InvoiceManager.php index a45d0c8e1..315f482e4 100644 --- a/src/InvoiceBundle/Entity/InvoiceManager.php +++ b/src/InvoiceBundle/Entity/InvoiceManager.php @@ -1,7 +1,7 @@ * diff --git a/src/InvoiceBundle/Form/Type/InvoiceStatusType.php b/src/InvoiceBundle/Form/Type/InvoiceStatusType.php index 2f177a862..07bafbf8f 100644 --- a/src/InvoiceBundle/Form/Type/InvoiceStatusType.php +++ b/src/InvoiceBundle/Form/Type/InvoiceStatusType.php @@ -1,13 +1,12 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. - * */ namespace Sonata\InvoiceBundle\Form\Type; diff --git a/src/InvoiceBundle/Serializer/InvoiceSerializerHandler.php b/src/InvoiceBundle/Serializer/InvoiceSerializerHandler.php index 2ea42f81c..f197f064a 100644 --- a/src/InvoiceBundle/Serializer/InvoiceSerializerHandler.php +++ b/src/InvoiceBundle/Serializer/InvoiceSerializerHandler.php @@ -1,7 +1,7 @@ * diff --git a/src/InvoiceBundle/SonataInvoiceBundle.php b/src/InvoiceBundle/SonataInvoiceBundle.php index 2f640d0bd..3c3e3b3bc 100644 --- a/src/InvoiceBundle/SonataInvoiceBundle.php +++ b/src/InvoiceBundle/SonataInvoiceBundle.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/Admin/OrderAdmin.php b/src/OrderBundle/Admin/OrderAdmin.php index 304eb5d38..67b334e94 100644 --- a/src/OrderBundle/Admin/OrderAdmin.php +++ b/src/OrderBundle/Admin/OrderAdmin.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/Admin/OrderElementAdmin.php b/src/OrderBundle/Admin/OrderElementAdmin.php index 0bf179077..738385232 100644 --- a/src/OrderBundle/Admin/OrderElementAdmin.php +++ b/src/OrderBundle/Admin/OrderElementAdmin.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/Block/Breadcrumb/UserOrderBreadcrumbBlockService.php b/src/OrderBundle/Block/Breadcrumb/UserOrderBreadcrumbBlockService.php index a59427e08..65e4b6499 100644 --- a/src/OrderBundle/Block/Breadcrumb/UserOrderBreadcrumbBlockService.php +++ b/src/OrderBundle/Block/Breadcrumb/UserOrderBreadcrumbBlockService.php @@ -1,7 +1,7 @@ * @@ -37,7 +37,7 @@ protected function getMenu(BlockContextInterface $blockContext) $menu = $this->getRootMenu($blockContext); $menu->addChild('sonata_order_user_breadcrumb', array( - 'route' => 'sonata_order_index', + 'route' => 'sonata_order_index', 'extras' => array('translation_domain' => 'SonataOrderBundle'), )); diff --git a/src/OrderBundle/Block/RecentOrdersBlockService.php b/src/OrderBundle/Block/RecentOrdersBlockService.php index 31b525543..27553800a 100644 --- a/src/OrderBundle/Block/RecentOrdersBlockService.php +++ b/src/OrderBundle/Block/RecentOrdersBlockService.php @@ -1,7 +1,7 @@ * @@ -58,10 +58,10 @@ class RecentOrdersBlockService extends BaseBlockService */ public function __construct($name, EngineInterface $templating, OrderManagerInterface $orderManager, CustomerManagerInterface $customerManager, SecurityContextInterface $securityContext, Pool $adminPool = null) { - $this->orderManager = $orderManager; + $this->orderManager = $orderManager; $this->customerManager = $customerManager; $this->securityContext = $securityContext; - $this->adminPool = $adminPool; + $this->adminPool = $adminPool; parent::__construct($name, $templating); } @@ -80,10 +80,10 @@ public function execute(BlockContextInterface $blockContext, Response $response } return $this->renderPrivateResponse($blockContext->getTemplate(), array( - 'context' => $blockContext, - 'settings' => $blockContext->getSettings(), - 'block' => $blockContext->getBlock(), - 'orders' => $orders, + 'context' => $blockContext, + 'settings' => $blockContext->getSettings(), + 'block' => $blockContext->getBlock(), + 'orders' => $orders, 'admin_pool' => $this->adminPool, ), $response); } @@ -107,7 +107,7 @@ public function buildEditForm(FormMapper $formMapper, BlockInterface $block) array('mode', 'choice', array( 'choices' => array( 'public' => 'public', - 'admin' => 'admin', + 'admin' => 'admin', ), )), ), @@ -128,10 +128,10 @@ public function getName() public function setDefaultSettings(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'number' => 5, - 'mode' => 'public', - 'title' => 'Recent Orders', - 'template' => 'SonataOrderBundle:Block:recent_orders.html.twig', + 'number' => 5, + 'mode' => 'public', + 'title' => 'Recent Orders', + 'template' => 'SonataOrderBundle:Block:recent_orders.html.twig', )); } } diff --git a/src/OrderBundle/Controller/Api/OrderController.php b/src/OrderBundle/Controller/Api/OrderController.php index d62d4e114..5d2cadac7 100644 --- a/src/OrderBundle/Controller/Api/OrderController.php +++ b/src/OrderBundle/Controller/Api/OrderController.php @@ -1,7 +1,7 @@ * @@ -66,13 +66,13 @@ public function __construct(OrderManagerInterface $orderManager) public function getOrdersAction(ParamFetcherInterface $paramFetcher) { $supportedCriteria = array( - 'status' => '', + 'status' => '', 'customer' => '', ); - $page = $paramFetcher->get('page'); - $limit = $paramFetcher->get('count'); - $sort = $paramFetcher->get('orderBy'); + $page = $paramFetcher->get('page'); + $limit = $paramFetcher->get('count'); + $sort = $paramFetcher->get('orderBy'); $criteria = array_intersect_key($paramFetcher->all(), $supportedCriteria); foreach ($criteria as $key => $value) { diff --git a/src/OrderBundle/Controller/OrderCRUDController.php b/src/OrderBundle/Controller/OrderCRUDController.php index ffbfc2876..99e18d6d2 100644 --- a/src/OrderBundle/Controller/OrderCRUDController.php +++ b/src/OrderBundle/Controller/OrderCRUDController.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\OrderBundle\Controller; use Sonata\AdminBundle\Controller\CRUDController; diff --git a/src/OrderBundle/Controller/OrderController.php b/src/OrderBundle/Controller/OrderController.php index a1f78d045..7ddff1817 100644 --- a/src/OrderBundle/Controller/OrderController.php +++ b/src/OrderBundle/Controller/OrderController.php @@ -1,7 +1,7 @@ * @@ -38,7 +38,7 @@ public function indexAction() $this->get('sonata.seo.page')->setTitle($this->get('translator')->trans('order_index_title', array(), 'SonataOrderBundle')); return $this->render('SonataOrderBundle:Order:index.html.twig', array( - 'orders' => $orders, + 'orders' => $orders, 'breadcrumb_context' => 'user_order', )); } @@ -70,7 +70,7 @@ public function viewAction($reference) } return $this->render('SonataOrderBundle:Order:view.html.twig', array( - 'order' => $order, + 'order' => $order, 'breadcrumb_context' => 'user_order', )); } diff --git a/src/OrderBundle/DependencyInjection/Compiler/StatusRendererCompilerPass.php b/src/OrderBundle/DependencyInjection/Compiler/StatusRendererCompilerPass.php index 39fcbb2e2..d61ffa6be 100644 --- a/src/OrderBundle/DependencyInjection/Compiler/StatusRendererCompilerPass.php +++ b/src/OrderBundle/DependencyInjection/Compiler/StatusRendererCompilerPass.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/DependencyInjection/Configuration.php b/src/OrderBundle/DependencyInjection/Configuration.php index 366aacf96..626260f21 100644 --- a/src/OrderBundle/DependencyInjection/Configuration.php +++ b/src/OrderBundle/DependencyInjection/Configuration.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/DependencyInjection/SonataOrderExtension.php b/src/OrderBundle/DependencyInjection/SonataOrderExtension.php index c4d6e3e36..e19d854ce 100644 --- a/src/OrderBundle/DependencyInjection/SonataOrderExtension.php +++ b/src/OrderBundle/DependencyInjection/SonataOrderExtension.php @@ -1,7 +1,7 @@ * @@ -85,42 +85,42 @@ public function registerDoctrineMapping(array $config) $collector = DoctrineCollector::getInstance(); $collector->addAssociation($config['class']['order'], 'mapOneToMany', array( - 'fieldName' => 'orderElements', - 'targetEntity' => $config['class']['order_element'], - 'cascade' => array( + 'fieldName' => 'orderElements', + 'targetEntity' => $config['class']['order_element'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'order', + 'mappedBy' => 'order', 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['order'], 'mapManyToOne', array( - 'fieldName' => 'customer', - 'targetEntity' => $config['class']['customer'], - 'cascade' => array(), - 'mappedBy' => null, - 'inversedBy' => 'orders', - 'joinColumns' => array( + 'fieldName' => 'customer', + 'targetEntity' => $config['class']['customer'], + 'cascade' => array(), + 'mappedBy' => null, + 'inversedBy' => 'orders', + 'joinColumns' => array( array( - 'name' => 'customer_id', + 'name' => 'customer_id', 'referencedColumnName' => 'id', - 'onDelete' => 'SET NULL', + 'onDelete' => 'SET NULL', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['order_element'], 'mapManyToOne', array( - 'fieldName' => 'order', - 'targetEntity' => $config['class']['order'], - 'cascade' => array(), - 'mappedBy' => null, - 'inversedBy' => null, - 'joinColumns' => array( + 'fieldName' => 'order', + 'targetEntity' => $config['class']['order'], + 'cascade' => array(), + 'mappedBy' => null, + 'inversedBy' => null, + 'joinColumns' => array( array( - 'name' => 'order_id', + 'name' => 'order_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', + 'onDelete' => 'CASCADE', ), ), 'orphanRemoval' => false, diff --git a/src/OrderBundle/Entity/BaseOrder.php b/src/OrderBundle/Entity/BaseOrder.php index d6890dac4..b6d87515b 100644 --- a/src/OrderBundle/Entity/BaseOrder.php +++ b/src/OrderBundle/Entity/BaseOrder.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\OrderBundle\Entity; use Sonata\Component\Currency\CurrencyInterface; @@ -202,7 +211,15 @@ abstract class BaseOrder implements OrderInterface public function __construct() { - $this->orderElements = new \Doctrine\Common\Collections\ArrayCollection(); + $this->orderElements = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return $this->getReference() ?: 'n/a'; } public function prePersist() @@ -216,14 +233,6 @@ public function preUpdate() $this->setUpdatedAt(new \DateTime()); } - /** - * {@inheritdoc} - */ - public function __toString() - { - return $this->getReference() ?: 'n/a'; - } - /** * Returns formatted delivery address. * @@ -242,11 +251,11 @@ public function getFullDelivery($sep = ', ') public function getDeliveryAsArray() { return array( - 'firstname' => $this->getShippingName(), - 'lastname' => '', - 'address1' => $this->getShippingAddress1(), - 'postcode' => $this->getShippingPostcode(), - 'city' => $this->getShippingCity(), + 'firstname' => $this->getShippingName(), + 'lastname' => '', + 'address1' => $this->getShippingAddress1(), + 'postcode' => $this->getShippingPostcode(), + 'city' => $this->getShippingCity(), 'country_code' => $this->getShippingCountryCode(), ); } @@ -266,11 +275,11 @@ public function getFullBilling($sep = ', ') public function getBillingAsArray() { return array( - 'firstname' => $this->getBillingName(), - 'lastname' => '', - 'address1' => $this->getBillingAddress1(), - 'postcode' => $this->getBillingPostcode(), - 'city' => $this->getBillingCity(), + 'firstname' => $this->getBillingName(), + 'lastname' => '', + 'address1' => $this->getBillingAddress1(), + 'postcode' => $this->getBillingPostcode(), + 'city' => $this->getBillingCity(), 'country_code' => $this->getBillingCountryCode(), ); } @@ -1006,12 +1015,12 @@ public function getStatusName() public static function getStatusList() { return array( - self::STATUS_OPEN => 'status_open', - self::STATUS_PENDING => 'status_pending', + self::STATUS_OPEN => 'status_open', + self::STATUS_PENDING => 'status_pending', self::STATUS_VALIDATED => 'status_validated', self::STATUS_CANCELLED => 'status_cancelled', - self::STATUS_ERROR => 'status_error', - self::STATUS_STOPPED => 'status_stopped', + self::STATUS_ERROR => 'status_error', + self::STATUS_STOPPED => 'status_stopped', ); } @@ -1063,7 +1072,7 @@ public function getVatAmounts() $amounts[$rate]['amount'] = bcadd($amounts[$rate]['amount'], $orderElement->getVatAmount()); } else { $amounts[$rate] = array( - 'rate' => $rate, + 'rate' => $rate, 'amount' => $orderElement->getVatAmount(), ); } diff --git a/src/OrderBundle/Entity/BaseOrderElement.php b/src/OrderBundle/Entity/BaseOrderElement.php index 2edffc4a8..1683139f9 100644 --- a/src/OrderBundle/Entity/BaseOrderElement.php +++ b/src/OrderBundle/Entity/BaseOrderElement.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\OrderBundle\Entity; use Sonata\Component\Order\OrderElementInterface; @@ -102,6 +111,14 @@ public function __construct() $this->options = array(); } + /** + * @return string + */ + public function __toString() + { + return $this->getDesignation() ?: 'n/a'; + } + public function prePersist() { $this->setCreatedAt(new \DateTime()); @@ -525,14 +542,6 @@ public function getRawProduct() return $this->rawProduct; } - /** - * @return string - */ - public function __toString() - { - return $this->getDesignation() ?: 'n/a'; - } - /** * @return string */ diff --git a/src/OrderBundle/Entity/OrderElementManager.php b/src/OrderBundle/Entity/OrderElementManager.php index 3d5fa53a0..30b0d0674 100644 --- a/src/OrderBundle/Entity/OrderElementManager.php +++ b/src/OrderBundle/Entity/OrderElementManager.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/Entity/OrderManager.php b/src/OrderBundle/Entity/OrderManager.php index f8ac4674b..d6fc2d741 100644 --- a/src/OrderBundle/Entity/OrderManager.php +++ b/src/OrderBundle/Entity/OrderManager.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/Form/Type/OrderStatusType.php b/src/OrderBundle/Form/Type/OrderStatusType.php index b70693d3d..ea6de02fd 100644 --- a/src/OrderBundle/Form/Type/OrderStatusType.php +++ b/src/OrderBundle/Form/Type/OrderStatusType.php @@ -1,13 +1,12 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. - * */ namespace Sonata\OrderBundle\Form\Type; diff --git a/src/OrderBundle/Serializer/OrderElementSerializerHandler.php b/src/OrderBundle/Serializer/OrderElementSerializerHandler.php index 6e59a2f6c..b5c6bf9be 100644 --- a/src/OrderBundle/Serializer/OrderElementSerializerHandler.php +++ b/src/OrderBundle/Serializer/OrderElementSerializerHandler.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/Serializer/OrderSerializerHandler.php b/src/OrderBundle/Serializer/OrderSerializerHandler.php index a5c8bf32c..9ef3c338f 100644 --- a/src/OrderBundle/Serializer/OrderSerializerHandler.php +++ b/src/OrderBundle/Serializer/OrderSerializerHandler.php @@ -1,7 +1,7 @@ * diff --git a/src/OrderBundle/SonataOrderBundle.php b/src/OrderBundle/SonataOrderBundle.php index d7bac244f..1d018f98d 100644 --- a/src/OrderBundle/SonataOrderBundle.php +++ b/src/OrderBundle/SonataOrderBundle.php @@ -1,7 +1,7 @@ * diff --git a/src/PaymentBundle/Consumer/PaymentProcessOrderConsumer.php b/src/PaymentBundle/Consumer/PaymentProcessOrderConsumer.php index 40088a032..47b1c9894 100644 --- a/src/PaymentBundle/Consumer/PaymentProcessOrderConsumer.php +++ b/src/PaymentBundle/Consumer/PaymentProcessOrderConsumer.php @@ -1,7 +1,7 @@ * @@ -48,9 +48,9 @@ class PaymentProcessOrderConsumer implements ConsumerInterface */ public function __construct(OrderManagerInterface $orderManager, ManagerInterface $transactionManager, BackendInterface $backend) { - $this->orderManager = $orderManager; + $this->orderManager = $orderManager; $this->transactionManager = $transactionManager; - $this->backend = $backend; + $this->backend = $backend; } /** @@ -58,18 +58,18 @@ public function __construct(OrderManagerInterface $orderManager, ManagerInterfac */ public function process(ConsumerEvent $event) { - $order = $this->getOrder($event); + $order = $this->getOrder($event); $transaction = $this->getTransaction($event); $orderElements = $order->getOrderElements(); foreach ($orderElements as $orderElement) { $this->backend->createAndPublish('sonata_payment_order_element_process', array( - 'product_id' => $orderElement->getProductId(), + 'product_id' => $orderElement->getProductId(), 'transaction_status' => $transaction->getStatusCode(), - 'order_status' => $order->getStatus(), - 'quantity' => $orderElement->getQuantity(), - 'product_type' => $orderElement->getProductType(), + 'order_status' => $order->getStatus(), + 'quantity' => $orderElement->getQuantity(), + 'product_type' => $orderElement->getProductType(), )); } } diff --git a/src/PaymentBundle/Consumer/PaymentProcessOrderElementConsumer.php b/src/PaymentBundle/Consumer/PaymentProcessOrderElementConsumer.php index 4d0381fed..554b23650 100644 --- a/src/PaymentBundle/Consumer/PaymentProcessOrderElementConsumer.php +++ b/src/PaymentBundle/Consumer/PaymentProcessOrderElementConsumer.php @@ -1,7 +1,7 @@ * @@ -43,7 +43,7 @@ class PaymentProcessOrderElementConsumer implements ConsumerInterface public function __construct(ManagerInterface $orderElementManager, ProductPool $productPool) { $this->orderElementManager = $orderElementManager; - $this->productPool = $productPool; + $this->productPool = $productPool; } /** @@ -51,13 +51,13 @@ public function __construct(ManagerInterface $orderElementManager, ProductPool $ */ public function process(ConsumerEvent $event) { - $orderStatus = $event->getMessage()->getValue('order_status'); + $orderStatus = $event->getMessage()->getValue('order_status'); $transactionStatus = $event->getMessage()->getValue('transaction_status'); - $productId = $event->getMessage()->getValue('product_id'); - $productType = $event->getMessage()->getValue('product_type'); - $quantity = $event->getMessage()->getValue('quantity'); + $productId = $event->getMessage()->getValue('product_id'); + $productType = $event->getMessage()->getValue('product_type'); + $quantity = $event->getMessage()->getValue('quantity'); - $productManager = $this->getProductManager($productType); + $productManager = $this->getProductManager($productType); $productProvider = $this->getProductProvider($productType); $diff = $this->generateDiffValue($transactionStatus, $orderStatus, $quantity); diff --git a/src/PaymentBundle/Controller/DebugPaymentController.php b/src/PaymentBundle/Controller/DebugPaymentController.php index 43acf1301..4dc2c0de5 100644 --- a/src/PaymentBundle/Controller/DebugPaymentController.php +++ b/src/PaymentBundle/Controller/DebugPaymentController.php @@ -1,7 +1,7 @@ * diff --git a/src/PaymentBundle/Controller/PaymentController.php b/src/PaymentBundle/Controller/PaymentController.php index 2cd98b242..4393317c6 100644 --- a/src/PaymentBundle/Controller/PaymentController.php +++ b/src/PaymentBundle/Controller/PaymentController.php @@ -1,7 +1,7 @@ * diff --git a/src/PaymentBundle/DependencyInjection/Configuration.php b/src/PaymentBundle/DependencyInjection/Configuration.php index 939e0ff85..866a1410c 100644 --- a/src/PaymentBundle/DependencyInjection/Configuration.php +++ b/src/PaymentBundle/DependencyInjection/Configuration.php @@ -1,7 +1,7 @@ * @@ -57,20 +57,20 @@ private function addPaymentSection(ArrayNodeDefinition $node) $node ->validate() ->ifTrue(function ($v) { - foreach ($v['methods'] as $methodCode => $service) { - if (null === $service || '' === $service) { - foreach ($v['services'] as $serviceConf) { - if ($methodCode === $serviceConf['code']) { - break 2; - } + foreach ($v['methods'] as $methodCode => $service) { + if (null === $service || '' === $service) { + foreach ($v['services'] as $serviceConf) { + if ($methodCode === $serviceConf['code']) { + break 2; } - - return true; } + + return true; } + } - return false; - }) + return false; + }) ->thenInvalid('Custom payment methods require a service id. Provided payment methods need to be configured with their method code as key.') ->end() ->children() @@ -102,7 +102,7 @@ private function addPaymentSection(ArrayNodeDefinition $node) ->scalarNode('url_return_ko')->defaultValue('sonata_payment_error')->cannotBeEmpty()->end() ->scalarNode('url_return_ok')->defaultValue('sonata_payment_confirmation')->cannotBeEmpty()->end() - ->scalarNode('method')->defaultValue('encryptViaBuffer')->cannotBeEmpty()->end() # encryptViaFile || encryptViaBuffer + ->scalarNode('method')->defaultValue('encryptViaBuffer')->cannotBeEmpty()->end() // encryptViaFile || encryptViaBuffer ->scalarNode('key_file')->defaultValue('%kernel.root_dir%/my-prvkey.pem')->cannotBeEmpty()->end() ->scalarNode('cert_file')->defaultValue('%kernel.root_dir%/my-pubcert.pem')->cannotBeEmpty()->end() diff --git a/src/PaymentBundle/DependencyInjection/SonataPaymentExtension.php b/src/PaymentBundle/DependencyInjection/SonataPaymentExtension.php index 6b75fa9ff..cbdbffeff 100644 --- a/src/PaymentBundle/DependencyInjection/SonataPaymentExtension.php +++ b/src/PaymentBundle/DependencyInjection/SonataPaymentExtension.php @@ -1,7 +1,7 @@ * @@ -76,12 +76,12 @@ public function configurePayment(ContainerBuilder $container, array $config) $pool = $container->getDefinition('sonata.payment.pool'); $internal = array( - 'debug' => 'sonata.payment.method.debug', - 'pass' => 'sonata.payment.method.pass', - 'check' => 'sonata.payment.method.check', + 'debug' => 'sonata.payment.method.debug', + 'pass' => 'sonata.payment.method.pass', + 'check' => 'sonata.payment.method.check', 'scellius' => 'sonata.payment.method.scellius', - 'ogone' => 'sonata.payment.method.ogone', - 'paypal' => 'sonata.payment.method.paypal', + 'ogone' => 'sonata.payment.method.ogone', + 'paypal' => 'sonata.payment.method.paypal', ); $configured = array(); @@ -91,10 +91,10 @@ public function configurePayment(ContainerBuilder $container, array $config) if (array_key_exists($id, $internal)) { $id = $internal[$id]; - $name = isset($settings['name']) ? $settings['name'] : 'n/a'; - $options = isset($settings['options']) ? $settings['options'] : array(); + $name = isset($settings['name']) ? $settings['name'] : 'n/a'; + $options = isset($settings['options']) ? $settings['options'] : array(); - $code = isset($settings['code']) ? $settings['code'] : false; + $code = isset($settings['code']) ? $settings['code'] : false; if (!$code) { throw new \RuntimeException('Please provide a code for the payment handler'); @@ -190,16 +190,16 @@ public function registerDoctrineMapping(array $config) $collector = DoctrineCollector::getInstance(); $collector->addAssociation($config['class']['transaction'], 'mapManyToOne', array( - 'fieldName' => 'order', + 'fieldName' => 'order', 'targetEntity' => $config['class']['order'], - 'cascade' => array(), - 'mappedBy' => null, - 'inversedBy' => null, - 'joinColumns' => array( + 'cascade' => array(), + 'mappedBy' => null, + 'inversedBy' => null, + 'joinColumns' => array( array( - 'name' => 'order_id', + 'name' => 'order_id', 'referencedColumnName' => 'id', - 'onDelete' => 'SET NULL', + 'onDelete' => 'SET NULL', ), ), 'orphanRemoval' => false, diff --git a/src/PaymentBundle/Entity/BaseTransaction.php b/src/PaymentBundle/Entity/BaseTransaction.php index 4f63ce58b..44b4f0cf7 100644 --- a/src/PaymentBundle/Entity/BaseTransaction.php +++ b/src/PaymentBundle/Entity/BaseTransaction.php @@ -1,7 +1,7 @@ * @@ -68,9 +68,9 @@ class BaseTransaction implements TransactionInterface public function __construct() { - $this->createdAt = new \DateTime(); + $this->createdAt = new \DateTime(); $this->transactionId = 'n/a'; - $this->information = 'Transaction created'; + $this->information = 'Transaction created'; $this->setStatusCode(self::STATUS_OPEN); } @@ -206,16 +206,16 @@ public function getStatusName() public static function getStatusList() { return array( - TransactionInterface::STATUS_ORDER_UNKNOWN => 'order_unknown', - TransactionInterface::STATUS_OPEN => 'open', - TransactionInterface::STATUS_PENDING => 'pending', - TransactionInterface::STATUS_VALIDATED => 'validated', - TransactionInterface::STATUS_CANCELLED => 'cancelled', - TransactionInterface::STATUS_UNKNOWN => 'status_unknown', - TransactionInterface::STATUS_ERROR_VALIDATION => 'error_validation', - TransactionInterface::STATUS_WRONG_CALLBACK => 'wrong_callback', - TransactionInterface::STATUS_WRONG_REQUEST => 'wrong_request', - TransactionInterface::STATUS_ORDER_NOT_OPEN => 'order_to_open', + TransactionInterface::STATUS_ORDER_UNKNOWN => 'order_unknown', + TransactionInterface::STATUS_OPEN => 'open', + TransactionInterface::STATUS_PENDING => 'pending', + TransactionInterface::STATUS_VALIDATED => 'validated', + TransactionInterface::STATUS_CANCELLED => 'cancelled', + TransactionInterface::STATUS_UNKNOWN => 'status_unknown', + TransactionInterface::STATUS_ERROR_VALIDATION => 'error_validation', + TransactionInterface::STATUS_WRONG_CALLBACK => 'wrong_callback', + TransactionInterface::STATUS_WRONG_REQUEST => 'wrong_request', + TransactionInterface::STATUS_ORDER_NOT_OPEN => 'order_to_open', ); } diff --git a/src/PaymentBundle/Entity/TransactionManager.php b/src/PaymentBundle/Entity/TransactionManager.php index bf6708a1c..d88302f8a 100644 --- a/src/PaymentBundle/Entity/TransactionManager.php +++ b/src/PaymentBundle/Entity/TransactionManager.php @@ -1,7 +1,7 @@ * diff --git a/src/PaymentBundle/Form/Type/PaymentTransactionStatusType.php b/src/PaymentBundle/Form/Type/PaymentTransactionStatusType.php index ba3f4affe..00f09bcce 100644 --- a/src/PaymentBundle/Form/Type/PaymentTransactionStatusType.php +++ b/src/PaymentBundle/Form/Type/PaymentTransactionStatusType.php @@ -1,13 +1,12 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. - * */ namespace Sonata\PaymentBundle\Form\Type; diff --git a/src/PaymentBundle/SonataPaymentBundle.php b/src/PaymentBundle/SonataPaymentBundle.php index 9a3dae768..c1713480c 100644 --- a/src/PaymentBundle/SonataPaymentBundle.php +++ b/src/PaymentBundle/SonataPaymentBundle.php @@ -1,7 +1,7 @@ * diff --git a/src/PriceBundle/DependencyInjection/Configuration.php b/src/PriceBundle/DependencyInjection/Configuration.php index 9d95ced4b..abda58edd 100644 --- a/src/PriceBundle/DependencyInjection/Configuration.php +++ b/src/PriceBundle/DependencyInjection/Configuration.php @@ -1,7 +1,7 @@ * diff --git a/src/PriceBundle/DependencyInjection/SonataPriceExtension.php b/src/PriceBundle/DependencyInjection/SonataPriceExtension.php index 576b333ea..652000ed4 100644 --- a/src/PriceBundle/DependencyInjection/SonataPriceExtension.php +++ b/src/PriceBundle/DependencyInjection/SonataPriceExtension.php @@ -1,7 +1,7 @@ * diff --git a/src/PriceBundle/SonataPriceBundle.php b/src/PriceBundle/SonataPriceBundle.php index 9f28ea29b..e962ef849 100644 --- a/src/PriceBundle/SonataPriceBundle.php +++ b/src/PriceBundle/SonataPriceBundle.php @@ -1,7 +1,7 @@ * @@ -32,7 +32,7 @@ public function build(ContainerBuilder $container) public function boot() { if (0 == $this->getBcScale()) { - $message = << * @@ -22,25 +22,6 @@ class DeliveryAdmin extends Admin { protected $parentAssociationMapping = 'product'; - /** - * {@inheritdoc} - */ - protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) - { - if (!$childAdmin && !in_array($action, array('edit'))) { - return; - } - - $admin = $this->isChild() ? $this->getParent() : $this; - - $id = $admin->getRequest()->get('id'); - - $menu->addChild( - $this->trans('product.sidemenu.link_product_edit', array(), 'SonataProductBundle'), - array('uri' => $admin->generateUrl('edit', array('id' => $id))) - ); - } - /** * {@inheritdoc} */ @@ -91,6 +72,25 @@ public function configureListFields(ListMapper $list) ; } + /** + * {@inheritdoc} + */ + protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) + { + if (!$childAdmin && !in_array($action, array('edit'))) { + return; + } + + $admin = $this->isChild() ? $this->getParent() : $this; + + $id = $admin->getRequest()->get('id'); + + $menu->addChild( + $this->trans('product.sidemenu.link_product_edit', array(), 'SonataProductBundle'), + array('uri' => $admin->generateUrl('edit', array('id' => $id))) + ); + } + /** * {@inheritdoc} */ diff --git a/src/ProductBundle/Admin/ProductAdmin.php b/src/ProductBundle/Admin/ProductAdmin.php index d04230582..35c9ec530 100644 --- a/src/ProductBundle/Admin/ProductAdmin.php +++ b/src/ProductBundle/Admin/ProductAdmin.php @@ -1,7 +1,7 @@ * @@ -106,7 +106,7 @@ public function configureFormFields(FormMapper $formMapper) return; } - $product = $this->getProduct(); + $product = $this->getProduct(); $provider = $this->getProductProvider($product); if ($product->getId() > 0) { @@ -116,48 +116,6 @@ public function configureFormFields(FormMapper $formMapper) } } - /** - * {@inheritdoc} - */ - protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) - { - if (!$childAdmin && !in_array($action, array('edit'))) { - return; - } - - $admin = $this->isChild() ? $this->getParent() : $this; - - $id = $admin->getRequest()->get('id'); - $product = $this->getObject($id); - - $menu->addChild( - $this->trans('product.sidemenu.link_product_edit', array(), 'SonataProductBundle'), - array('uri' => $admin->generateUrl('edit', array('id' => $id))) - ); - - $menu->addChild( - $this->trans('product.sidemenu.view_categories', array(), 'SonataProductBundle'), - array('uri' => $admin->generateUrl('sonata.product.admin.product.category.list', array('id' => $id))) - ); - - $menu->addChild( - $this->trans('product.sidemenu.view_collections', array(), 'SonataProductBundle'), - array('uri' => $admin->generateUrl('sonata.product.admin.product.collection.list', array('id' => $id))) - ); - - $menu->addChild( - $this->trans('product.sidemenu.view_deliveries', array(), 'SonataProductBundle'), - array('uri' => $admin->generateUrl('sonata.product.admin.delivery.list', array('id' => $id))) - ); - - if (!$product->isVariation() && $this->getCode() == 'sonata.product.admin.product') { - $menu->addChild( - $this->trans('product.sidemenu.view_variations'), - array('uri' => $admin->generateUrl('sonata.product.admin.product.variation.list', array('id' => $id))) - ); - } - } - /** * {@inheritdoc} */ @@ -172,26 +130,6 @@ public function getPersistentParameters() ); } - /** - * {@inheritdoc} - */ - protected function configureShowFields(ShowMapper $showMapper) - { - // this admin class works only from a request scope - if (!$this->hasRequest()) { - return; - } - - if ($this->isChild()) { // variation - return; - } - - $product = $this->getProduct(); - $provider = $this->getProductProvider($product); - - $provider->configureShowFields($showMapper); - } - /** * {@inheritdoc} */ @@ -287,4 +225,66 @@ public function postUpdate($product) $provider->synchronizeVariations($product); } } + + /** + * {@inheritdoc} + */ + protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) + { + if (!$childAdmin && !in_array($action, array('edit'))) { + return; + } + + $admin = $this->isChild() ? $this->getParent() : $this; + + $id = $admin->getRequest()->get('id'); + $product = $this->getObject($id); + + $menu->addChild( + $this->trans('product.sidemenu.link_product_edit', array(), 'SonataProductBundle'), + array('uri' => $admin->generateUrl('edit', array('id' => $id))) + ); + + $menu->addChild( + $this->trans('product.sidemenu.view_categories', array(), 'SonataProductBundle'), + array('uri' => $admin->generateUrl('sonata.product.admin.product.category.list', array('id' => $id))) + ); + + $menu->addChild( + $this->trans('product.sidemenu.view_collections', array(), 'SonataProductBundle'), + array('uri' => $admin->generateUrl('sonata.product.admin.product.collection.list', array('id' => $id))) + ); + + $menu->addChild( + $this->trans('product.sidemenu.view_deliveries', array(), 'SonataProductBundle'), + array('uri' => $admin->generateUrl('sonata.product.admin.delivery.list', array('id' => $id))) + ); + + if (!$product->isVariation() && $this->getCode() == 'sonata.product.admin.product') { + $menu->addChild( + $this->trans('product.sidemenu.view_variations'), + array('uri' => $admin->generateUrl('sonata.product.admin.product.variation.list', array('id' => $id))) + ); + } + } + + /** + * {@inheritdoc} + */ + protected function configureShowFields(ShowMapper $showMapper) + { + // this admin class works only from a request scope + if (!$this->hasRequest()) { + return; + } + + if ($this->isChild()) { // variation + return; + } + + $product = $this->getProduct(); + $provider = $this->getProductProvider($product); + + $provider->configureShowFields($showMapper); + } } diff --git a/src/ProductBundle/Admin/ProductCategoryAdmin.php b/src/ProductBundle/Admin/ProductCategoryAdmin.php index 36c9d4041..0fe3d15ec 100644 --- a/src/ProductBundle/Admin/ProductCategoryAdmin.php +++ b/src/ProductBundle/Admin/ProductCategoryAdmin.php @@ -1,7 +1,7 @@ * @@ -22,25 +22,6 @@ class ProductCategoryAdmin extends Admin { protected $parentAssociationMapping = 'product'; - /** - * {@inheritdoc} - */ - protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) - { - if (!$childAdmin && !in_array($action, array('edit'))) { - return; - } - - $admin = $this->isChild() ? $this->getParent() : $this; - - $id = $admin->getRequest()->get('id'); - - $menu->addChild( - $this->trans('product.sidemenu.link_product_edit', array(), 'SonataProductBundle'), - array('uri' => $admin->generateUrl('edit', array('id' => $id))) - ); - } - /** * {@inheritdoc} */ @@ -96,4 +77,23 @@ public function configureDatagridFilters(DatagridMapper $filter) ; } } + + /** + * {@inheritdoc} + */ + protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) + { + if (!$childAdmin && !in_array($action, array('edit'))) { + return; + } + + $admin = $this->isChild() ? $this->getParent() : $this; + + $id = $admin->getRequest()->get('id'); + + $menu->addChild( + $this->trans('product.sidemenu.link_product_edit', array(), 'SonataProductBundle'), + array('uri' => $admin->generateUrl('edit', array('id' => $id))) + ); + } } diff --git a/src/ProductBundle/Admin/ProductCollectionAdmin.php b/src/ProductBundle/Admin/ProductCollectionAdmin.php index edff25da7..fd05fd720 100644 --- a/src/ProductBundle/Admin/ProductCollectionAdmin.php +++ b/src/ProductBundle/Admin/ProductCollectionAdmin.php @@ -1,7 +1,7 @@ * @@ -22,25 +22,6 @@ class ProductCollectionAdmin extends Admin { protected $parentAssociationMapping = 'product'; - /** - * {@inheritdoc} - */ - protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) - { - if (!$childAdmin && !in_array($action, array('edit'))) { - return; - } - - $admin = $this->isChild() ? $this->getParent() : $this; - - $id = $admin->getRequest()->get('id'); - - $menu->addChild( - $this->trans('product.sidemenu.link_product_edit', array(), 'SonataProductBundle'), - array('uri' => $admin->generateUrl('edit', array('id' => $id))) - ); - } - /** * {@inheritdoc} */ @@ -95,4 +76,23 @@ public function configureDatagridFilters(DatagridMapper $filter) ; } } + + /** + * {@inheritdoc} + */ + protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null) + { + if (!$childAdmin && !in_array($action, array('edit'))) { + return; + } + + $admin = $this->isChild() ? $this->getParent() : $this; + + $id = $admin->getRequest()->get('id'); + + $menu->addChild( + $this->trans('product.sidemenu.link_product_edit', array(), 'SonataProductBundle'), + array('uri' => $admin->generateUrl('edit', array('id' => $id))) + ); + } } diff --git a/src/ProductBundle/Admin/ProductVariationAdmin.php b/src/ProductBundle/Admin/ProductVariationAdmin.php index 71b672a80..a10dac5c5 100644 --- a/src/ProductBundle/Admin/ProductVariationAdmin.php +++ b/src/ProductBundle/Admin/ProductVariationAdmin.php @@ -1,7 +1,7 @@ * @@ -53,7 +53,7 @@ public function getBaseRouteName() { if (!$this->baseRouteName) { if ($this->getCode() == 'sonata.product.admin.product.variation' && !$this->isChild()) { // variation - $this->baseRouteName = 'admin_sonata_product_variation'; + $this->baseRouteName = 'admin_sonata_product_variation'; } elseif ($this->getCode() == 'sonata.product.admin.product.variation' && $this->isChild()) { // variation $this->baseRouteName = sprintf('%s_%s', $this->getParent()->getBaseRouteName(), @@ -77,7 +77,7 @@ public function configureFormFields(FormMapper $formMapper) return; } - $product = $this->getProduct(); + $product = $this->getProduct(); $provider = $this->getProductProvider($product); if ($product->getId() > 0) { @@ -98,7 +98,7 @@ protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInte $admin = $this->isChild() ? $this->getParent() : $this; - $id = $admin->getRequest()->get('id'); + $id = $admin->getRequest()->get('id'); $product = $this->getObject($id); $menu->addChild( @@ -133,7 +133,7 @@ protected function configureShowFields(ShowMapper $showMapper) return; } - $product = $this->getProduct(); + $product = $this->getProduct(); $provider = $this->getProductProvider($product); $provider->configureShowFields($showMapper); diff --git a/src/ProductBundle/Block/CatalogBreadcrumbBlockService.php b/src/ProductBundle/Block/CatalogBreadcrumbBlockService.php index 49195440e..a021c7d54 100644 --- a/src/ProductBundle/Block/CatalogBreadcrumbBlockService.php +++ b/src/ProductBundle/Block/CatalogBreadcrumbBlockService.php @@ -1,7 +1,7 @@ * @@ -37,12 +37,12 @@ protected function getMenu(BlockContextInterface $blockContext) $menu = $this->getRootMenu($blockContext); $menu->addChild('sonata_product_catalog_breadcrumb', array( - 'route' => 'sonata_catalog_index', + 'route' => 'sonata_catalog_index', 'extras' => array('translation_domain' => 'SonataProductBundle'), )); $categories = array(); - $product = null; + $product = null; if ($category = $blockContext->getBlock()->getSetting('category')) { $sorted = array($category); @@ -73,9 +73,9 @@ protected function getMenu(BlockContextInterface $blockContext) if (count($categories) > 0) { foreach ($categories as $category) { $menu->addChild($category->getName(), array( - 'route' => 'sonata_catalog_category', + 'route' => 'sonata_catalog_category', 'routeParameters' => array( - 'category_id' => $category->getId(), + 'category_id' => $category->getId(), 'category_slug' => $category->getSlug(), ), )); @@ -84,10 +84,10 @@ protected function getMenu(BlockContextInterface $blockContext) if ($product) { $menu->addChild($product->getName(), array( - 'route' => 'sonata_product_view', + 'route' => 'sonata_product_view', 'routeParameters' => array( 'productId' => $product->getId(), - 'slug' => $product->getSlug(), + 'slug' => $product->getSlug(), ), )); } diff --git a/src/ProductBundle/Block/CategoriesMenuBlockService.php b/src/ProductBundle/Block/CategoriesMenuBlockService.php index 17a8cd271..ed294da85 100644 --- a/src/ProductBundle/Block/CategoriesMenuBlockService.php +++ b/src/ProductBundle/Block/CategoriesMenuBlockService.php @@ -1,7 +1,7 @@ * @@ -63,7 +63,7 @@ public function setDefaultSettings(OptionsResolverInterface $resolver) $resolver->setDefaults(array( 'menu_template' => 'SonataBlockBundle:Block:block_side_menu_template.html.twig', - 'safe_labels' => true, + 'safe_labels' => true, )); } @@ -80,7 +80,7 @@ protected function getMenu(BlockContextInterface $blockContext) $menu = $this->menuBuilder->createCategoryMenu( array( 'childrenAttributes' => array('class' => $settings['menu_class']), - 'attributes' => array('class' => $settings['children_class']), + 'attributes' => array('class' => $settings['children_class']), ), $settings['current_uri'] ); diff --git a/src/ProductBundle/Block/FiltersMenuBlockService.php b/src/ProductBundle/Block/FiltersMenuBlockService.php index dc955937c..e49312713 100644 --- a/src/ProductBundle/Block/FiltersMenuBlockService.php +++ b/src/ProductBundle/Block/FiltersMenuBlockService.php @@ -1,7 +1,7 @@ * @@ -62,7 +62,7 @@ public function setDefaultSettings(OptionsResolverInterface $resolver) parent::setDefaultSettings($resolver); $resolver->setDefaults(array( - 'menu_class' => 'nav nav-list', + 'menu_class' => 'nav nav-list', 'product_provider' => null, )); } diff --git a/src/ProductBundle/Block/RecentProductsBlockService.php b/src/ProductBundle/Block/RecentProductsBlockService.php index 544d4c1dc..298464d90 100644 --- a/src/ProductBundle/Block/RecentProductsBlockService.php +++ b/src/ProductBundle/Block/RecentProductsBlockService.php @@ -1,7 +1,7 @@ * @@ -49,7 +49,7 @@ class RecentProductsBlockService extends BaseBlockService public function __construct($name, EngineInterface $templating, RegistryInterface $registry, CurrencyDetectorInterface $currencyDetector, $productClass) { $this->productRepository = $registry->getManager()->getRepository($productClass); - $this->currencyDetector = $currencyDetector; + $this->currencyDetector = $currencyDetector; parent::__construct($name, $templating); } @@ -63,11 +63,11 @@ public function execute(BlockContextInterface $blockContext, Response $response ->findLastActiveProducts($blockContext->getSetting('number')); $params = array( - 'context' => $blockContext, - 'settings' => $blockContext->getSettings(), - 'block' => $blockContext->getBlock(), - 'products' => $products, - 'currency' => $this->currencyDetector->getCurrency(), + 'context' => $blockContext, + 'settings' => $blockContext->getSettings(), + 'block' => $blockContext->getBlock(), + 'products' => $products, + 'currency' => $this->currencyDetector->getCurrency(), ); return $this->renderResponse($blockContext->getTemplate(), $params, $response); @@ -108,9 +108,9 @@ public function getName() public function setDefaultSettings(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'number' => 5, - 'title' => 'Recent products', - 'template' => 'SonataProductBundle:Block:recent_products.html.twig', + 'number' => 5, + 'title' => 'Recent products', + 'template' => 'SonataProductBundle:Block:recent_products.html.twig', )); } diff --git a/src/ProductBundle/Block/SimilarProductsBlockService.php b/src/ProductBundle/Block/SimilarProductsBlockService.php index 9a021a806..ae0fb9dd6 100644 --- a/src/ProductBundle/Block/SimilarProductsBlockService.php +++ b/src/ProductBundle/Block/SimilarProductsBlockService.php @@ -1,7 +1,7 @@ * @@ -56,8 +56,8 @@ class SimilarProductsBlockService extends BaseBlockService public function __construct($name, EngineInterface $templating, RegistryInterface $registry, CurrencyDetectorInterface $currencyDetector, ProductFinderInterface $productFinder, $productClass) { $this->productRepository = $registry->getManager()->getRepository($productClass); - $this->currencyDetector = $currencyDetector; - $this->productFinder = $productFinder; + $this->currencyDetector = $currencyDetector; + $this->productFinder = $productFinder; parent::__construct($name, $templating); } @@ -74,11 +74,11 @@ public function execute(BlockContextInterface $blockContext, Response $response $products = $this->getProductFinder()->getCrossSellingSimilarParentProducts($product, $blockContext->getSetting('number')); $params = array( - 'context' => $blockContext, - 'settings' => $blockContext->getSettings(), - 'block' => $blockContext->getBlock(), - 'products' => $products, - 'currency' => $this->currencyDetector->getCurrency(), + 'context' => $blockContext, + 'settings' => $blockContext->getSettings(), + 'block' => $blockContext->getBlock(), + 'products' => $products, + 'currency' => $this->currencyDetector->getCurrency(), ); return $this->renderResponse($blockContext->getTemplate(), $params, $response); @@ -120,10 +120,10 @@ public function getName() public function setDefaultSettings(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'number' => 5, - 'title' => 'Similar products', + 'number' => 5, + 'title' => 'Similar products', 'base_product_id' => null, - 'template' => 'SonataProductBundle:Block:similar_products.html.twig', + 'template' => 'SonataProductBundle:Block:similar_products.html.twig', )); } diff --git a/src/ProductBundle/Block/VariationsFormBlockService.php b/src/ProductBundle/Block/VariationsFormBlockService.php index 63c25b4f7..87884497e 100644 --- a/src/ProductBundle/Block/VariationsFormBlockService.php +++ b/src/ProductBundle/Block/VariationsFormBlockService.php @@ -1,7 +1,7 @@ * @@ -65,15 +65,15 @@ public function execute(BlockContextInterface $blockContext, Response $response if (null === $product) { return $this->renderResponse($blockContext->getTemplate(), array( - 'context' => $blockContext, + 'context' => $blockContext, 'settings' => $blockContext->getSettings(), - 'block' => $blockContext->getBlock(), - 'choices' => array(), - 'form' => null, + 'block' => $blockContext->getBlock(), + 'choices' => array(), + 'form' => null, ), $response); } - $fields = $blockContext->getSetting('variations_properties'); + $fields = $blockContext->getSetting('variations_properties'); $choices = $this->pool->getProvider($product)->getVariationsChoices($product, $fields); @@ -87,16 +87,16 @@ public function execute(BlockContextInterface $blockContext, Response $response $form = $this->formFactory->createBuilder('sonata_product_variation_choices', $currentValues, array( 'field_options' => $blockContext->getSetting('form_field_options'), - 'product' => $product, - 'fields' => $fields, + 'product' => $product, + 'fields' => $fields, ))->getForm(); $params = array( - 'context' => $blockContext, - 'settings' => $blockContext->getSettings(), - 'block' => $blockContext->getBlock(), - 'choices' => $choices, - 'form' => $form->createView(), + 'context' => $blockContext, + 'settings' => $blockContext->getSettings(), + 'block' => $blockContext->getBlock(), + 'choices' => $choices, + 'form' => $form->createView(), ); return $this->renderResponse($blockContext->getTemplate(), $params, $response); @@ -132,24 +132,24 @@ public function getName() public function setDefaultSettings(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'product' => null, + 'product' => null, 'variations_properties' => array(), - 'form_route' => 'sonata_product_variation_product', + 'form_route' => 'sonata_product_variation_product', 'form_route_parameters' => function (Options $options) { - $product = $options->get('product'); + $product = $options->get('product'); - if (null !== $product && !$product instanceof ProductInterface) { - throw new \RuntimeException("Wrong 'product' parameter"); - } + if (null !== $product && !$product instanceof ProductInterface) { + throw new \RuntimeException("Wrong 'product' parameter"); + } - return array( + return array( 'productId' => $product ? $product->getId() : null, - 'slug' => $product ? $product->getSlug() : null, + 'slug' => $product ? $product->getSlug() : null, ); - }, - 'form_field_options' => array(), - 'title' => 'Product variations', - 'template' => 'SonataProductBundle:Block:variations_choice.html.twig', + }, + 'form_field_options' => array(), + 'title' => 'Product variations', + 'template' => 'SonataProductBundle:Block:variations_choice.html.twig', )); } } diff --git a/src/ProductBundle/Command/GenerateProductCommand.php b/src/ProductBundle/Command/GenerateProductCommand.php index 32094399f..15843ade1 100644 --- a/src/ProductBundle/Command/GenerateProductCommand.php +++ b/src/ProductBundle/Command/GenerateProductCommand.php @@ -1,7 +1,7 @@ * @@ -75,31 +75,31 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln(' > mustaching skeleton files'); Mustache::renderDir($bundle_dir, array( - 'product' => $input->getArgument('product'), + 'product' => $input->getArgument('product'), 'root_name' => strtolower(preg_replace('/[A-Z]/', '_\\0', $input->getArgument('product'))), )); $renames = array( // entity - '%s/Entity/Entity.php' => '%s/Entity/%s.php', - '%s/Repository/Repository.php' => '%s/Repository/%sRepository.php', - '%s/Provider/EntityProductProvider.php' => '%s/Provider/%sProductProvider.php', - '%s/Resources/config/doctrine/Entity.orm.xml' => '%s/Resources/config/doctrine/%s.orm.xml', - '%s/Resources/config/serializer/Entity.xml' => '%s/Resources/config/serializer/Entity.%s.xml', + '%s/Entity/Entity.php' => '%s/Entity/%s.php', + '%s/Repository/Repository.php' => '%s/Repository/%sRepository.php', + '%s/Provider/EntityProductProvider.php' => '%s/Provider/%sProductProvider.php', + '%s/Resources/config/doctrine/Entity.orm.xml' => '%s/Resources/config/doctrine/%s.orm.xml', + '%s/Resources/config/serializer/Entity.xml' => '%s/Resources/config/serializer/Entity.%s.xml', // controller - '%s/Controller/Controller.php' => '%s/Controller/%sController.php', + '%s/Controller/Controller.php' => '%s/Controller/%sController.php', // templates - '%s/Resources/views/Entity/view.html.twig' => '%s/Resources/views/%s/view.html.twig', - '%s/Resources/views/Entity/form_basket_element.html.twig' => '%s/Resources/views/%s/form_basket_element.html.twig', - '%s/Resources/views/Entity/final_review_basket_element.html.twig' => '%s/Resources/views/%s/final_review_basket_element.html.twig', + '%s/Resources/views/Entity/view.html.twig' => '%s/Resources/views/%s/view.html.twig', + '%s/Resources/views/Entity/form_basket_element.html.twig' => '%s/Resources/views/%s/form_basket_element.html.twig', + '%s/Resources/views/Entity/final_review_basket_element.html.twig' => '%s/Resources/views/%s/final_review_basket_element.html.twig', ); $dirs = array( sprintf('%s/Resources/views/%s', $bundle_dir, $input->getArgument('product')), - sprintf('%s/Product/%s', $bundle_dir, $input->getArgument('product')), - sprintf('%s/Provider', $bundle_dir), + sprintf('%s/Product/%s', $bundle_dir, $input->getArgument('product')), + sprintf('%s/Provider', $bundle_dir), ); foreach ($dirs as $dir) { diff --git a/src/ProductBundle/Controller/Api/ProductController.php b/src/ProductBundle/Controller/Api/ProductController.php index 5cacd490f..20c300cc4 100644 --- a/src/ProductBundle/Controller/Api/ProductController.php +++ b/src/ProductBundle/Controller/Api/ProductController.php @@ -1,7 +1,7 @@ * @@ -71,10 +71,10 @@ class ProductController */ public function __construct(ProductManagerInterface $productManager, Pool $productPool, FormFactoryInterface $formFactory, FormatterPool $formatterPool) { - $this->productManager = $productManager; - $this->productPool = $productPool; - $this->formFactory = $formFactory; - $this->formatterPool = $formatterPool; + $this->productManager = $productManager; + $this->productPool = $productPool; + $this->formFactory = $formFactory; + $this->formatterPool = $formatterPool; } /** @@ -102,9 +102,9 @@ public function getProductsAction(ParamFetcherInterface $paramFetcher) 'enabled' => '', ); - $page = $paramFetcher->get('page'); - $limit = $paramFetcher->get('count'); - $sort = $paramFetcher->get('orderBy'); + $page = $paramFetcher->get('page'); + $limit = $paramFetcher->get('count'); + $sort = $paramFetcher->get('orderBy'); $criteria = array_intersect_key($paramFetcher->all(), $supportedCriteria); foreach ($criteria as $key => $value) { @@ -181,7 +181,7 @@ public function postProductAction($provider, Request $request) * Updates a product. * * @Put("/{provider}/products/{id}") - + * @ApiDoc( * requirements={ * {"name"="id", "dataType"="integer", "requirement"="\d+", "description"="product identifier"}, @@ -211,51 +211,6 @@ public function putProductAction($id, $provider, Request $request) return $this->handleWriteProduct($provider, $request, $id); } - /** - * Write a product, this method is used by both POST and PUT action methods. - * - * @param string $provider A product provider name - * @param Request $request Symfony request - * @param int|null $id A product identifier - * - * @return \FOS\RestBundle\View\View|FormInterface - */ - protected function handleWriteProduct($provider, $request, $id = null) - { - $product = $id ? $this->getProduct($id) : null; - - try { - $manager = $this->productPool->getManager($provider); - } catch (\RuntimeException $e) { - throw new NotFoundHttpException($e->getMessage(), $e); - } - - $form = $this->formFactory->createNamed(null, 'sonata_product_api_form_product', $product, array( - 'csrf_protection' => false, - 'data_class' => $manager->getClass(), - 'provider_name' => $provider, - )); - - $form->bind($request); - - if ($form->isValid()) { - $product = $form->getData(); - $product->setDescription($this->formatterPool->transform($product->getDescriptionFormatter(), $product->getRawDescription())); - $product->setShortDescription($this->formatterPool->transform($product->getShortDescriptionFormatter(), $product->getRawShortDescription())); - $manager->save($product); - - $view = \FOS\RestBundle\View\View::create($product); - $serializationContext = SerializationContext::create(); - $serializationContext->setGroups(array('sonata_api_read')); - $serializationContext->enableMaxDepthChecks(); - $view->setSerializationContext($serializationContext); - - return $view; - } - - return $form; - } - /** * Deletes a product. * @@ -465,6 +420,51 @@ public function getProductVariationsAction($id) return $this->getProduct($id)->getVariations(); } + /** + * Write a product, this method is used by both POST and PUT action methods. + * + * @param string $provider A product provider name + * @param Request $request Symfony request + * @param int|null $id A product identifier + * + * @return \FOS\RestBundle\View\View|FormInterface + */ + protected function handleWriteProduct($provider, $request, $id = null) + { + $product = $id ? $this->getProduct($id) : null; + + try { + $manager = $this->productPool->getManager($provider); + } catch (\RuntimeException $e) { + throw new NotFoundHttpException($e->getMessage(), $e); + } + + $form = $this->formFactory->createNamed(null, 'sonata_product_api_form_product', $product, array( + 'csrf_protection' => false, + 'data_class' => $manager->getClass(), + 'provider_name' => $provider, + )); + + $form->bind($request); + + if ($form->isValid()) { + $product = $form->getData(); + $product->setDescription($this->formatterPool->transform($product->getDescriptionFormatter(), $product->getRawDescription())); + $product->setShortDescription($this->formatterPool->transform($product->getShortDescriptionFormatter(), $product->getRawShortDescription())); + $manager->save($product); + + $view = \FOS\RestBundle\View\View::create($product); + $serializationContext = SerializationContext::create(); + $serializationContext->setGroups(array('sonata_api_read')); + $serializationContext->enableMaxDepthChecks(); + $view->setSerializationContext($serializationContext); + + return $view; + } + + return $form; + } + /** * Retrieves product with id $id or throws an exception if it doesn't exist. * diff --git a/src/ProductBundle/Controller/BaseProductController.php b/src/ProductBundle/Controller/BaseProductController.php index 78cc1cea8..5fb092533 100644 --- a/src/ProductBundle/Controller/BaseProductController.php +++ b/src/ProductBundle/Controller/BaseProductController.php @@ -1,7 +1,7 @@ * @@ -50,11 +50,11 @@ public function viewAction($product) return $this->render( sprintf('%s:view.html.twig', $provider->getBaseControllerName()), array( - 'provider' => $provider, - 'product' => $product, + 'provider' => $provider, + 'product' => $product, 'cheapest_variation' => $provider->getCheapestEnabledVariation($product), - 'currency' => $currency, - 'form' => $form, + 'currency' => $currency, + 'form' => $form, ) ); } @@ -87,9 +87,9 @@ public function renderFormBasketElementAction(FormView $formView, BasketElementI $provider = $this->get('sonata.product.pool')->getProvider($basketElement->getProduct()); return $this->render(sprintf('%s:form_basket_element.html.twig', $provider->getBaseControllerName()), array( - 'formView' => $formView, + 'formView' => $formView, 'basketElement' => $basketElement, - 'basket' => $basket, + 'basket' => $basket, )); } @@ -105,7 +105,7 @@ public function renderFinalReviewBasketElementAction(BasketElementInterface $bas return $this->render(sprintf('%s:final_review_basket_element.html.twig', $provider->getBaseControllerName()), array( 'basketElement' => $basketElement, - 'basket' => $basket, + 'basket' => $basket, )); } @@ -158,7 +158,7 @@ public function variationToProductAction(ProductInterface $product, ProductInter $url = $this->generateUrl('sonata_product_view', array( 'productId' => $variation->getId(), - 'slug' => $variation->getSlug(), + 'slug' => $variation->getSlug(), )); if ($this->getRequest()->isXmlHttpRequest()) { diff --git a/src/ProductBundle/Controller/CatalogController.php b/src/ProductBundle/Controller/CatalogController.php index 6a4d23a38..3200540bc 100644 --- a/src/ProductBundle/Controller/CatalogController.php +++ b/src/ProductBundle/Controller/CatalogController.php @@ -1,7 +1,7 @@ * @@ -31,11 +31,11 @@ class CatalogController extends Controller */ public function indexAction() { - $page = $this->getRequest()->get('page', 1); - $displayMax = $this->getRequest()->get('max', 9); + $page = $this->getRequest()->get('page', 1); + $displayMax = $this->getRequest()->get('max', 9); $displayMode = $this->getRequest()->get('mode', 'grid'); - $filter = $this->getRequest()->get('filter'); - $option = $this->getRequest()->get('option'); + $filter = $this->getRequest()->get('filter'); + $option = $this->getRequest()->get('option'); if (!in_array($displayMode, array('grid'))) { // "list" mode will be added later throw new NotFoundHttpException(sprintf('Given display_mode "%s" doesn\'t exist.', $displayMode)); @@ -50,10 +50,10 @@ public function indexAction() return $this->render('SonataProductBundle:Catalog:index.html.twig', array( 'display_mode' => $displayMode, - 'pager' => $pagination, - 'currency' => $this->getCurrencyDetector()->getCurrency(), - 'category' => $category, - 'provider' => $this->getProviderFromCategory($category), + 'pager' => $pagination, + 'currency' => $this->getCurrencyDetector()->getCurrency(), + 'category' => $category, + 'provider' => $this->getProviderFromCategory($category), )); } @@ -64,7 +64,7 @@ public function indexAction() */ protected function retrieveCategoryFromQueryString() { - $categoryId = $this->getRequest()->get('category_id'); + $categoryId = $this->getRequest()->get('category_id'); $categorySlug = $this->getRequest()->get('category_slug'); if (!$categoryId || !$categorySlug) { @@ -72,7 +72,7 @@ protected function retrieveCategoryFromQueryString() } return $this->getCategoryManager()->findOneBy(array( - 'id' => $categoryId, + 'id' => $categoryId, 'enabled' => true, )); } diff --git a/src/ProductBundle/Controller/CategoryAdminController.php b/src/ProductBundle/Controller/CategoryAdminController.php index 7a852fac6..4bae67f11 100644 --- a/src/ProductBundle/Controller/CategoryAdminController.php +++ b/src/ProductBundle/Controller/CategoryAdminController.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Controller/CategoryController.php b/src/ProductBundle/Controller/CategoryController.php index c643b4165..e3ff1fe63 100644 --- a/src/ProductBundle/Controller/CategoryController.php +++ b/src/ProductBundle/Controller/CategoryController.php @@ -1,7 +1,7 @@ * @@ -28,8 +28,8 @@ public function listSideMenuCategoriesAction($category = null, $depth = 1, $deep return $this->render('SonataProductBundle:Category:side_menu_category.html.twig', array( 'root_category' => $category, - 'depth' => $depth, - 'deep' => $deep + 1, + 'depth' => $depth, + 'deep' => $deep + 1, )); } } diff --git a/src/ProductBundle/Controller/CollectionAdminController.php b/src/ProductBundle/Controller/CollectionAdminController.php index 5ec49b1f9..2a22e435c 100644 --- a/src/ProductBundle/Controller/CollectionAdminController.php +++ b/src/ProductBundle/Controller/CollectionAdminController.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Controller/CollectionController.php b/src/ProductBundle/Controller/CollectionController.php index c5c55d5d0..ccea6c14e 100644 --- a/src/ProductBundle/Controller/CollectionController.php +++ b/src/ProductBundle/Controller/CollectionController.php @@ -1,7 +1,7 @@ * @@ -102,8 +102,8 @@ public function listSideMenuCollectionsAction($collection = null, $depth = 1, $d return $this->render('SonataProductBundle:Collection:side_menu_collection.html.twig', array( 'root_collection' => $collection, - 'depth' => $depth, - 'deep' => $deep + 1, + 'depth' => $depth, + 'deep' => $deep + 1, )); } } diff --git a/src/ProductBundle/Controller/ProductAdminController.php b/src/ProductBundle/Controller/ProductAdminController.php index 16a9ae45b..4aba65b79 100644 --- a/src/ProductBundle/Controller/ProductAdminController.php +++ b/src/ProductBundle/Controller/ProductAdminController.php @@ -1,7 +1,7 @@ * @@ -33,10 +33,10 @@ public function createAction(Request $request = null) if (!$parameters['provider']) { return $this->render('SonataProductBundle:ProductAdmin:select_provider.html.twig', array( - 'providers' => $this->get('sonata.product.pool')->getProducts(), + 'providers' => $this->get('sonata.product.pool')->getProducts(), 'base_template' => $this->getBaseTemplate(), - 'admin' => $this->admin, - 'action' => 'create', + 'admin' => $this->admin, + 'action' => 'create', )); } diff --git a/src/ProductBundle/Controller/ProductController.php b/src/ProductBundle/Controller/ProductController.php index e8aad1e21..744eec677 100644 --- a/src/ProductBundle/Controller/ProductController.php +++ b/src/ProductBundle/Controller/ProductController.php @@ -1,7 +1,7 @@ * @@ -54,7 +54,7 @@ public function viewAction($productId, $slug) $action = sprintf('%s:view', $provider->getBaseControllerName()); $response = $this->forward($action, array( 'provider' => $provider, - 'product' => $product, + 'product' => $product, )); if ($this->get('kernel')->isDebug()) { @@ -81,9 +81,9 @@ public function renderFormBasketElementAction(FormView $formView, BasketElementI $action = sprintf('%s:renderFormBasketElement', $basketElement->getProductProvider()->getBaseControllerName()); $response = $this->forward($action, array( - 'formView' => $formView, - 'basketElement' => $basketElement, - 'basket' => $basket, + 'formView' => $formView, + 'basketElement' => $basketElement, + 'basket' => $basket, )); if ($this->get('kernel')->isDebug()) { @@ -139,10 +139,10 @@ public function getPriceStockForQuantityAction($productId) $price = $provider->calculatePrice($product, $currency, true, $quantity); return new JsonResponse(array( - 'stock' => $stock, - 'price' => $price, + 'stock' => $stock, + 'price' => $price, 'price_text' => $this->get('sonata.intl.templating.helper.number')->formatCurrency($price, $currency), - 'errors' => $errors, + 'errors' => $errors, )); } @@ -154,11 +154,11 @@ public function getPriceStockForQuantityAction($productId) */ public function renderFinalReviewBasketElementAction(BasketElementInterface $basketElement, BasketInterface $basket) { - $action = sprintf('%s:renderFinalReviewBasketElement', $basketElement->getProductProvider()->getBaseControllerName()); + $action = sprintf('%s:renderFinalReviewBasketElement', $basketElement->getProductProvider()->getBaseControllerName()); $response = $this->forward($action, array( - 'basketElement' => $basketElement, - 'basket' => $basket, + 'basketElement' => $basketElement, + 'basket' => $basket, )); if ($this->get('kernel')->isDebug()) { @@ -244,7 +244,7 @@ public function variationToProductAction($productId, $slug) $form = $this->createForm('sonata_product_variation_choices', $currentValues, array( 'product' => $product, - 'fields' => array_keys($data), + 'fields' => array_keys($data), )); $form->handleRequest($this->getRequest()); @@ -260,7 +260,7 @@ public function variationToProductAction($productId, $slug) $action = sprintf('%s:variationToProduct', $provider->getBaseControllerName()); $response = $this->forward($action, array( - 'product' => $product, + 'product' => $product, 'variation' => $variation, )); diff --git a/src/ProductBundle/Controller/ProductVariationAdminController.php b/src/ProductBundle/Controller/ProductVariationAdminController.php index bb794a0d7..887222fa7 100644 --- a/src/ProductBundle/Controller/ProductVariationAdminController.php +++ b/src/ProductBundle/Controller/ProductVariationAdminController.php @@ -1,7 +1,7 @@ * @@ -38,9 +38,9 @@ public function createAction(Request $request = null) $form = $this->createFormBuilder(null, array()) ->add('number', 'integer', array( - 'required' => true, - 'label' => $this->getTranslator()->trans('variations_number', array(), 'SonataProductBundle'), - 'attr' => array('min' => 1, 'max' => 10), + 'required' => true, + 'label' => $this->getTranslator()->trans('variations_number', array(), 'SonataProductBundle'), + 'attr' => array('min' => 1, 'max' => 10), 'constraints' => array( new NotBlank(), new Range(array('min' => 1, 'max' => 10)), @@ -57,7 +57,7 @@ public function createAction(Request $request = null) if ($form->isValid()) { $number = $form->get('number')->getData(); - $manager = $this->getProductManager(); + $manager = $this->getProductManager(); $productProvider = $this->getProductPool()->getProvider($product); for ($i = 1; $i <= $number; ++$i) { @@ -82,7 +82,7 @@ public function createAction(Request $request = null) return $this->render('SonataProductBundle:ProductAdmin:create_variation.html.twig', array( 'object' => $product, - 'form' => $form->createView(), + 'form' => $form->createView(), 'action' => 'edit', )); } diff --git a/src/ProductBundle/DependencyInjection/Compiler/AddProductProviderCompilerPass.php b/src/ProductBundle/DependencyInjection/Compiler/AddProductProviderCompilerPass.php index c8942520c..a526da4b2 100644 --- a/src/ProductBundle/DependencyInjection/Compiler/AddProductProviderCompilerPass.php +++ b/src/ProductBundle/DependencyInjection/Compiler/AddProductProviderCompilerPass.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/DependencyInjection/Configuration.php b/src/ProductBundle/DependencyInjection/Configuration.php index 4a2edf329..1f16aee12 100644 --- a/src/ProductBundle/DependencyInjection/Configuration.php +++ b/src/ProductBundle/DependencyInjection/Configuration.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/DependencyInjection/SonataProductExtension.php b/src/ProductBundle/DependencyInjection/SonataProductExtension.php index 19814b469..aa94b29be 100644 --- a/src/ProductBundle/DependencyInjection/SonataProductExtension.php +++ b/src/ProductBundle/DependencyInjection/SonataProductExtension.php @@ -1,7 +1,7 @@ * @@ -104,18 +104,18 @@ public function registerDoctrineMapping(array $config) * DELIVERY */ $collector->addAssociation($config['class']['delivery'], 'mapManyToOne', array( - 'fieldName' => 'product', + 'fieldName' => 'product', 'targetEntity' => $config['class']['product'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'inversedBy' => 'deliveries', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'deliveries', + 'joinColumns' => array( array( - 'name' => 'product_id', + 'name' => 'product_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', + 'onDelete' => 'CASCADE', ), ), 'orphanRemoval' => false, @@ -125,18 +125,18 @@ public function registerDoctrineMapping(array $config) * PACKAGE */ $collector->addAssociation($config['class']['package'], 'mapManyToOne', array( - 'fieldName' => 'product', + 'fieldName' => 'product', 'targetEntity' => $config['class']['product'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'inversedBy' => 'packages', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'packages', + 'joinColumns' => array( array( - 'name' => 'product_id', + 'name' => 'product_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', + 'onDelete' => 'CASCADE', ), ), 'orphanRemoval' => false, @@ -146,37 +146,37 @@ public function registerDoctrineMapping(array $config) * PRODUCT CATEGORY */ $collector->addAssociation($config['class']['product_category'], 'mapManyToOne', array( - 'fieldName' => 'product', + 'fieldName' => 'product', 'targetEntity' => $config['class']['product'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'inversedBy' => 'productCategories', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'productCategories', + 'joinColumns' => array( array( - 'name' => 'product_id', + 'name' => 'product_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE', + 'onDelete' => 'CASCADE', + 'onUpdate' => 'CASCADE', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product_category'], 'mapManyToOne', array( - 'fieldName' => 'category', + 'fieldName' => 'category', 'targetEntity' => $config['class']['category'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'joinColumns' => array( + 'mappedBy' => null, + 'joinColumns' => array( array( - 'name' => 'category_id', + 'name' => 'category_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE', + 'onDelete' => 'CASCADE', + 'onUpdate' => 'CASCADE', ), ), 'orphanRemoval' => false, @@ -186,38 +186,38 @@ public function registerDoctrineMapping(array $config) * PRODUCT COLLECTION */ $collector->addAssociation($config['class']['product_collection'], 'mapManyToOne', array( - 'fieldName' => 'product', + 'fieldName' => 'product', 'targetEntity' => $config['class']['product'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'inversedBy' => 'productCollections', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'productCollections', + 'joinColumns' => array( array( - 'name' => 'product_id', + 'name' => 'product_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE', + 'onDelete' => 'CASCADE', + 'onUpdate' => 'CASCADE', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product_collection'], 'mapManyToOne', array( - 'fieldName' => 'collection', + 'fieldName' => 'collection', 'targetEntity' => $config['class']['collection'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'inversedBy' => 'productCollection', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'productCollection', + 'joinColumns' => array( array( - 'name' => 'collection_id', + 'name' => 'collection_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', - 'onUpdate' => 'CASCADE', + 'onDelete' => 'CASCADE', + 'onUpdate' => 'CASCADE', ), ), 'orphanRemoval' => false, @@ -227,102 +227,102 @@ public function registerDoctrineMapping(array $config) * PRODUCT */ $collector->addAssociation($config['class']['product'], 'mapOneToMany', array( - 'fieldName' => 'packages', - 'targetEntity' => $config['class']['package'], - 'cascade' => array( + 'fieldName' => 'packages', + 'targetEntity' => $config['class']['package'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'product', + 'mappedBy' => 'product', 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product'], 'mapOneToMany', array( - 'fieldName' => 'deliveries', - 'targetEntity' => $config['class']['delivery'], - 'cascade' => array( + 'fieldName' => 'deliveries', + 'targetEntity' => $config['class']['delivery'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'product', + 'mappedBy' => 'product', 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product'], 'mapOneToMany', array( - 'fieldName' => 'productCategories', - 'targetEntity' => $config['class']['product_category'], - 'cascade' => array( + 'fieldName' => 'productCategories', + 'targetEntity' => $config['class']['product_category'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'product', + 'mappedBy' => 'product', 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product'], 'mapOneToMany', array( - 'fieldName' => 'productCollections', - 'targetEntity' => $config['class']['product_collection'], - 'cascade' => array( + 'fieldName' => 'productCollections', + 'targetEntity' => $config['class']['product_collection'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'product', + 'mappedBy' => 'product', 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product'], 'mapManyToOne', array( - 'fieldName' => 'image', - 'targetEntity' => $config['class']['media'], - 'cascade' => array(), - 'mappedBy' => null, - 'inversedBy' => null, - 'joinColumns' => array( + 'fieldName' => 'image', + 'targetEntity' => $config['class']['media'], + 'cascade' => array(), + 'mappedBy' => null, + 'inversedBy' => null, + 'joinColumns' => array( array( - 'name' => 'image_id', + 'name' => 'image_id', 'referencedColumnName' => 'id', - 'onDelete' => 'SET NULL', + 'onDelete' => 'SET NULL', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product'], 'mapManyToOne', array( - 'fieldName' => 'gallery', - 'targetEntity' => $config['class']['gallery'], - 'cascade' => array(), - 'mappedBy' => null, - 'inversedBy' => null, - 'joinColumns' => array( + 'fieldName' => 'gallery', + 'targetEntity' => $config['class']['gallery'], + 'cascade' => array(), + 'mappedBy' => null, + 'inversedBy' => null, + 'joinColumns' => array( array( - 'name' => 'gallery_id', + 'name' => 'gallery_id', 'referencedColumnName' => 'id', - 'onDelete' => 'SET NULL', + 'onDelete' => 'SET NULL', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product'], 'mapManyToOne', array( - 'fieldName' => 'parent', + 'fieldName' => 'parent', 'targetEntity' => $config['class']['product'], - 'cascade' => array( + 'cascade' => array( 'persist', ), - 'mappedBy' => null, - 'inversedBy' => 'variations', - 'joinColumns' => array( + 'mappedBy' => null, + 'inversedBy' => 'variations', + 'joinColumns' => array( array( - 'name' => 'parent_id', + 'name' => 'parent_id', 'referencedColumnName' => 'id', - 'onDelete' => 'CASCADE', + 'onDelete' => 'CASCADE', ), ), 'orphanRemoval' => false, )); $collector->addAssociation($config['class']['product'], 'mapOneToMany', array( - 'fieldName' => 'variations', - 'targetEntity' => $config['class']['product'], - 'cascade' => array( + 'fieldName' => 'variations', + 'targetEntity' => $config['class']['product'], + 'cascade' => array( 'persist', ), - 'mappedBy' => 'parent', + 'mappedBy' => 'parent', 'orphanRemoval' => false, )); diff --git a/src/ProductBundle/Entity/BaseDelivery.php b/src/ProductBundle/Entity/BaseDelivery.php index b20d52ec0..a2f27d485 100644 --- a/src/ProductBundle/Entity/BaseDelivery.php +++ b/src/ProductBundle/Entity/BaseDelivery.php @@ -1,7 +1,7 @@ * @@ -60,6 +60,18 @@ abstract class BaseDelivery implements DeliveryInterface */ protected $product; + /** + * @return string + */ + public function __toString() + { + return sprintf('%s-%s%s', + $this->getCode(), + $this->getCountryCode(), + $this->getZone() ? sprintf('%s', $this->getZone()) : '' + ); + } + /** * Set productId. * @@ -255,23 +267,11 @@ public static function getValidationStatusList() public function toArray() { return array( - 'code' => $this->code, - 'perItem' => $this->perItem, + 'code' => $this->code, + 'perItem' => $this->perItem, 'countryCode' => $this->countryCode, - 'zone' => $this->zone, - 'enabled' => $this->enabled, - ); - } - - /** - * @return string - */ - public function __toString() - { - return sprintf('%s-%s%s', - $this->getCode(), - $this->getCountryCode(), - $this->getZone() ? sprintf('%s', $this->getZone()) : '' + 'zone' => $this->zone, + 'enabled' => $this->enabled, ); } diff --git a/src/ProductBundle/Entity/BasePackage.php b/src/ProductBundle/Entity/BasePackage.php index ec6474689..1270c7843 100644 --- a/src/ProductBundle/Entity/BasePackage.php +++ b/src/ProductBundle/Entity/BasePackage.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Entity/BaseProduct.php b/src/ProductBundle/Entity/BaseProduct.php index 0e6111f41..f15d31eec 100644 --- a/src/ProductBundle/Entity/BaseProduct.php +++ b/src/ProductBundle/Entity/BaseProduct.php @@ -1,7 +1,7 @@ * @@ -162,12 +162,20 @@ abstract class BaseProduct implements ProductInterface */ public function __construct() { - $this->packages = new ArrayCollection(); - $this->deliveries = new ArrayCollection(); - $this->productCategories = new ArrayCollection(); + $this->packages = new ArrayCollection(); + $this->deliveries = new ArrayCollection(); + $this->productCategories = new ArrayCollection(); $this->productCollections = new ArrayCollection(); - $this->variations = new ArrayCollection(); - $this->enabledVariations = new ArrayCollection(); + $this->variations = new ArrayCollection(); + $this->enabledVariations = new ArrayCollection(); + } + + /** + * {@inheritdoc} + */ + public function __toString() + { + return (string) $this->getName(); } /** @@ -774,14 +782,6 @@ public function setOptions(array $options) $this->options = $options; } - /** - * {@inheritdoc} - */ - public function __toString() - { - return (string) $this->getName(); - } - /** * {@inheritdoc} */ @@ -891,20 +891,20 @@ public static function slugify($text) public function toArray() { $baseArrayRep = array( - 'sku' => $this->sku, - 'slug' => $this->slug, - 'name' => $this->name, - 'description' => $this->description, - 'rawDescription' => $this->rawDescription, - 'descriptionFormatter' => $this->descriptionFormatter, - 'shortDescription' => $this->shortDescription, - 'rawShortDescription' => $this->rawShortDescription, + 'sku' => $this->sku, + 'slug' => $this->slug, + 'name' => $this->name, + 'description' => $this->description, + 'rawDescription' => $this->rawDescription, + 'descriptionFormatter' => $this->descriptionFormatter, + 'shortDescription' => $this->shortDescription, + 'rawShortDescription' => $this->rawShortDescription, 'shortDescriptionFormatter' => $this->shortDescriptionFormatter, - 'price' => $this->price, - 'vatRate' => $this->vatRate, - 'stock' => $this->stock, - 'enabled' => $this->enabled, - 'options' => $this->options, + 'price' => $this->price, + 'vatRate' => $this->vatRate, + 'stock' => $this->stock, + 'enabled' => $this->enabled, + 'options' => $this->options, ); return $baseArrayRep; diff --git a/src/ProductBundle/Entity/BaseProductCategory.php b/src/ProductBundle/Entity/BaseProductCategory.php index df7111dc1..fbdade961 100644 --- a/src/ProductBundle/Entity/BaseProductCategory.php +++ b/src/ProductBundle/Entity/BaseProductCategory.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Entity/BaseProductCollection.php b/src/ProductBundle/Entity/BaseProductCollection.php index bf8f79841..89ce3a397 100644 --- a/src/ProductBundle/Entity/BaseProductCollection.php +++ b/src/ProductBundle/Entity/BaseProductCollection.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Entity/DeliveryManager.php b/src/ProductBundle/Entity/DeliveryManager.php index 347bb0027..21912c966 100644 --- a/src/ProductBundle/Entity/DeliveryManager.php +++ b/src/ProductBundle/Entity/DeliveryManager.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Entity/PackageManager.php b/src/ProductBundle/Entity/PackageManager.php index e1806211a..1b0e63dda 100644 --- a/src/ProductBundle/Entity/PackageManager.php +++ b/src/ProductBundle/Entity/PackageManager.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Entity/ProductCategoryManager.php b/src/ProductBundle/Entity/ProductCategoryManager.php index bec87aa51..6652b4e5a 100644 --- a/src/ProductBundle/Entity/ProductCategoryManager.php +++ b/src/ProductBundle/Entity/ProductCategoryManager.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Entity/ProductCollectionManager.php b/src/ProductBundle/Entity/ProductCollectionManager.php index 2abec73b6..c81968150 100644 --- a/src/ProductBundle/Entity/ProductCollectionManager.php +++ b/src/ProductBundle/Entity/ProductCollectionManager.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Entity/ProductManager.php b/src/ProductBundle/Entity/ProductManager.php index 473020fc7..78ef98569 100644 --- a/src/ProductBundle/Entity/ProductManager.php +++ b/src/ProductBundle/Entity/ProductManager.php @@ -1,7 +1,7 @@ * @@ -98,68 +98,12 @@ public function findEnabledFromIdAndSlug($id, $slug) { return $this->getRepository() ->findOneBy(array( - 'id' => $id, - 'slug' => $slug, + 'id' => $id, + 'slug' => $slug, 'enabled' => true, )); } - /** - * Returns QueryBuilder for products. - * - * @param CategoryInterface $category - * - * @return QueryBuilder - */ - protected function getCategoryProductsQueryBuilder(CategoryInterface $category = null) - { - $queryBuilder = $this->getRepository()->createQueryBuilder('p') - ->leftJoin('p.image', 'i') - ->leftJoin('p.gallery', 'g'); - - if ($category) { - $queryBuilder - ->leftJoin('p.productCategories', 'pc') - ->andWhere('pc.category = :categoryId') - ->setParameter('categoryId', $category->getId()); - } - - return $queryBuilder; - } - - /** - * @param array $productCollections - * @param null|int $limit - * - * @return \Doctrine\ORM\QueryBuilder - */ - protected function queryInSameCollections($productCollections, $limit = null) - { - $collections = array(); - $productIds = array(); - - foreach ($productCollections as $pCollection) { - $collections[] = $pCollection->getCollection(); - if (false === array_search($pCollection->getProduct()->getId(), $productIds)) { - $productIds[] = $pCollection->getProduct()->getId(); - } - } - - $queryBuilder = $this->getRepository()->createQueryBuilder('p') - ->distinct() - ->leftJoin('p.productCollections', 'pc') - ->where('pc.collection IN (:collections)') - ->andWhere('p.id NOT IN (:productIds)') - ->setParameter('collections', array_values($collections)) - ->setParameter('productIds', array_values($productIds)); - - if (null !== $limit) { - $queryBuilder->setMaxResults($limit); - } - - return $queryBuilder; - } - /** * {@inheritdoc} */ @@ -232,4 +176,60 @@ public function getPager(array $criteria, $page, $limit = 10, array $sort = arra return $pager; } + + /** + * Returns QueryBuilder for products. + * + * @param CategoryInterface $category + * + * @return QueryBuilder + */ + protected function getCategoryProductsQueryBuilder(CategoryInterface $category = null) + { + $queryBuilder = $this->getRepository()->createQueryBuilder('p') + ->leftJoin('p.image', 'i') + ->leftJoin('p.gallery', 'g'); + + if ($category) { + $queryBuilder + ->leftJoin('p.productCategories', 'pc') + ->andWhere('pc.category = :categoryId') + ->setParameter('categoryId', $category->getId()); + } + + return $queryBuilder; + } + + /** + * @param array $productCollections + * @param null|int $limit + * + * @return \Doctrine\ORM\QueryBuilder + */ + protected function queryInSameCollections($productCollections, $limit = null) + { + $collections = array(); + $productIds = array(); + + foreach ($productCollections as $pCollection) { + $collections[] = $pCollection->getCollection(); + if (false === array_search($pCollection->getProduct()->getId(), $productIds)) { + $productIds[] = $pCollection->getProduct()->getId(); + } + } + + $queryBuilder = $this->getRepository()->createQueryBuilder('p') + ->distinct() + ->leftJoin('p.productCollections', 'pc') + ->where('pc.collection IN (:collections)') + ->andWhere('p.id NOT IN (:productIds)') + ->setParameter('collections', array_values($collections)) + ->setParameter('productIds', array_values($productIds)); + + if (null !== $limit) { + $queryBuilder->setMaxResults($limit); + } + + return $queryBuilder; + } } diff --git a/src/ProductBundle/Entity/ProductSetManager.php b/src/ProductBundle/Entity/ProductSetManager.php index ed597e53e..34edbcaac 100644 --- a/src/ProductBundle/Entity/ProductSetManager.php +++ b/src/ProductBundle/Entity/ProductSetManager.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Form/Type/ApiProductParentType.php b/src/ProductBundle/Form/Type/ApiProductParentType.php index bc7ca34b9..e958c8ba4 100644 --- a/src/ProductBundle/Form/Type/ApiProductParentType.php +++ b/src/ProductBundle/Form/Type/ApiProductParentType.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Form/Type/ApiProductType.php b/src/ProductBundle/Form/Type/ApiProductType.php index 4b29ce70a..82b961c2a 100644 --- a/src/ProductBundle/Form/Type/ApiProductType.php +++ b/src/ProductBundle/Form/Type/ApiProductType.php @@ -1,7 +1,7 @@ * @@ -55,9 +55,9 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'data_class' => null, + 'data_class' => null, 'csrf_protection' => false, - 'provider_name' => null, + 'provider_name' => null, )); } diff --git a/src/ProductBundle/Form/Type/ProductDeliveryStatusType.php b/src/ProductBundle/Form/Type/ProductDeliveryStatusType.php index bf04d5d5b..85c11a3a1 100644 --- a/src/ProductBundle/Form/Type/ProductDeliveryStatusType.php +++ b/src/ProductBundle/Form/Type/ProductDeliveryStatusType.php @@ -1,13 +1,12 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. - * */ namespace Sonata\ProductBundle\Form\Type; diff --git a/src/ProductBundle/Menu/ProductMenuBuilder.php b/src/ProductBundle/Menu/ProductMenuBuilder.php index b86888385..af98d4b36 100644 --- a/src/ProductBundle/Menu/ProductMenuBuilder.php +++ b/src/ProductBundle/Menu/ProductMenuBuilder.php @@ -1,7 +1,7 @@ * @@ -51,9 +51,9 @@ class ProductMenuBuilder */ public function __construct(FactoryInterface $factory, ProductCategoryManagerInterface $categoryManager, RouterInterface $router) { - $this->factory = $factory; + $this->factory = $factory; $this->categoryManager = $categoryManager; - $this->router = $router; + $this->router = $router; } /** @@ -157,13 +157,13 @@ protected function fillMenu(ItemInterface $menu, $categories, array $options = a } $fullOptions = array_merge(array( - 'attributes' => array('class' => ''), // Ensuring it is set - 'route' => 'sonata_catalog_category', + 'attributes' => array('class' => ''), // Ensuring it is set + 'route' => 'sonata_catalog_category', 'routeParameters' => array( - 'category_id' => $category->getId(), + 'category_id' => $category->getId(), 'category_slug' => $category->getSlug(), ), - 'extras' => array( + 'extras' => array( 'safe_label' => true, ), ), $options); diff --git a/src/ProductBundle/Model/BaseProductProvider.php b/src/ProductBundle/Model/BaseProductProvider.php index c5a995eaf..21015840e 100644 --- a/src/ProductBundle/Model/BaseProductProvider.php +++ b/src/ProductBundle/Model/BaseProductProvider.php @@ -1,7 +1,7 @@ * @@ -46,12 +46,12 @@ abstract class BaseProductProvider implements ProductProviderInterface /** * @var array */ - protected $options = array(); + protected $options = array(); /** * @var array */ - protected $variationFields = array(); + protected $variationFields = array(); /** * @var string @@ -467,21 +467,21 @@ public function buildEditForm(FormMapper $formMapper, $isVariation = false) if (!$isVariation || in_array('description', $this->variationFields)) { $formMapper->add('description', 'sonata_formatter_type', array( - 'source_field' => 'rawDescription', + 'source_field' => 'rawDescription', 'source_field_options' => array('attr' => array('class' => 'span10', 'rows' => 20)), - 'format_field' => 'descriptionFormatter', - 'target_field' => 'description', - 'event_dispatcher' => $formMapper->getFormBuilder()->getEventDispatcher(), + 'format_field' => 'descriptionFormatter', + 'target_field' => 'description', + 'event_dispatcher' => $formMapper->getFormBuilder()->getEventDispatcher(), )); } if (!$isVariation || in_array('short_description', $this->variationFields)) { $formMapper->add('shortDescription', 'sonata_formatter_type', array( - 'source_field' => 'rawShortDescription', + 'source_field' => 'rawShortDescription', 'source_field_options' => array('attr' => array('class' => 'span10', 'rows' => 20)), - 'format_field' => 'shortDescriptionFormatter', - 'target_field' => 'shortDescription', - 'event_dispatcher' => $formMapper->getFormBuilder()->getEventDispatcher(), + 'format_field' => 'shortDescriptionFormatter', + 'target_field' => 'shortDescription', + 'event_dispatcher' => $formMapper->getFormBuilder()->getEventDispatcher(), )); } @@ -495,8 +495,8 @@ public function buildEditForm(FormMapper $formMapper, $isVariation = false) 'required' => false, ), array( 'link_parameters' => array( - 'context' => 'product_catalog', - 'filter' => array('context' => array('value' => 'product_catalog')), + 'context' => 'product_catalog', + 'filter' => array('context' => array('value' => 'product_catalog')), 'provider' => '', ), )); @@ -507,8 +507,8 @@ public function buildEditForm(FormMapper $formMapper, $isVariation = false) 'required' => false, ), array( 'link_parameters' => array( - 'context' => 'product_catalog', - 'filter' => array('context' => array('value' => 'product_catalog')), + 'context' => 'product_catalog', + 'filter' => array('context' => array('value' => 'product_catalog')), 'provider' => '', ), )); @@ -877,8 +877,8 @@ public function validateFormBasketElement(ErrorElement $errorElement, BasketElem ->with('quantity') ->assertRange( array( - 'min' => 1, - 'max' => $this->getStockAvailable($basketElement->getProduct()), + 'min' => 1, + 'max' => $this->getStockAvailable($basketElement->getProduct()), 'minMessage' => 'basket_quantity_limit_min', 'maxMessage' => 'basket_quantity_limit_max', ) @@ -1002,7 +1002,7 @@ public function calculatePrice(ProductInterface $product, CurrencyInterface $cur $event = new BeforeCalculatePriceEvent($product, $currency, $vat, $quantity); $this->getEventDispatcher()->dispatch(BasketEvents::PRE_CALCULATE_PRICE, $event); - $vat = $event->getVat(); + $vat = $event->getVat(); $quantity = $event->getQuantity(); if (!is_int($quantity) || $quantity < 1) { @@ -1129,6 +1129,14 @@ public function getFilters() ); } + /** + * {@inheritdoc} + */ + public function updateStock($product, ProductManagerInterface $productManager, $diff) + { + $productManager->updateStock($product, $diff); + } + /** * Checks $fields if specified, returns variation fields otherwise. * @@ -1153,12 +1161,4 @@ protected function getMergedFields(array $fields) return $fields; } - - /** - * {@inheritdoc} - */ - public function updateStock($product, ProductManagerInterface $productManager, $diff) - { - $productManager->updateStock($product, $diff); - } } diff --git a/src/ProductBundle/Model/DoctrineModelManager.php b/src/ProductBundle/Model/DoctrineModelManager.php index 985655b89..69023e66a 100644 --- a/src/ProductBundle/Model/DoctrineModelManager.php +++ b/src/ProductBundle/Model/DoctrineModelManager.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Repository/BaseProductRepository.php b/src/ProductBundle/Repository/BaseProductRepository.php index f9779d551..3c0d69390 100644 --- a/src/ProductBundle/Repository/BaseProductRepository.php +++ b/src/ProductBundle/Repository/BaseProductRepository.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/Seo/Services/Facebook.php b/src/ProductBundle/Seo/Services/Facebook.php index 65add82d4..ca31618ca 100644 --- a/src/ProductBundle/Seo/Services/Facebook.php +++ b/src/ProductBundle/Seo/Services/Facebook.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\ProductBundle\Seo\Services; use Sonata\Component\Currency\CurrencyDetectorInterface; @@ -58,7 +67,7 @@ class Facebook implements ServiceInterface */ public function __construct(RouterInterface $router, Pool $mediaPool, NumberHelper $numberHelper, CurrencyDetectorInterface $currencyDetector, $domain, $mediaFormat) { - $this->router = $router; + $this->router = $router; $this->mediaPool = $mediaPool; $this->numberHelper = $numberHelper; $this->currencyDetector = $currencyDetector; @@ -78,7 +87,7 @@ public function alterPage(SeoPageInterface $seoPage, ProductInterface $product) ->addMeta('property', 'og:title', $product->getName()) ->addMeta('property', 'og:description', $product->getDescription()) ->addMeta('property', 'og:url', $this->router->generate('sonata_product_view', array( - 'slug' => $product->getSlug(), + 'slug' => $product->getSlug(), 'productId' => $product->getId(), ), UrlGeneratorInterface::ABSOLUTE_URL)) ->addMeta('property', 'product:price:amount', $this->numberHelper->formatDecimal($product->getPrice())) diff --git a/src/ProductBundle/Seo/Services/ServiceInterface.php b/src/ProductBundle/Seo/Services/ServiceInterface.php index d8c4cf14e..425aa714b 100644 --- a/src/ProductBundle/Seo/Services/ServiceInterface.php +++ b/src/ProductBundle/Seo/Services/ServiceInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\ProductBundle\Seo\Services; use Sonata\Component\Product\ProductInterface; diff --git a/src/ProductBundle/Seo/Services/Twitter.php b/src/ProductBundle/Seo/Services/Twitter.php index 4caf49c27..e2ebfbdb7 100644 --- a/src/ProductBundle/Seo/Services/Twitter.php +++ b/src/ProductBundle/Seo/Services/Twitter.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\ProductBundle\Seo\Services; use Sonata\Component\Currency\CurrencyDetectorInterface; diff --git a/src/ProductBundle/Serializer/ProductSerializerHandler.php b/src/ProductBundle/Serializer/ProductSerializerHandler.php index 13a218635..f2f2f0f85 100644 --- a/src/ProductBundle/Serializer/ProductSerializerHandler.php +++ b/src/ProductBundle/Serializer/ProductSerializerHandler.php @@ -1,7 +1,7 @@ * diff --git a/src/ProductBundle/SonataProductBundle.php b/src/ProductBundle/SonataProductBundle.php index de398dc0b..3529ff3f1 100644 --- a/src/ProductBundle/SonataProductBundle.php +++ b/src/ProductBundle/SonataProductBundle.php @@ -1,7 +1,7 @@ * @@ -42,11 +42,11 @@ public function boot() public function registerFormMapping() { FormHelper::registerFormTypeMapping(array( - 'sonata_product_delivery_status' => 'Sonata\ProductBundle\Form\Type\ProductDeliveryStatusType', - 'sonata_product_variation_choices' => 'Sonata\Component\Form\Type\VariationChoiceType', + 'sonata_product_delivery_status' => 'Sonata\ProductBundle\Form\Type\ProductDeliveryStatusType', + 'sonata_product_variation_choices' => 'Sonata\Component\Form\Type\VariationChoiceType', 'sonata_product_api_form_product_parent' => 'Sonata\CoreBundle\Form\Type\DoctrineORMSerializationType', - 'sonata_product_api_form_product' => 'Sonata\ProductBundle\Form\Type\ApiProductType', - 'sonata_currency' => 'Sonata\Component\Currency\CurrencyFormType', + 'sonata_product_api_form_product' => 'Sonata\ProductBundle\Form\Type\ApiProductType', + 'sonata_currency' => 'Sonata\Component\Currency\CurrencyFormType', )); } } diff --git a/src/ProductBundle/Twig/Extension/ProductExtension.php b/src/ProductBundle/Twig/Extension/ProductExtension.php index 9764777ae..2697f35c6 100644 --- a/src/ProductBundle/Twig/Extension/ProductExtension.php +++ b/src/ProductBundle/Twig/Extension/ProductExtension.php @@ -1,7 +1,7 @@ * @@ -58,14 +58,14 @@ public function __construct(ProductPool $productPool, FormFactoryInterface $form public function getFunctions() { return array( - new \Twig_SimpleFunction('sonata_product_provider', array($this, 'getProductProvider')), - new \Twig_SimpleFunction('sonata_product_has_variations', array($this, 'hasVariations')), - new \Twig_SimpleFunction('sonata_product_has_enabled_variations', array($this, 'hasEnabledVariations')), - new \Twig_SimpleFunction('sonata_product_cheapest_variation', array($this, 'getCheapestEnabledVariation')), + new \Twig_SimpleFunction('sonata_product_provider', array($this, 'getProductProvider')), + new \Twig_SimpleFunction('sonata_product_has_variations', array($this, 'hasVariations')), + new \Twig_SimpleFunction('sonata_product_has_enabled_variations', array($this, 'hasEnabledVariations')), + new \Twig_SimpleFunction('sonata_product_cheapest_variation', array($this, 'getCheapestEnabledVariation')), new \Twig_SimpleFunction('sonata_product_cheapest_variation_price', array($this, 'getCheapestEnabledVariationPrice')), - new \Twig_SimpleFunction('sonata_product_price', array($this, 'getProductPrice')), - new \Twig_SimpleFunction('sonata_product_stock', array($this, 'getProductStock')), - new \Twig_SimpleFunction('sonata_product_form_add_basket', array($this, 'getFormAddBasket')), + new \Twig_SimpleFunction('sonata_product_price', array($this, 'getProductPrice')), + new \Twig_SimpleFunction('sonata_product_stock', array($this, 'getProductStock')), + new \Twig_SimpleFunction('sonata_product_form_add_basket', array($this, 'getFormAddBasket')), ); } @@ -169,7 +169,7 @@ public function getProductStock(ProductInterface $product) public function getFormAddBasket(ProductInterface $product) { $formBuilder = $this->formFactory->createNamedBuilder('add_basket', 'form', null, array( - 'data_class' => $this->basketElementClass, + 'data_class' => $this->basketElementClass, 'csrf_protection' => false, )); diff --git a/tests/BasketBundle/Block/BasketBlockServiceTest.php b/tests/BasketBundle/Block/BasketBlockServiceTest.php index 568e94fa2..c4ac82ecf 100644 --- a/tests/BasketBundle/Block/BasketBlockServiceTest.php +++ b/tests/BasketBundle/Block/BasketBlockServiceTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/BasketBundle/Controller/Api/BasketControllerTest.php b/tests/BasketBundle/Controller/Api/BasketControllerTest.php index 05353fe0a..817db9d4e 100644 --- a/tests/BasketBundle/Controller/Api/BasketControllerTest.php +++ b/tests/BasketBundle/Controller/Api/BasketControllerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/BasketBundle/Entity/BaseBasketTest.php b/tests/BasketBundle/Entity/BaseBasketTest.php index a6604a87c..859022e17 100644 --- a/tests/BasketBundle/Entity/BaseBasketTest.php +++ b/tests/BasketBundle/Entity/BaseBasketTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/BasketBundle/Entity/BasketElementTest.php b/tests/BasketBundle/Entity/BasketElementTest.php index 0f2af7d08..73c85fb91 100644 --- a/tests/BasketBundle/Entity/BasketElementTest.php +++ b/tests/BasketBundle/Entity/BasketElementTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/BasketBundle/Form/ApiBasketElementTypeTest.php b/tests/BasketBundle/Form/ApiBasketElementTypeTest.php index c23f3b1f1..5e199f522 100644 --- a/tests/BasketBundle/Form/ApiBasketElementTypeTest.php +++ b/tests/BasketBundle/Form/ApiBasketElementTypeTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/BasketBundle/Form/ApiBasketTypeTest.php b/tests/BasketBundle/Form/ApiBasketTypeTest.php index 6410c2f26..72d80008d 100644 --- a/tests/BasketBundle/Form/ApiBasketTypeTest.php +++ b/tests/BasketBundle/Form/ApiBasketTypeTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/BasketBundle/Resources/XliffTest.php b/tests/BasketBundle/Resources/XliffTest.php index 0ac69dbf3..500b822fc 100644 --- a/tests/BasketBundle/Resources/XliffTest.php +++ b/tests/BasketBundle/Resources/XliffTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/Address.php b/tests/Component/Basket/Address.php index db9269172..9a9b53082 100644 --- a/tests/Component/Basket/Address.php +++ b/tests/Component/Basket/Address.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/BaseBasketFactoryTest.php b/tests/Component/Basket/BaseBasketFactoryTest.php index ca4f70515..a369acbb7 100644 --- a/tests/Component/Basket/BaseBasketFactoryTest.php +++ b/tests/Component/Basket/BaseBasketFactoryTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/BasketBuilderTest.php b/tests/Component/Basket/BasketBuilderTest.php index c0d44e451..259bd5480 100644 --- a/tests/Component/Basket/BasketBuilderTest.php +++ b/tests/Component/Basket/BasketBuilderTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/BasketElementManagerTest.php b/tests/Component/Basket/BasketElementManagerTest.php index 63dfd0a6d..345d80e3e 100644 --- a/tests/Component/Basket/BasketElementManagerTest.php +++ b/tests/Component/Basket/BasketElementManagerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/BasketElementTest.php b/tests/Component/Basket/BasketElementTest.php index 9864f96e7..4123b1933 100644 --- a/tests/Component/Basket/BasketElementTest.php +++ b/tests/Component/Basket/BasketElementTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/BasketEntityFactoryTest.php b/tests/Component/Basket/BasketEntityFactoryTest.php index ee2130595..84098c585 100644 --- a/tests/Component/Basket/BasketEntityFactoryTest.php +++ b/tests/Component/Basket/BasketEntityFactoryTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/BasketManagerTest.php b/tests/Component/Basket/BasketManagerTest.php index d0d1ae369..3413e95b4 100644 --- a/tests/Component/Basket/BasketManagerTest.php +++ b/tests/Component/Basket/BasketManagerTest.php @@ -1,7 +1,7 @@ * @@ -83,23 +83,6 @@ public function testDelete() $basketMgr->delete($basket); } - protected function getBasketManager($qbCallback) - { - if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { - $this->markTestSkipped('Not compatible with PHPUnit 5.'); - } - - $em = EntityManagerMockFactory::create($this, $qbCallback, array( - 'id', - 'locale', - )); - - $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); - $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); - - return new BasketManager('Sonata\BasketBundle\Entity\BaseBasket', $registry); - } - public function testGetPager() { $self = $this; @@ -122,7 +105,8 @@ public function testGetPagerWithInvalidSort() { $self = $this; $this - ->getBasketManager(function ($qb) use ($self) {}) + ->getBasketManager(function ($qb) use ($self) { + }) ->getPager(array(), 1, 10, array('invalid' => 'ASC')); } @@ -144,8 +128,25 @@ public function testGetPagerWithMultipleSort() ); }) ->getPager(array(), 1, 10, array( - 'id' => 'ASC', - 'locale' => 'DESC', + 'id' => 'ASC', + 'locale' => 'DESC', )); } + + protected function getBasketManager($qbCallback) + { + if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { + $this->markTestSkipped('Not compatible with PHPUnit 5.'); + } + + $em = EntityManagerMockFactory::create($this, $qbCallback, array( + 'id', + 'locale', + )); + + $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); + $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); + + return new BasketManager('Sonata\BasketBundle\Entity\BaseBasket', $registry); + } } diff --git a/tests/Component/Basket/BasketSessionFactoryTest.php b/tests/Component/Basket/BasketSessionFactoryTest.php index bac6ceb34..16f66e610 100644 --- a/tests/Component/Basket/BasketSessionFactoryTest.php +++ b/tests/Component/Basket/BasketSessionFactoryTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/BasketTest.php b/tests/Component/Basket/BasketTest.php index 49d91f0ef..94e42c348 100644 --- a/tests/Component/Basket/BasketTest.php +++ b/tests/Component/Basket/BasketTest.php @@ -1,7 +1,7 @@ * @@ -149,7 +149,7 @@ public function testTotal() $this->assertEquals(150, $basket->getTotal(false), '::getTotal() - return 150'); $this->assertEquals(179.400, $basket->getTotal(true), '::getTotal() w/o vat return 179.40'); - $this->assertEquals(29.400, $basket->getVatAmount(), '::getVatAmount() w/o vat return 29.4'); + $this->assertEquals(29.400, $basket->getVatAmount(), '::getVatAmount() w/o vat return 29.4'); } public function testBasket() diff --git a/tests/Component/Basket/Delivery.php b/tests/Component/Basket/Delivery.php index 19d633832..7d3ead4fc 100644 --- a/tests/Component/Basket/Delivery.php +++ b/tests/Component/Basket/Delivery.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/LoaderTest.php b/tests/Component/Basket/LoaderTest.php index 89730a6e6..83c34b33c 100644 --- a/tests/Component/Basket/LoaderTest.php +++ b/tests/Component/Basket/LoaderTest.php @@ -1,7 +1,7 @@ * @@ -17,9 +17,9 @@ class LoaderTest extends \PHPUnit_Framework_TestCase { public function testLoadBasket() { - $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); - $basket = $this->getMock('Sonata\Component\Basket\BasketInterface'); - $basketFactory = $this->getMock('Sonata\Component\Basket\BasketFactoryInterface'); + $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); + $basket = $this->getMock('Sonata\Component\Basket\BasketInterface'); + $basketFactory = $this->getMock('Sonata\Component\Basket\BasketFactoryInterface'); $basketFactory->expects($this->once())->method('load')->will($this->returnValue($basket)); $customerSelector = $this->getMock('Sonata\Component\Customer\CustomerSelectorInterface'); @@ -37,8 +37,8 @@ public function testExceptionLoadBasket() { $this->setExpectedException('RuntimeException'); - $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); - $basketFactory = $this->getMock('Sonata\Component\Basket\BasketFactoryInterface'); + $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); + $basketFactory = $this->getMock('Sonata\Component\Basket\BasketFactoryInterface'); $basketFactory->expects($this->once())->method('load')->will($this->returnCallback(function () { throw new \RuntimeException(); })); diff --git a/tests/Component/Basket/Order.php b/tests/Component/Basket/Order.php index 7d5e01ce9..5a76faf16 100644 --- a/tests/Component/Basket/Order.php +++ b/tests/Component/Basket/Order.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/Payment.php b/tests/Component/Basket/Payment.php index 0cea295df..4d692079f 100644 --- a/tests/Component/Basket/Payment.php +++ b/tests/Component/Basket/Payment.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Basket/Product.php b/tests/Component/Basket/Product.php index 65aaa0b3f..8b4d31370 100644 --- a/tests/Component/Basket/Product.php +++ b/tests/Component/Basket/Product.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Currency/CurrencyDataTransformerTest.php b/tests/Component/Currency/CurrencyDataTransformerTest.php index cd02cda29..c2d4c8b09 100644 --- a/tests/Component/Currency/CurrencyDataTransformerTest.php +++ b/tests/Component/Currency/CurrencyDataTransformerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Currency/CurrencyDetectorTest.php b/tests/Component/Currency/CurrencyDetectorTest.php index 875f3608e..632be4a3f 100644 --- a/tests/Component/Currency/CurrencyDetectorTest.php +++ b/tests/Component/Currency/CurrencyDetectorTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Currency/CurrencyDoctrineTypeTest.php b/tests/Component/Currency/CurrencyDoctrineTypeTest.php index 560a0af85..e263b9faf 100644 --- a/tests/Component/Currency/CurrencyDoctrineTypeTest.php +++ b/tests/Component/Currency/CurrencyDoctrineTypeTest.php @@ -1,7 +1,7 @@ * @@ -107,15 +107,19 @@ public function getBlobTypeDeclarationSQL(array $field) public function getBooleanTypeDeclarationSQL(array $columnDef) { } + public function getIntegerTypeDeclarationSQL(array $columnDef) { } + public function getBigIntTypeDeclarationSQL(array $columnDef) { } + public function getSmallIntTypeDeclarationSQL(array $columnDef) { } + public function _getCommonIntegerTypeDeclarationSQL(array $columnDef) { } @@ -140,9 +144,11 @@ public function getName() { return 'mock'; } + protected function initializeDoctrineTypeMappings() { } + protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) { } diff --git a/tests/Component/Currency/CurrencyFormTypeTest.php b/tests/Component/Currency/CurrencyFormTypeTest.php index 323b25b71..a9356a79a 100644 --- a/tests/Component/Currency/CurrencyFormTypeTest.php +++ b/tests/Component/Currency/CurrencyFormTypeTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Currency/CurrencyManagerTest.php b/tests/Component/Currency/CurrencyManagerTest.php index e091bce9b..40b864252 100644 --- a/tests/Component/Currency/CurrencyManagerTest.php +++ b/tests/Component/Currency/CurrencyManagerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Currency/CurrencyPriceCalculatorTest.php b/tests/Component/Currency/CurrencyPriceCalculatorTest.php index 774462498..a3b72c25f 100644 --- a/tests/Component/Currency/CurrencyPriceCalculatorTest.php +++ b/tests/Component/Currency/CurrencyPriceCalculatorTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Currency/CurrencyTest.php b/tests/Component/Currency/CurrencyTest.php index 1c0f4739c..684ffa3dd 100644 --- a/tests/Component/Currency/CurrencyTest.php +++ b/tests/Component/Currency/CurrencyTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Customer/CustomerSelectorTest.php b/tests/Component/Customer/CustomerSelectorTest.php index 40a2b44dc..e8653330c 100644 --- a/tests/Component/Customer/CustomerSelectorTest.php +++ b/tests/Component/Customer/CustomerSelectorTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Customer/ValidUser.php b/tests/Component/Customer/ValidUser.php index 95c06a7cc..33829b1f4 100644 --- a/tests/Component/Customer/ValidUser.php +++ b/tests/Component/Customer/ValidUser.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Delivery/BaseDeliveryTest.php b/tests/Component/Delivery/BaseDeliveryTest.php index 8a9b73733..7e3dbff1e 100644 --- a/tests/Component/Delivery/BaseDeliveryTest.php +++ b/tests/Component/Delivery/BaseDeliveryTest.php @@ -1,7 +1,7 @@ * @@ -24,21 +24,21 @@ public function testArrayDelivery() $delivery = new Delivery(); $arrayDelivery = array( - 'code' => 'code', - 'perItem' => 1, + 'code' => 'code', + 'perItem' => 1, 'countryCode' => 'FR', - 'zone' => 'zone', - 'enabled' => 1, + 'zone' => 'zone', + 'enabled' => 1, ); $delivery->fromArray($arrayDelivery); $this->assertEquals($arrayDelivery, $delivery->toArray()); - $this->assertEquals($delivery->getCode(), $arrayDelivery['code']); - $this->assertEquals($delivery->getPerItem(), $arrayDelivery['perItem']); + $this->assertEquals($delivery->getCode(), $arrayDelivery['code']); + $this->assertEquals($delivery->getPerItem(), $arrayDelivery['perItem']); $this->assertEquals($delivery->getCountryCode(), $arrayDelivery['countryCode']); - $this->assertEquals($delivery->getZone(), $arrayDelivery['zone']); - $this->assertEquals($delivery->getEnabled(), $arrayDelivery['enabled']); + $this->assertEquals($delivery->getZone(), $arrayDelivery['zone']); + $this->assertEquals($delivery->getEnabled(), $arrayDelivery['enabled']); } } diff --git a/tests/Component/Delivery/FreeDeliveryTest.php b/tests/Component/Delivery/FreeDeliveryTest.php index 286171c57..b5213f509 100644 --- a/tests/Component/Delivery/FreeDeliveryTest.php +++ b/tests/Component/Delivery/FreeDeliveryTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Delivery/SelectorTest.php b/tests/Component/Delivery/SelectorTest.php index 47c771714..ad24e9b7f 100644 --- a/tests/Component/Delivery/SelectorTest.php +++ b/tests/Component/Delivery/SelectorTest.php @@ -1,7 +1,7 @@ * @@ -34,7 +34,7 @@ public function testNonExistentProduct() $basketElement = $this->getMock('Sonata\Component\Basket\BasketElementInterface'); - $basket = $this->getMock('Sonata\Component\Basket\BasketInterface'); + $basket = $this->getMock('Sonata\Component\Basket\BasketInterface'); $basket->expects($this->once())->method('getBasketElements')->will($this->returnValue(array($basketElement))); $address = $this->getMock('Sonata\Component\Customer\AddressInterface'); @@ -62,7 +62,7 @@ public function testGetAvailableMethodsWithEmptyBasket() { $deliveryPool = new DeliveryPool(); $productPool = new ProductPool(); - $basket = $this->getMock('Sonata\Component\Basket\Basket'); + $basket = $this->getMock('Sonata\Component\Basket\Basket'); $basket->expects($this->once())->method('getBasketElements')->will($this->returnValue(array())); $selector = new Selector($deliveryPool, $productPool); @@ -77,7 +77,7 @@ public function testGetAvailableMethodsWithFilledBasket() $deliveryPool = new DeliveryPool(); $productPool = new ProductPool(); - $basket = $this->getMock('Sonata\Component\Basket\Basket'); + $basket = $this->getMock('Sonata\Component\Basket\Basket'); $basketElement = $this->getMock('Sonata\Component\Basket\BasketElement'); $product = $this->getMock('Sonata\Tests\Component\Delivery\Product'); @@ -97,7 +97,7 @@ public function testGetAvailableMethodsWithRequiredAddressDelivery() $deliveryPool = $this->getMock('Sonata\Component\Delivery\Pool'); $productPool = new ProductPool(); - $basket = $this->getMock('Sonata\Component\Basket\Basket'); + $basket = $this->getMock('Sonata\Component\Basket\Basket'); $basketElement = $this->getMock('Sonata\Component\Basket\BasketElement'); $product = $this->getMock('Sonata\Tests\Component\Delivery\Product'); @@ -126,7 +126,7 @@ public function testGetAvailableMethodsWithDisabledDelivery() $deliveryPool = $this->getMock('Sonata\Component\Delivery\Pool'); $productPool = new ProductPool(); - $basket = $this->getMock('Sonata\Component\Basket\Basket'); + $basket = $this->getMock('Sonata\Component\Basket\Basket'); $basketElement = $this->getMock('Sonata\Component\Basket\BasketElement'); $product = $this->getMock('Sonata\Tests\Component\Delivery\Product'); @@ -154,7 +154,7 @@ public function testGetAvailableMethodsWithUndefinedCode() $deliveryPool = $this->getMock('Sonata\Component\Delivery\Pool'); $productPool = new ProductPool(); - $basket = $this->getMock('Sonata\Component\Basket\Basket'); + $basket = $this->getMock('Sonata\Component\Basket\Basket'); $basketElement = $this->getMock('Sonata\Component\Basket\BasketElement'); $product = $this->getMock('Sonata\Tests\Component\Delivery\Product'); @@ -179,7 +179,7 @@ public function testGetAvailableMethodsWithUncoveredCountry() $deliveryPool = $this->getMock('Sonata\Component\Delivery\Pool'); $productPool = new ProductPool(); - $basket = $this->getMock('Sonata\Component\Basket\Basket'); + $basket = $this->getMock('Sonata\Component\Basket\Basket'); $basketElement = $this->getMock('Sonata\Component\Basket\BasketElement'); $product = $this->getMock('Sonata\Tests\Component\Delivery\Product'); @@ -211,7 +211,7 @@ public function testGetAvailableMethodsWithAlreadySelectedCode() { $deliveryPool = $this->getMock('Sonata\Component\Delivery\Pool'); - $basket = $this->getMock('Sonata\Component\Basket\Basket'); + $basket = $this->getMock('Sonata\Component\Basket\Basket'); $basketElement = $this->getMock('Sonata\Component\Basket\BasketElement'); $product = $this->getMock('Sonata\Tests\Component\Delivery\Product'); @@ -275,7 +275,7 @@ public function testAvailableMethods() $basketElement = $this->getMock('Sonata\Component\Basket\BasketElementInterface'); $basketElement->expects($this->once())->method('getProduct')->will($this->returnValue($product)); - $basket = $this->getMock('Sonata\Component\Basket\BasketInterface'); + $basket = $this->getMock('Sonata\Component\Basket\BasketInterface'); $basket->expects($this->once())->method('getBasketElements')->will($this->returnValue(array($basketElement))); $address = $this->getMock('Sonata\Component\Customer\AddressInterface'); diff --git a/tests/Component/Delivery/ServiceDeliveryTest.php b/tests/Component/Delivery/ServiceDeliveryTest.php index b47f30e0c..bb64f572d 100644 --- a/tests/Component/Delivery/ServiceDeliveryTest.php +++ b/tests/Component/Delivery/ServiceDeliveryTest.php @@ -1,7 +1,7 @@ * @@ -45,12 +45,12 @@ public function testPool() public function testGetStatusList() { $statusList = array( - ServiceDeliveryInterface::STATUS_OPEN => 'status_open', - ServiceDeliveryInterface::STATUS_PENDING => 'status_pending', - ServiceDeliveryInterface::STATUS_SENT => 'status_sent', - ServiceDeliveryInterface::STATUS_CANCELLED => 'status_cancelled', - ServiceDeliveryInterface::STATUS_COMPLETED => 'status_completed', - ServiceDeliveryInterface::STATUS_RETURNED => 'status_returned', + ServiceDeliveryInterface::STATUS_OPEN => 'status_open', + ServiceDeliveryInterface::STATUS_PENDING => 'status_pending', + ServiceDeliveryInterface::STATUS_SENT => 'status_sent', + ServiceDeliveryInterface::STATUS_CANCELLED => 'status_cancelled', + ServiceDeliveryInterface::STATUS_COMPLETED => 'status_completed', + ServiceDeliveryInterface::STATUS_RETURNED => 'status_returned', ); $this->assertEquals($statusList, BaseDelivery::getStatusList()); $this->assertEquals($statusList, BaseServiceDelivery::getStatusList()); diff --git a/tests/Component/Form/BasketValidatorTest.php b/tests/Component/Form/BasketValidatorTest.php index 5a33937db..6e8e2b9e5 100644 --- a/tests/Component/Form/BasketValidatorTest.php +++ b/tests/Component/Form/BasketValidatorTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Form/EventListener/BasketResizeFormListenerTest.php b/tests/Component/Form/EventListener/BasketResizeFormListenerTest.php index 16b3ee940..8aa4af1aa 100644 --- a/tests/Component/Form/EventListener/BasketResizeFormListenerTest.php +++ b/tests/Component/Form/EventListener/BasketResizeFormListenerTest.php @@ -1,7 +1,7 @@ * @@ -26,7 +26,7 @@ public function testGetSubscribedEvents() { $expected = array( FormEvents::PRE_SET_DATA => 'preSetData', - FormEvents::PRE_SUBMIT => 'preBind', + FormEvents::PRE_SUBMIT => 'preBind', ); $this->assertEquals($expected, BasketResizeFormListener::getSubscribedEvents()); diff --git a/tests/Component/Form/Transformer/DeliveryMethodTransformerTest.php b/tests/Component/Form/Transformer/DeliveryMethodTransformerTest.php index d56e31029..0c7273db8 100644 --- a/tests/Component/Form/Transformer/DeliveryMethodTransformerTest.php +++ b/tests/Component/Form/Transformer/DeliveryMethodTransformerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Form/Transformer/PaymentMethodTransformerTest.php b/tests/Component/Form/Transformer/PaymentMethodTransformerTest.php index 915c46023..cfa6a5173 100644 --- a/tests/Component/Form/Transformer/PaymentMethodTransformerTest.php +++ b/tests/Component/Form/Transformer/PaymentMethodTransformerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Generator/MustacheTest.php b/tests/Component/Generator/MustacheTest.php index 176063ba4..d8d06fd02 100644 --- a/tests/Component/Generator/MustacheTest.php +++ b/tests/Component/Generator/MustacheTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Generator/MysqlReferenceTest.php b/tests/Component/Generator/MysqlReferenceTest.php index 93b8557ed..e743cee87 100644 --- a/tests/Component/Generator/MysqlReferenceTest.php +++ b/tests/Component/Generator/MysqlReferenceTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Invoice/InvoiceStatusRendererTest.php b/tests/Component/Invoice/InvoiceStatusRendererTest.php index cb332664a..a50f16a2d 100644 --- a/tests/Component/Invoice/InvoiceStatusRendererTest.php +++ b/tests/Component/Invoice/InvoiceStatusRendererTest.php @@ -1,7 +1,7 @@ * @@ -37,7 +37,7 @@ public function testHandles() public function testGetClass() { $renderer = new InvoiceStatusRenderer(); - $invoice = $this->getMock('Sonata\Component\Invoice\InvoiceInterface'); + $invoice = $this->getMock('Sonata\Component\Invoice\InvoiceInterface'); $invoice->expects($this->once())->method('getStatus')->will($this->returnValue(array_rand(BaseInvoice::getStatusList()))); $this->assertContains($renderer->getStatusClass($invoice, '', 'error'), array('danger', 'warning', 'success')); diff --git a/tests/Component/Order/OrderStatusRendererTest.php b/tests/Component/Order/OrderStatusRendererTest.php index 2cc2a65b9..ff5acaf2d 100644 --- a/tests/Component/Order/OrderStatusRendererTest.php +++ b/tests/Component/Order/OrderStatusRendererTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Payment/BasePaymentTest.php b/tests/Component/Payment/BasePaymentTest.php index 71ac6dffe..b3f4a3b43 100644 --- a/tests/Component/Payment/BasePaymentTest.php +++ b/tests/Component/Payment/BasePaymentTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Payment/CheckPaymentTest.php b/tests/Component/Payment/CheckPaymentTest.php index a88b1ed2b..5c9cad4e8 100644 --- a/tests/Component/Payment/CheckPaymentTest.php +++ b/tests/Component/Payment/CheckPaymentTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Payment/DebugPaymentTest.php b/tests/Component/Payment/DebugPaymentTest.php index eb01437da..68e8f17f6 100644 --- a/tests/Component/Payment/DebugPaymentTest.php +++ b/tests/Component/Payment/DebugPaymentTest.php @@ -1,7 +1,7 @@ * @@ -62,6 +62,21 @@ public function testDebugPayment() $this->assertEquals(TransactionInterface::STATUS_VALIDATED, $transaction->getStatusCode()); } + /** + * @return \Sonata\Component\Order\OrderInterface + */ + public function getOrder() + { + $date = new \DateTime(); + $date->setTimeStamp(strtotime('30/11/1981')); + $date->setTimezone(new \DateTimeZone('Europe/Paris')); + + $order = new DebugPaymentTest_Order(); + $order->setCreatedAt($date); + + return $order; + } + /** * @return \Sonata\Component\Payment\TransactionManagerInterface */ @@ -91,19 +106,4 @@ protected function getDebugPayment() return $payment; } - - /** - * @return \Sonata\Component\Order\OrderInterface - */ - public function getOrder() - { - $date = new \DateTime(); - $date->setTimeStamp(strtotime('30/11/1981')); - $date->setTimezone(new \DateTimeZone('Europe/Paris')); - - $order = new DebugPaymentTest_Order(); - $order->setCreatedAt($date); - - return $order; - } } diff --git a/tests/Component/Payment/Ogone/OgonePaymentTest.php b/tests/Component/Payment/Ogone/OgonePaymentTest.php index e6e61ab11..b829d7684 100644 --- a/tests/Component/Payment/Ogone/OgonePaymentTest.php +++ b/tests/Component/Payment/Ogone/OgonePaymentTest.php @@ -1,7 +1,7 @@ * @@ -21,6 +21,7 @@ public function setId($id) { $this->id = $id; } + /** * @return int the order id */ @@ -31,29 +32,26 @@ public function getId() } class OgonePaymentTest extends \PHPUnit_Framework_TestCase { - /** - * - */ public function testValidPayment() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $router->expects($this->once())->method('generate')->will($this->returnValue('http://www.google.com')); $payment = new OgonePayment($router, $logger, $templating, true); $payment->setCode('ogone_1'); $payment->setOptions(array( - 'url_return_ok' => 'sonata_payment_confirmation', - 'url_return_ko' => '', - 'url_callback' => '', - 'template' => '', - 'form_url' => '', - 'sha_key' => '', - 'sha-out_key' => '', - 'pspid' => '', - 'home_url' => '', - 'catalog_url' => '', + 'url_return_ok' => 'sonata_payment_confirmation', + 'url_return_ko' => '', + 'url_callback' => '', + 'template' => '', + 'form_url' => '', + 'sha_key' => '', + 'sha-out_key' => '', + 'pspid' => '', + 'home_url' => '', + 'catalog_url' => '', )); $basket = $this->getMock('Sonata\Component\Basket\Basket'); @@ -88,17 +86,17 @@ public function testValidPayment() public function testValidSendbankPayment() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); $templating->expects($this->once())->method('renderResponse')->will($this->returnCallback(array($this, 'callbackValidsendbank'))); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $date = new \DateTime(); $date->setTimeStamp(strtotime('30/11/1981')); $date->setTimezone(new \DateTimeZone('Europe/Paris')); - $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); + $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); $order = new OgonePaymentTest_Order(); $order->setCreatedAt($date); @@ -114,16 +112,16 @@ public function testValidSendbankPayment() $payment = new OgonePayment($router, $logger, $templating, true); $payment->setCode('ogone_1'); $payment->setOptions(array( - 'url_return_ok' => '', - 'url_return_ko' => '', - 'url_callback' => '', - 'template' => '', - 'form_url' => '', - 'sha_key' => '', - 'sha-out_key' => '', - 'pspid' => '', - 'home_url' => '', - 'catalog_url' => '', + 'url_return_ok' => '', + 'url_return_ko' => '', + 'url_callback' => '', + 'template' => '', + 'form_url' => '', + 'sha_key' => '', + 'sha-out_key' => '', + 'pspid' => '', + 'home_url' => '', + 'catalog_url' => '', )); $response = $payment->sendbank($order); @@ -136,23 +134,23 @@ public function testValidSendbankPayment() */ public function testEncodeString($data, $expected) { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $payment = new OgonePayment($router, $logger, $templating, true); $payment->setCode('ogone_1'); $payment->setOptions(array( - 'url_return_ok' => '', - 'url_return_ko' => '', - 'url_callback' => '', - 'template' => '', - 'form_url' => '', - 'sha_key' => '', - 'sha-out_key' => '', - 'pspid' => '', - 'home_url' => '', - 'catalog_url' => '', + 'url_return_ok' => '', + 'url_return_ko' => '', + 'url_callback' => '', + 'template' => '', + 'form_url' => '', + 'sha_key' => '', + 'sha-out_key' => '', + 'pspid' => '', + 'home_url' => '', + 'catalog_url' => '', )); $this->assertEquals($expected, $payment->encodeString($data)); @@ -183,20 +181,20 @@ public function callbackValidsendbank($template, $params) public static function callback($name) { $params = array( - 'orderID' => 'FR', - 'currency' => null, - 'amount' => 'amount', - 'PM' => 'PM', + 'orderID' => 'FR', + 'currency' => null, + 'amount' => 'amount', + 'PM' => 'PM', 'ACCEPTANCE' => 'ACCEPTANCE', - 'STATUS' => 'STATUS', - 'CARDNO' => 'CARDNO', - 'ED' => 'ED', - 'CN' => 'CN', - 'TRXDATE' => 'TRXDATE', - 'PAYID' => 'PAYID', - 'NCERROR' => 'NCERROR', - 'BRAND' => 'BRAND', - 'IP' => 'IP', + 'STATUS' => 'STATUS', + 'CARDNO' => 'CARDNO', + 'ED' => 'ED', + 'CN' => 'CN', + 'TRXDATE' => 'TRXDATE', + 'PAYID' => 'PAYID', + 'NCERROR' => 'NCERROR', + 'BRAND' => 'BRAND', + 'IP' => 'IP', ); if (strcasecmp('shasign', $name) === 0) { @@ -221,9 +219,9 @@ public static function callback($name) public function testIsCallbackValid() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $payment = new OgonePayment($router, $logger, $templating, true); @@ -259,9 +257,9 @@ public function testIsCallbackValid() public function testGetOrderReference() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $payment = new OgonePayment($router, $logger, $templating, true); @@ -273,9 +271,9 @@ public function testGetOrderReference() public function testApplyTransactionId() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $payment = new OgonePayment($router, $logger, $templating, true); diff --git a/tests/Component/Payment/PassPaymentTest.php b/tests/Component/Payment/PassPaymentTest.php index c890469a6..5f56a7c69 100644 --- a/tests/Component/Payment/PassPaymentTest.php +++ b/tests/Component/Payment/PassPaymentTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Payment/PaymentHandlerTest.php b/tests/Component/Payment/PaymentHandlerTest.php index d49bb1bdf..bf45abf63 100644 --- a/tests/Component/Payment/PaymentHandlerTest.php +++ b/tests/Component/Payment/PaymentHandlerTest.php @@ -1,7 +1,7 @@ * @@ -39,19 +39,19 @@ public function testHandleError() $order = $this->getMock('Sonata\Component\Order\OrderInterface'); - $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); + $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); $om->expects($this->once()) ->method('findOneBy') ->will($this->returnValue($order)); - $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); + $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); $ps->expects($this->exactly(3)) ->method('getPayment') ->will($this->returnValue($payment)); $ref = $this->getMock('Sonata\Component\Generator\ReferenceInterface'); - $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); + $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); $tm->expects($this->once()) ->method('create') ->will($this->returnValue(new Transaction())); @@ -80,16 +80,16 @@ public function testHandleErrorInvalidTransactionException() $order = $this->getMock('Sonata\Component\Order\OrderInterface'); - $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); + $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); - $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); + $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); $ps->expects($this->exactly(2)) ->method('getPayment') ->will($this->returnValue($payment)); $ref = $this->getMock('Sonata\Component\Generator\ReferenceInterface'); - $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); + $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); $tm->expects($this->once()) ->method('create') ->will($this->returnValue(new Transaction())); @@ -127,19 +127,19 @@ public function testHandleErrorInvalidTransactionException2() ->method('getReference') ->will($this->returnValue('42')); - $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); + $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); $om->expects($this->once()) ->method('findOneBy') ->will($this->returnValue($order)); - $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); + $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); $ps->expects($this->exactly(2)) ->method('getPayment') ->will($this->returnValue($payment)); $ref = $this->getMock('Sonata\Component\Generator\ReferenceInterface'); - $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); + $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); $tm->expects($this->once()) ->method('create') ->will($this->returnValue(new Transaction())); @@ -169,19 +169,19 @@ public function testHandleErrorEntityNotFoundException() ->method('getOrderReference') ->will($this->returnValue('42')); - $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); + $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); $om->expects($this->once()) ->method('findOneBy') ->will($this->returnValue(null)); - $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); + $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); $ps->expects($this->exactly(2)) ->method('getPayment') ->will($this->returnValue($payment)); $ref = $this->getMock('Sonata\Component\Generator\ReferenceInterface'); - $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); + $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); $tm->expects($this->once()) ->method('create') ->will($this->returnValue(new Transaction())); @@ -212,19 +212,19 @@ public function testHandleConfirmation() $order = $this->getMock('Sonata\Component\Order\OrderInterface'); - $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); + $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); $om->expects($this->once()) ->method('findOneBy') ->will($this->returnValue($order)); - $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); + $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); $ps->expects($this->exactly(2)) ->method('getPayment') ->will($this->returnValue($payment)); $ref = $this->getMock('Sonata\Component\Generator\ReferenceInterface'); - $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); + $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); $tm->expects($this->once()) ->method('create') ->will($this->returnValue(new Transaction())); @@ -257,15 +257,15 @@ public function testGetSendbankOrder() ->method('getTransformer') ->will($this->returnValue($basketTransformer)); - $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); + $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); $om->expects($this->once())->method('save'); - $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); + $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); $ref = $this->getMock('Sonata\Component\Generator\ReferenceInterface'); $ref->expects($this->once())->method('order'); - $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); + $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); $nb = $this->getMockBuilder('Sonata\NotificationBundle\Backend\RuntimeBackend')->disableOriginalConstructor()->getMock(); @@ -300,19 +300,19 @@ public function testGetPaymentCallbackResponse() $order = $this->getMock('Sonata\Component\Order\OrderInterface'); - $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); + $om = $this->getMock('Sonata\Component\Order\OrderManagerInterface'); $om->expects($this->once()) ->method('findOneBy') ->will($this->returnValue($order)); - $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); + $ps = $this->getMock('Sonata\Component\Payment\PaymentSelectorInterface'); $ps->expects($this->exactly(3)) ->method('getPayment') ->will($this->returnValue($payment)); $ref = $this->getMock('Sonata\Component\Generator\ReferenceInterface'); - $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); + $tm = $this->getMock('Sonata\Component\Payment\TransactionManagerInterface'); $tm->expects($this->once()) ->method('create') ->will($this->returnValue(new Transaction())); diff --git a/tests/Component/Payment/PaypalTest.php b/tests/Component/Payment/PaypalTest.php index 7efd36ded..95de9058c 100644 --- a/tests/Component/Payment/PaypalTest.php +++ b/tests/Component/Payment/PaypalTest.php @@ -1,7 +1,7 @@ * @@ -24,15 +24,15 @@ class PaypalTest extends \PHPUnit_Framework_TestCase { public function testSendbank() { - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface'); - $paypal = new Paypal($router, $translator); + $paypal = new Paypal($router, $translator); $options = array( - 'cert_file' => __DIR__.'/PaypalTestFiles/cert_file', - 'key_file' => __DIR__.'/PaypalTestFiles/key_file', + 'cert_file' => __DIR__.'/PaypalTestFiles/cert_file', + 'key_file' => __DIR__.'/PaypalTestFiles/key_file', 'paypal_cert_file' => __DIR__.'/PaypalTestFiles/paypal_cert_file', - 'openssl' => __DIR__.'/PaypalTestFiles/openssl', + 'openssl' => __DIR__.'/PaypalTestFiles/openssl', ); $paypal->setOptions($options); @@ -47,10 +47,10 @@ public function testSendbank() public function testIsCallbackValid() { - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface'); - $paypal = new Paypal($router, $translator); + $paypal = new Paypal($router, $translator); $order = $this->getMock('Sonata\Component\Order\OrderInterface'); $order->expects($this->any())->method('getCreatedAt')->will($this->returnValue(new \DateTime())); @@ -90,14 +90,14 @@ public function testIsCallbackValid() $transaction->expects($this->any())->method('getOrder')->will($this->returnValue($order)); $transaction->expects($this->any())->method('get')->will($this->returnCallback(function () use ($check) { - $asked = func_get_arg(0); - switch ($asked) { + $asked = func_get_arg(0); + switch ($asked) { case 'check': return $check; case 'payment_status': return 'Pending'; } - })); + })); $this->assertTrue($paypal->isCallbackValid($transaction), 'Paypal::isCallbackValid true because payment_status pending.'); @@ -105,14 +105,14 @@ public function testIsCallbackValid() $transaction->expects($this->any())->method('getOrder')->will($this->returnValue($order)); $transaction->expects($this->any())->method('get')->will($this->returnCallback(function () use ($check) { - $asked = func_get_arg(0); - switch ($asked) { + $asked = func_get_arg(0); + switch ($asked) { case 'check': return $check; case 'payment_status': return 'Completed'; } - })); + })); $this->assertTrue($paypal->isCallbackValid($transaction), 'Paypal::isCallbackValid true because payment_status completed.'); @@ -120,24 +120,24 @@ public function testIsCallbackValid() $transaction->expects($this->any())->method('getOrder')->will($this->returnValue($order)); $transaction->expects($this->any())->method('get')->will($this->returnCallback(function () use ($check) { - $asked = func_get_arg(0); - switch ($asked) { + $asked = func_get_arg(0); + switch ($asked) { case 'check': return $check; case 'payment_status': return 'Cancelled'; } - })); + })); $this->assertTrue($paypal->isCallbackValid($transaction), 'Paypal::isCallbackValid true because payment_status cancelled.'); } public function testHandleError() { - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface'); - $paypal = new Paypal($router, $translator); + $paypal = new Paypal($router, $translator); $paypal->setLogger($this->getMock('Psr\Log\LoggerInterface')); $order = $this->getMock('Sonata\Component\Order\OrderInterface'); diff --git a/tests/Component/Payment/PoolTest.php b/tests/Component/Payment/PoolTest.php index 813cbb6c9..c61893d03 100644 --- a/tests/Component/Payment/PoolTest.php +++ b/tests/Component/Payment/PoolTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Payment/Scellius/NodeScelliusTransactionGeneratorTest.php b/tests/Component/Payment/Scellius/NodeScelliusTransactionGeneratorTest.php index 628f05bb7..8b88d0ad8 100644 --- a/tests/Component/Payment/Scellius/NodeScelliusTransactionGeneratorTest.php +++ b/tests/Component/Payment/Scellius/NodeScelliusTransactionGeneratorTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Payment/Scellius/OrderScelliusTransactionGeneratorTest.php b/tests/Component/Payment/Scellius/OrderScelliusTransactionGeneratorTest.php index bfef25285..962bbcee3 100644 --- a/tests/Component/Payment/Scellius/OrderScelliusTransactionGeneratorTest.php +++ b/tests/Component/Payment/Scellius/OrderScelliusTransactionGeneratorTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Payment/Scellius/ScelliusPaymentTest.php b/tests/Component/Payment/Scellius/ScelliusPaymentTest.php index 786d091cd..c165e68d6 100644 --- a/tests/Component/Payment/Scellius/ScelliusPaymentTest.php +++ b/tests/Component/Payment/Scellius/ScelliusPaymentTest.php @@ -1,7 +1,7 @@ * @@ -21,6 +21,7 @@ public function setId($id) { $this->id = $id; } + /** * @return int the order id */ @@ -45,15 +46,15 @@ class ScelliusPaymentTest extends \PHPUnit_Framework_TestCase */ public function testValidPayment() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); $payment = new ScelliusPayment($router, $logger, $templating, $generator, true); $payment->setCode('free_1'); $payment->setOptions(array( - 'base_folder' => __DIR__, + 'base_folder' => __DIR__, 'response_command' => 'cat response_ok.txt && echo ', )); @@ -99,14 +100,14 @@ public function testValidPayment() public function testSendConfirmationReceipt() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); $payment = new ScelliusPayment($router, $logger, $templating, $generator, true); $payment->setOptions(array( - 'base_folder' => __DIR__, + 'base_folder' => __DIR__, 'response_command' => 'cat response_ko.txt && echo ', )); @@ -118,21 +119,21 @@ public function testSendConfirmationReceipt() $this->assertFalse($payment->sendConfirmationReceipt($transaction)); $payment->setOptions(array( - 'base_folder' => __DIR__, + 'base_folder' => __DIR__, 'response_command' => 'cat response_nok.txt && echo ', )); $this->assertFalse($payment->sendConfirmationReceipt($transaction)); $payment->setOptions(array( - 'base_folder' => __DIR__, + 'base_folder' => __DIR__, 'response_command' => 'cat response_code_nok.txt && echo ', )); $this->assertFalse($payment->sendConfirmationReceipt($transaction)); $payment->setOptions(array( - 'base_folder' => __DIR__, + 'base_folder' => __DIR__, 'response_command' => 'cat response_ok.txt && echo ', )); @@ -141,10 +142,10 @@ public function testSendConfirmationReceipt() public function testIsCallbackValid() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); $payment = new ScelliusPayment($router, $logger, $templating, $generator, true); @@ -180,10 +181,10 @@ public function testIsCallbackValid() public function testGetOrderReference() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); $payment = new ScelliusPayment($router, $logger, $templating, $generator, true); @@ -195,10 +196,10 @@ public function testGetOrderReference() public function testApplyTransactionId() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); $payment = new ScelliusPayment($router, $logger, $templating, $generator, true); @@ -213,11 +214,11 @@ public function testApplyTransactionId() */ public function testInvalidCurrencySendbankPayment() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); + $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); $date = new \DateTime(); $date->setTimeStamp(strtotime('30/11/1981')); @@ -232,7 +233,7 @@ public function testInvalidCurrencySendbankPayment() $payment = new ScelliusPayment($router, $logger, $templating, $generator, true); $payment->setCode('free_1'); $payment->setOptions(array( - 'base_folder' => __DIR__, + 'base_folder' => __DIR__, 'request_command' => 'cat request_ok.txt && echo ', )); @@ -241,18 +242,18 @@ public function testInvalidCurrencySendbankPayment() public function testValidSendbankPayment() { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); $templating->expects($this->once())->method('renderResponse')->will($this->returnCallback(array($this, 'callbackValidsendbank'))); - $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); + $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); $date = new \DateTime(); $date->setTimeStamp(strtotime('30/11/1981')); $date->setTimezone(new \DateTimeZone('Europe/Paris')); - $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); + $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); $customer->expects($this->once())->method('getId')->will($this->returnValue(42)); $customer->expects($this->once())->method('getEmail')->will($this->returnValue('contact@sonata-project.org')); @@ -270,7 +271,7 @@ public function testValidSendbankPayment() $payment = new ScelliusPayment($router, $logger, $templating, $generator, true); $payment->setCode('free_1'); $payment->setOptions(array( - 'base_folder' => __DIR__, + 'base_folder' => __DIR__, 'request_command' => 'cat request_ok.txt && echo ', )); @@ -284,10 +285,10 @@ public function testValidSendbankPayment() */ public function testEncodeString($data, $expected) { - $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); $templating = $this->getMock('Symfony\Bundle\FrameworkBundle\Templating\EngineInterface'); - $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); - $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); + $router = $this->getMock('Symfony\Component\Routing\RouterInterface'); + $generator = $this->getMock('Sonata\Component\Payment\Scellius\ScelliusTransactionGeneratorInterface'); $payment = new ScelliusPayment($router, $logger, $templating, $generator, true); diff --git a/tests/Component/Payment/SelectorTest.php b/tests/Component/Payment/SelectorTest.php index cbf47a2a6..2d458cb64 100644 --- a/tests/Component/Payment/SelectorTest.php +++ b/tests/Component/Payment/SelectorTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Product/BaseProductServiceTest.php b/tests/Component/Product/BaseProductServiceTest.php index c6736e6f7..b45f9a881 100644 --- a/tests/Component/Product/BaseProductServiceTest.php +++ b/tests/Component/Product/BaseProductServiceTest.php @@ -1,7 +1,7 @@ * @@ -463,39 +463,39 @@ public function testArrayProduct() $product = new Product(); $arrayProduct = array( - 'sku' => 'productSku', - 'slug' => 'productslug', - 'name' => 'productName', - 'description' => 'productDescription', - 'rawDescription' => 'productRawDescription', - 'descriptionFormatter' => 'productDescriptionFormatter', - 'shortDescription' => 'productShortDescription', - 'rawShortDescription' => 'productRawShortDescription', + 'sku' => 'productSku', + 'slug' => 'productslug', + 'name' => 'productName', + 'description' => 'productDescription', + 'rawDescription' => 'productRawDescription', + 'descriptionFormatter' => 'productDescriptionFormatter', + 'shortDescription' => 'productShortDescription', + 'rawShortDescription' => 'productRawShortDescription', 'shortDescriptionFormatter' => 'productShortDescriptionFormatter', - 'price' => 123.45, - 'vatRate' => 678.90, - 'stock' => 12345, - 'enabled' => 1, - 'options' => array('key1' => 'value1', 'key2' => array('value2', 'value3')), + 'price' => 123.45, + 'vatRate' => 678.90, + 'stock' => 12345, + 'enabled' => 1, + 'options' => array('key1' => 'value1', 'key2' => array('value2', 'value3')), ); $product->fromArray($arrayProduct); $this->assertEquals($arrayProduct, $product->toArray()); - $this->assertEquals($product->getSku(), $arrayProduct['sku']); - $this->assertEquals($product->getSlug(), $arrayProduct['slug']); - $this->assertEquals($product->getName(), $arrayProduct['name']); - $this->assertEquals($product->getDescription(), $arrayProduct['description']); - $this->assertEquals($product->getRawDescription(), $arrayProduct['rawDescription']); - $this->assertEquals($product->getDescriptionFormatter(), $arrayProduct['descriptionFormatter']); - $this->assertEquals($product->getShortDescription(), $arrayProduct['shortDescription']); - $this->assertEquals($product->getRawShortDescription(), $arrayProduct['rawShortDescription']); + $this->assertEquals($product->getSku(), $arrayProduct['sku']); + $this->assertEquals($product->getSlug(), $arrayProduct['slug']); + $this->assertEquals($product->getName(), $arrayProduct['name']); + $this->assertEquals($product->getDescription(), $arrayProduct['description']); + $this->assertEquals($product->getRawDescription(), $arrayProduct['rawDescription']); + $this->assertEquals($product->getDescriptionFormatter(), $arrayProduct['descriptionFormatter']); + $this->assertEquals($product->getShortDescription(), $arrayProduct['shortDescription']); + $this->assertEquals($product->getRawShortDescription(), $arrayProduct['rawShortDescription']); $this->assertEquals($product->getShortDescriptionFormatter(), $arrayProduct['shortDescriptionFormatter']); - $this->assertEquals($product->getPrice(), $arrayProduct['price']); - $this->assertEquals($product->getVatRate(), $arrayProduct['vatRate']); - $this->assertEquals($product->getStock(), $arrayProduct['stock']); - $this->assertEquals($product->getEnabled(), $arrayProduct['enabled']); - $this->assertEquals($product->getOptions(), $arrayProduct['options']); + $this->assertEquals($product->getPrice(), $arrayProduct['price']); + $this->assertEquals($product->getVatRate(), $arrayProduct['vatRate']); + $this->assertEquals($product->getStock(), $arrayProduct['stock']); + $this->assertEquals($product->getEnabled(), $arrayProduct['enabled']); + $this->assertEquals($product->getOptions(), $arrayProduct['options']); } } diff --git a/tests/Component/Product/ProductFinderTest.php b/tests/Component/Product/ProductFinderTest.php index cdc953ea0..da1599fa9 100644 --- a/tests/Component/Product/ProductFinderTest.php +++ b/tests/Component/Product/ProductFinderTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Product/ProductPoolTest.php b/tests/Component/Product/ProductPoolTest.php index 9716ae679..0cde55b87 100644 --- a/tests/Component/Product/ProductPoolTest.php +++ b/tests/Component/Product/ProductPoolTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Subscriber/ORMInheritanceSubscriberTest.php b/tests/Component/Subscriber/ORMInheritanceSubscriberTest.php index d7340e438..70a238186 100644 --- a/tests/Component/Subscriber/ORMInheritanceSubscriberTest.php +++ b/tests/Component/Subscriber/ORMInheritanceSubscriberTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Transformer/BasketTransformerTest.php b/tests/Component/Transformer/BasketTransformerTest.php index f766591b3..c4d128422 100644 --- a/tests/Component/Transformer/BasketTransformerTest.php +++ b/tests/Component/Transformer/BasketTransformerTest.php @@ -1,7 +1,7 @@ * @@ -64,7 +64,7 @@ public function testInvalidBillingAddress() { $this->setExpectedException('RuntimeException', 'Invalid billing address'); - $basket = new Basket(); + $basket = new Basket(); $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); $basket->setCustomer($customer); @@ -80,7 +80,7 @@ public function testInvalidPaymentMethod() { $this->setExpectedException('RuntimeException', 'Invalid payment method'); - $basket = new Basket(); + $basket = new Basket(); $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); $billingAddress = $this->getMock('Sonata\Component\Customer\AddressInterface'); @@ -98,7 +98,7 @@ public function testInvalidDeliveryMethod() { $this->setExpectedException('RuntimeException', 'Invalid delivery method'); - $basket = new Basket(); + $basket = new Basket(); $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); $billingAddress = $this->getMock('Sonata\Component\Customer\AddressInterface'); $paymentMethod = $this->getMock('Sonata\Component\Payment\PaymentInterface'); @@ -118,7 +118,7 @@ public function testInvalidDeliveryAddress() { $this->setExpectedException('RuntimeException', 'Invalid delivery address'); - $basket = new Basket(); + $basket = new Basket(); $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); $billingAddress = $this->getMock('Sonata\Component\Customer\AddressInterface'); $paymentMethod = $this->getMock('Sonata\Component\Payment\PaymentInterface'); @@ -137,11 +137,9 @@ public function testInvalidDeliveryAddress() $this->getBasketTransform()->transformIntoOrder($basket); } - /** - */ public function testOrder() { - $basket = new Basket(); + $basket = new Basket(); $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); $billingAddress = $this->getMock('Sonata\Component\Customer\AddressInterface'); $deliveryMethod = $this->getMock('Sonata\Component\Delivery\ServiceDeliveryInterface'); diff --git a/tests/Component/Transformer/InvoiceTransformerTest.php b/tests/Component/Transformer/InvoiceTransformerTest.php index 7b05744aa..02d8cefac 100644 --- a/tests/Component/Transformer/InvoiceTransformerTest.php +++ b/tests/Component/Transformer/InvoiceTransformerTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + use Sonata\Component\Currency\Currency; use Sonata\Component\Delivery\Pool as DeliveryPool; use Sonata\Component\Transformer\InvoiceTransformer; diff --git a/tests/Component/Transformer/OrderTransformerTest.php b/tests/Component/Transformer/OrderTransformerTest.php index db6118185..8c2ddee2c 100644 --- a/tests/Component/Transformer/OrderTransformerTest.php +++ b/tests/Component/Transformer/OrderTransformerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/Component/Transformer/PoolTest.php b/tests/Component/Transformer/PoolTest.php index 6a0b25064..f4fc715ce 100644 --- a/tests/Component/Transformer/PoolTest.php +++ b/tests/Component/Transformer/PoolTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/CustomerBundle/Block/RecentCustomersBlockServiceTest.php b/tests/CustomerBundle/Block/RecentCustomersBlockServiceTest.php index 66f34d311..5dae546f4 100644 --- a/tests/CustomerBundle/Block/RecentCustomersBlockServiceTest.php +++ b/tests/CustomerBundle/Block/RecentCustomersBlockServiceTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/CustomerBundle/Controller/Api/AddressControllerTest.php b/tests/CustomerBundle/Controller/Api/AddressControllerTest.php index f6d27187a..1b6941576 100644 --- a/tests/CustomerBundle/Controller/Api/AddressControllerTest.php +++ b/tests/CustomerBundle/Controller/Api/AddressControllerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/CustomerBundle/Controller/Api/CustomerControllerTest.php b/tests/CustomerBundle/Controller/Api/CustomerControllerTest.php index af4761923..84bba403e 100644 --- a/tests/CustomerBundle/Controller/Api/CustomerControllerTest.php +++ b/tests/CustomerBundle/Controller/Api/CustomerControllerTest.php @@ -1,7 +1,7 @@ * @@ -52,7 +52,7 @@ public function testGetCustomerActionNotFoundException() public function testGetCustomerOrdersAction() { $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); - $order = $this->getMock('Sonata\Component\Order\OrderInterface'); + $order = $this->getMock('Sonata\Component\Order\OrderInterface'); $this->assertEquals(array($order), $this->createCustomerController($customer, null, null, null, $order)->getCustomerOrdersAction(1)); } @@ -60,7 +60,7 @@ public function testGetCustomerOrdersAction() public function testGetCustomerAddressesAction() { $customer = $this->getMock('Sonata\Component\Customer\CustomerInterface'); - $address = $this->getMock('Sonata\Component\Customer\AddressInterface'); + $address = $this->getMock('Sonata\Component\Customer\AddressInterface'); $customer->expects($this->once())->method('getAddresses')->will($this->returnValue(array($address))); $this->assertEquals(array($address), $this->createCustomerController($customer)->getCustomerAddressesAction(1)); diff --git a/tests/CustomerBundle/Entity/AddressManagerTest.php b/tests/CustomerBundle/Entity/AddressManagerTest.php index 3021768ca..4758d445c 100644 --- a/tests/CustomerBundle/Entity/AddressManagerTest.php +++ b/tests/CustomerBundle/Entity/AddressManagerTest.php @@ -1,7 +1,7 @@ * @@ -78,23 +78,6 @@ public function testDelete() $addressManager->delete($address); } - protected function getAddressManager($qbCallback) - { - if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { - $this->markTestSkipped('Not compatible with PHPUnit 5.'); - } - - $em = EntityManagerMockFactory::create($this, $qbCallback, array( - 'name', - 'firstname', - )); - - $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); - $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); - - return new AddressManager('Sonata\CustomerBundle\Entity\BaseAddress', $registry); - } - public function testGetPager() { $self = $this; @@ -118,7 +101,8 @@ public function testGetPagerWithInvalidSort() { $self = $this; $this - ->getAddressManager(function ($qb) use ($self) { }) + ->getAddressManager(function ($qb) use ($self) { + }) ->getPager(array(), 1, 10, array('invalid' => 'ASC')); } @@ -141,8 +125,25 @@ public function testGetPagerWithMultipleSort() $qb->expects($self->once())->method('setParameters')->with($self->equalTo(array())); }) ->getPager(array(), 1, 10, array( - 'name' => 'ASC', - 'firstname' => 'DESC', + 'name' => 'ASC', + 'firstname' => 'DESC', )); } + + protected function getAddressManager($qbCallback) + { + if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { + $this->markTestSkipped('Not compatible with PHPUnit 5.'); + } + + $em = EntityManagerMockFactory::create($this, $qbCallback, array( + 'name', + 'firstname', + )); + + $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); + $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); + + return new AddressManager('Sonata\CustomerBundle\Entity\BaseAddress', $registry); + } } diff --git a/tests/CustomerBundle/Entity/BaseCustomerTest.php b/tests/CustomerBundle/Entity/BaseCustomerTest.php index bb61ee22b..48ce90201 100644 --- a/tests/CustomerBundle/Entity/BaseCustomerTest.php +++ b/tests/CustomerBundle/Entity/BaseCustomerTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/CustomerBundle/Entity/CustomerManagerTest.php b/tests/CustomerBundle/Entity/CustomerManagerTest.php index 6dcdb4e54..4c3805132 100644 --- a/tests/CustomerBundle/Entity/CustomerManagerTest.php +++ b/tests/CustomerBundle/Entity/CustomerManagerTest.php @@ -1,7 +1,7 @@ * @@ -19,24 +19,6 @@ */ class CustomerManagerTest extends \PHPUnit_Framework_TestCase { - protected function getCustomerManager($qbCallback) - { - if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { - $this->markTestSkipped('Not compatible with PHPUnit 5.'); - } - - $em = EntityManagerMockFactory::create($this, $qbCallback, array( - 'firstname', - 'lastname', - 'email', - )); - - $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); - $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); - - return new CustomerManager('Sonata\CustomerBundle\Entity\BaseCustomer', $registry); - } - public function testGetPager() { $self = $this; @@ -60,7 +42,8 @@ public function testGetPagerWithInvalidSort() { $self = $this; $this - ->getCustomerManager(function ($qb) use ($self) {}) + ->getCustomerManager(function ($qb) use ($self) { + }) ->getPager(array(), 1, 10, array('invalid' => 'ASC')); } @@ -84,7 +67,7 @@ public function testGetPagerWithMultipleSort() }) ->getPager(array(), 1, 10, array( 'firstname' => 'ASC', - 'lastname' => 'DESC', + 'lastname' => 'DESC', )); } @@ -109,4 +92,22 @@ public function testGetPagerWithNoFakeCustomer() }) ->getPager(array('is_fake' => false), 1); } + + protected function getCustomerManager($qbCallback) + { + if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { + $this->markTestSkipped('Not compatible with PHPUnit 5.'); + } + + $em = EntityManagerMockFactory::create($this, $qbCallback, array( + 'firstname', + 'lastname', + 'email', + )); + + $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); + $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); + + return new CustomerManager('Sonata\CustomerBundle\Entity\BaseCustomer', $registry); + } } diff --git a/tests/CustomerBundle/Resources/XliffTest.php b/tests/CustomerBundle/Resources/XliffTest.php index 8db7947aa..183d995e1 100644 --- a/tests/CustomerBundle/Resources/XliffTest.php +++ b/tests/CustomerBundle/Resources/XliffTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/CustomerBundle/Twig/Extension/AddressExtensionTest.php b/tests/CustomerBundle/Twig/Extension/AddressExtensionTest.php index 41e636e3d..0c59c9a18 100644 --- a/tests/CustomerBundle/Twig/Extension/AddressExtensionTest.php +++ b/tests/CustomerBundle/Twig/Extension/AddressExtensionTest.php @@ -1,7 +1,7 @@ * @@ -40,11 +40,11 @@ public function testRenderAddress() $extension->renderAddress($environment, $address, true, true); $address = array( - 'firstname' => '', - 'lastname' => '', - 'address1' => '', - 'postcode' => '', - 'city' => '', + 'firstname' => '', + 'lastname' => '', + 'address1' => '', + 'postcode' => '', + 'city' => '', 'country_code' => '', ); @@ -76,11 +76,11 @@ public function testRenderAddressMissingId() $deliverySelector = $this->getMock('Sonata\Component\Delivery\ServiceDeliverySelectorInterface'); $address = array( - 'firstname' => '', - 'lastname' => '', - 'address1' => '', - 'postcode' => '', - 'city' => '', + 'firstname' => '', + 'lastname' => '', + 'address1' => '', + 'postcode' => '', + 'city' => '', 'country_code' => '', ); diff --git a/tests/DeliveryBundle/Resources/XliffTest.php b/tests/DeliveryBundle/Resources/XliffTest.php index 1d1f813c8..34bf6bd5c 100644 --- a/tests/DeliveryBundle/Resources/XliffTest.php +++ b/tests/DeliveryBundle/Resources/XliffTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/InvoiceBundle/Controller/Api/InvoiceControllerTest.php b/tests/InvoiceBundle/Controller/Api/InvoiceControllerTest.php index ff15e2671..242e86c45 100644 --- a/tests/InvoiceBundle/Controller/Api/InvoiceControllerTest.php +++ b/tests/InvoiceBundle/Controller/Api/InvoiceControllerTest.php @@ -1,7 +1,7 @@ * @@ -50,7 +50,7 @@ public function testGetInvoiceActionNotFoundException() public function testGetInvoiceInvoiceelementsAction() { - $invoice = $this->getMock('Sonata\Component\Invoice\InvoiceInterface'); + $invoice = $this->getMock('Sonata\Component\Invoice\InvoiceInterface'); $invoiceElements = $this->getMock('Sonata\Component\Invoice\InvoiceElementsInterface'); $invoice->expects($this->once())->method('getInvoiceElements')->will($this->returnValue(array($invoiceElements))); diff --git a/tests/InvoiceBundle/Entity/BaseInvoiceTest.php b/tests/InvoiceBundle/Entity/BaseInvoiceTest.php index 9c96bc25d..66d53b35e 100644 --- a/tests/InvoiceBundle/Entity/BaseInvoiceTest.php +++ b/tests/InvoiceBundle/Entity/BaseInvoiceTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/InvoiceBundle/Entity/InvoiceManagerTest.php b/tests/InvoiceBundle/Entity/InvoiceManagerTest.php index 343743bde..254b58189 100644 --- a/tests/InvoiceBundle/Entity/InvoiceManagerTest.php +++ b/tests/InvoiceBundle/Entity/InvoiceManagerTest.php @@ -1,7 +1,7 @@ * @@ -23,24 +23,6 @@ */ class InvoiceManagerTest extends \PHPUnit_Framework_TestCase { - protected function getInvoiceManager($qbCallback) - { - if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { - $this->markTestSkipped('Not compatible with PHPUnit 5.'); - } - - $em = EntityManagerMockFactory::create($this, $qbCallback, array( - 'reference', - 'status', - 'name', - )); - - $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); - $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); - - return new InvoiceManager('Sonata\InvoiceBundle\Entity\BaseInvoice', $registry); - } - public function testGetPager() { $self = $this; @@ -64,7 +46,8 @@ public function testGetPagerWithInvalidSort() { $self = $this; $this - ->getInvoiceManager(function ($qb) use ($self) {}) + ->getInvoiceManager(function ($qb) use ($self) { + }) ->getPager(array(), 1, 10, array('invalid' => 'ASC')); } @@ -88,7 +71,7 @@ public function testGetPagerWithMultipleSort() }) ->getPager(array(), 1, 10, array( 'reference' => 'ASC', - 'name' => 'DESC', + 'name' => 'DESC', )); } @@ -124,4 +107,22 @@ public function testGetPagerWithConflictInvoices() }) ->getPager(array('status' => BaseInvoice::STATUS_CONFLICT), 1); } + + protected function getInvoiceManager($qbCallback) + { + if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { + $this->markTestSkipped('Not compatible with PHPUnit 5.'); + } + + $em = EntityManagerMockFactory::create($this, $qbCallback, array( + 'reference', + 'status', + 'name', + )); + + $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); + $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); + + return new InvoiceManager('Sonata\InvoiceBundle\Entity\BaseInvoice', $registry); + } } diff --git a/tests/InvoiceBundle/Resources/XliffTest.php b/tests/InvoiceBundle/Resources/XliffTest.php index eefd310cc..c8280c213 100644 --- a/tests/InvoiceBundle/Resources/XliffTest.php +++ b/tests/InvoiceBundle/Resources/XliffTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/OrderBundle/Controller/Api/OrderControllerTest.php b/tests/OrderBundle/Controller/Api/OrderControllerTest.php index 4d3f87654..b04ba3ef9 100644 --- a/tests/OrderBundle/Controller/Api/OrderControllerTest.php +++ b/tests/OrderBundle/Controller/Api/OrderControllerTest.php @@ -1,7 +1,7 @@ * @@ -50,7 +50,7 @@ public function testGetOrderActionNotFoundException() public function testGetOrderOrderelementsAction() { - $order = $this->getMock('Sonata\Component\Order\OrderInterface'); + $order = $this->getMock('Sonata\Component\Order\OrderInterface'); $orderElements = $this->getMock('Sonata\Component\Order\OrderElementsInterface'); $order->expects($this->once())->method('getOrderElements')->will($this->returnValue(array($orderElements))); diff --git a/tests/OrderBundle/Entity/BaseOrderTest.php b/tests/OrderBundle/Entity/BaseOrderTest.php index 7ce1d9c54..c29a35139 100644 --- a/tests/OrderBundle/Entity/BaseOrderTest.php +++ b/tests/OrderBundle/Entity/BaseOrderTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/OrderBundle/Entity/OrderManagerTest.php b/tests/OrderBundle/Entity/OrderManagerTest.php index 06b8a8057..cf02f8497 100644 --- a/tests/OrderBundle/Entity/OrderManagerTest.php +++ b/tests/OrderBundle/Entity/OrderManagerTest.php @@ -1,7 +1,7 @@ * @@ -83,24 +83,6 @@ public function testDelete() $orderManager->delete($order); } - protected function getOrderManager($qbCallback) - { - if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { - $this->markTestSkipped('Not compatible with PHPUnit 5.'); - } - - $em = EntityManagerMockFactory::create($this, $qbCallback, array( - 'reference', - 'status', - 'username', - )); - - $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); - $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); - - return new OrderManager('Sonata\OrderBundle\Entity\BaseOrder', $registry); - } - public function testGetPager() { $self = $this; @@ -124,7 +106,8 @@ public function testGetPagerWithInvalidSort() { $self = $this; $this - ->getOrderManager(function ($qb) use ($self) { }) + ->getOrderManager(function ($qb) use ($self) { + }) ->getPager(array(), 1, 10, array('invalid' => 'ASC')); } @@ -148,7 +131,7 @@ public function testGetPagerWithMultipleSort() }) ->getPager(array(), 1, 10, array( 'reference' => 'ASC', - 'username' => 'DESC', + 'username' => 'DESC', )); } @@ -217,4 +200,22 @@ public function testGetPagerWithValidatedOrders() }) ->getPager(array('status' => BaseOrder::STATUS_VALIDATED), 1); } + + protected function getOrderManager($qbCallback) + { + if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { + $this->markTestSkipped('Not compatible with PHPUnit 5.'); + } + + $em = EntityManagerMockFactory::create($this, $qbCallback, array( + 'reference', + 'status', + 'username', + )); + + $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); + $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); + + return new OrderManager('Sonata\OrderBundle\Entity\BaseOrder', $registry); + } } diff --git a/tests/OrderBundle/Resources/XliffTest.php b/tests/OrderBundle/Resources/XliffTest.php index 646ba3e16..1ba226f53 100644 --- a/tests/OrderBundle/Resources/XliffTest.php +++ b/tests/OrderBundle/Resources/XliffTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/PaymentBundle/Consumer/PaymentProcessOrderElementConsumerTest.php b/tests/PaymentBundle/Consumer/PaymentProcessOrderElementConsumerTest.php index fba13f8eb..6c7917b8c 100644 --- a/tests/PaymentBundle/Consumer/PaymentProcessOrderElementConsumerTest.php +++ b/tests/PaymentBundle/Consumer/PaymentProcessOrderElementConsumerTest.php @@ -1,7 +1,7 @@ * @@ -23,7 +23,7 @@ public function testGenerateDiffValue() { $consumer = $this->getConsumer(); - $this->assertEquals(-1, $consumer->generateDiffValue(TransactionInterface::STATUS_VALIDATED, OrderInterface::STATUS_VALIDATED, 1)); + $this->assertEquals(-1, $consumer->generateDiffValue(TransactionInterface::STATUS_VALIDATED, OrderInterface::STATUS_VALIDATED, 1)); $this->assertEquals(-10, $consumer->generateDiffValue(TransactionInterface::STATUS_VALIDATED, OrderInterface::STATUS_VALIDATED, 10)); } diff --git a/tests/PaymentBundle/Entity/BaseTransactionTest.php b/tests/PaymentBundle/Entity/BaseTransactionTest.php index f8e92ac6b..d9e515a93 100644 --- a/tests/PaymentBundle/Entity/BaseTransactionTest.php +++ b/tests/PaymentBundle/Entity/BaseTransactionTest.php @@ -1,7 +1,7 @@ * @@ -36,7 +36,7 @@ public function testInformation() $transaction->setState(Transaction::STATE_KO); $transaction->setStatusCode(Transaction::STATUS_VALIDATED); - $expected = << array( - 'aerẑerüioRazeioj' => iconv('UTF-8', 'ISO-8859-1', 'ôûêîÖüïë'), - 'abcdef' => 'ghijkl', + 'aerẑerüioRazeioj' => iconv('UTF-8', 'ISO-8859-1', 'ôûêîÖüïë'), + 'abcdef' => 'ghijkl', )); $expectedParams = array('params' => array( - 'aerẑerüioRazeioj' => 'ôûêîÖüïë', - 'abcdef' => 'ghijkl', + 'aerẑerüioRazeioj' => 'ôûêîÖüïë', + 'abcdef' => 'ghijkl', )); $transaction->setParameters($inParams); diff --git a/tests/PaymentBundle/Resources/XliffTest.php b/tests/PaymentBundle/Resources/XliffTest.php index fba364f34..d2679d6ac 100644 --- a/tests/PaymentBundle/Resources/XliffTest.php +++ b/tests/PaymentBundle/Resources/XliffTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/PriceBundle/DependencyInjection/SonataPriceExtensionTest.php b/tests/PriceBundle/DependencyInjection/SonataPriceExtensionTest.php index f59fdd039..002b0c197 100644 --- a/tests/PriceBundle/DependencyInjection/SonataPriceExtensionTest.php +++ b/tests/PriceBundle/DependencyInjection/SonataPriceExtensionTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/PriceBundle/Resources/XliffTest.php b/tests/PriceBundle/Resources/XliffTest.php index 81967dc47..6414b823e 100644 --- a/tests/PriceBundle/Resources/XliffTest.php +++ b/tests/PriceBundle/Resources/XliffTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/ProductBundle/Command/GenerateProductCommandTest.php b/tests/ProductBundle/Command/GenerateProductCommandTest.php index 0d846378e..2d2ea5f13 100644 --- a/tests/ProductBundle/Command/GenerateProductCommandTest.php +++ b/tests/ProductBundle/Command/GenerateProductCommandTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/ProductBundle/Controller/Api/ProductControllerTest.php b/tests/ProductBundle/Controller/Api/ProductControllerTest.php index a6aba2096..ce6bf569a 100644 --- a/tests/ProductBundle/Controller/Api/ProductControllerTest.php +++ b/tests/ProductBundle/Controller/Api/ProductControllerTest.php @@ -1,7 +1,7 @@ * @@ -51,7 +51,7 @@ public function testGetProductActionNotFoundException() public function testGetProductProductcategoriesAction() { - $product = $this->getMock('Sonata\Component\Product\ProductInterface'); + $product = $this->getMock('Sonata\Component\Product\ProductInterface'); $productCategory = $this->getMock('Sonata\Component\Product\ProductCategoryInterface'); $product->expects($this->once())->method('getProductCategories')->will($this->returnValue(array($productCategory))); @@ -60,7 +60,7 @@ public function testGetProductProductcategoriesAction() public function testGetProductCategoriesAction() { - $product = $this->getMock('Sonata\Component\Product\ProductInterface'); + $product = $this->getMock('Sonata\Component\Product\ProductInterface'); $category = $this->getMock('Sonata\ClassificationBundle\Model\CategoryInterface'); $product->expects($this->once())->method('getCategories')->will($this->returnValue(array($category))); @@ -69,7 +69,7 @@ public function testGetProductCategoriesAction() public function testGetProductProductcollectionsAction() { - $product = $this->getMock('Sonata\Component\Product\ProductInterface'); + $product = $this->getMock('Sonata\Component\Product\ProductInterface'); $productCollection = $this->getMock('Sonata\Component\Product\ProductCollectionInterface'); $product->expects($this->once())->method('getProductCollections')->will($this->returnValue(array($productCollection))); @@ -78,7 +78,7 @@ public function testGetProductProductcollectionsAction() public function testGetProductCollectionsAction() { - $product = $this->getMock('Sonata\Component\Product\ProductInterface'); + $product = $this->getMock('Sonata\Component\Product\ProductInterface'); $collection = $this->getMock('Sonata\ClassificationBundle\Model\CollectionInterface'); $product->expects($this->once())->method('getCollections')->will($this->returnValue(array($collection))); @@ -96,7 +96,7 @@ public function testGetProductPackagesAction() public function testGetProductDeliveriesAction() { - $product = $this->getMock('Sonata\Component\Product\ProductInterface'); + $product = $this->getMock('Sonata\Component\Product\ProductInterface'); $delivery = $this->getMock('Sonata\Component\Product\DeliveryInterface'); $product->expects($this->once())->method('getDeliveries')->will($this->returnValue(array($delivery))); @@ -105,7 +105,7 @@ public function testGetProductDeliveriesAction() public function testGetProductVariationsAction() { - $product = $this->getMock('Sonata\Component\Product\ProductInterface'); + $product = $this->getMock('Sonata\Component\Product\ProductInterface'); $variation = $this->getMock('Sonata\Component\Product\ProductInterface'); $product->expects($this->once())->method('getVariations')->will($this->returnValue(array($variation))); diff --git a/tests/ProductBundle/DependencyInjection/ConfigurationTest.php b/tests/ProductBundle/DependencyInjection/ConfigurationTest.php index d4554a612..49d8cf778 100644 --- a/tests/ProductBundle/DependencyInjection/ConfigurationTest.php +++ b/tests/ProductBundle/DependencyInjection/ConfigurationTest.php @@ -1,7 +1,7 @@ * @@ -32,15 +32,15 @@ public function testDefaults() public function validateClass($config) { $this->assertEquals(array( - 'product' => 'Application\\Sonata\\ProductBundle\\Entity\\Product', - 'package' => 'Application\\Sonata\\ProductBundle\\Entity\\Package', - 'product_category' => 'Application\\Sonata\\ProductBundle\\Entity\\ProductCategory', + 'product' => 'Application\\Sonata\\ProductBundle\\Entity\\Product', + 'package' => 'Application\\Sonata\\ProductBundle\\Entity\\Package', + 'product_category' => 'Application\\Sonata\\ProductBundle\\Entity\\ProductCategory', 'product_collection' => 'Application\\Sonata\\ProductBundle\\Entity\\ProductCollection', - 'category' => 'Application\\Sonata\\ClassificationBundle\\Entity\\Category', - 'collection' => 'Application\\Sonata\\ClassificationBundle\\Entity\\Collection', - 'delivery' => 'Application\\Sonata\\ProductBundle\\Entity\\Delivery', - 'media' => 'Application\\Sonata\\MediaBundle\\Entity\\Media', - 'gallery' => 'Application\\Sonata\\MediaBundle\\Entity\\Gallery', + 'category' => 'Application\\Sonata\\ClassificationBundle\\Entity\\Category', + 'collection' => 'Application\\Sonata\\ClassificationBundle\\Entity\\Collection', + 'delivery' => 'Application\\Sonata\\ProductBundle\\Entity\\Delivery', + 'media' => 'Application\\Sonata\\MediaBundle\\Entity\\Media', + 'gallery' => 'Application\\Sonata\\MediaBundle\\Entity\\Gallery', ), $config['class']); } @@ -48,9 +48,9 @@ public function validateSeo($config) { $this->assertEquals(array( 'product' => array( - 'site' => '@sonataproject', - 'creator' => '@th0masr', - 'domain' => 'http://demo.sonata-project.org', + 'site' => '@sonataproject', + 'creator' => '@th0masr', + 'domain' => 'http://demo.sonata-project.org', 'media_prefix' => 'http://demo.sonata-project.org', 'media_format' => 'reference', ), diff --git a/tests/ProductBundle/Entity/BaseProductTest.php b/tests/ProductBundle/Entity/BaseProductTest.php index 65263273d..c80ef9986 100644 --- a/tests/ProductBundle/Entity/BaseProductTest.php +++ b/tests/ProductBundle/Entity/BaseProductTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/ProductBundle/Entity/ProductManagerTest.php b/tests/ProductBundle/Entity/ProductManagerTest.php index af56ad76a..dcb3e3e95 100644 --- a/tests/ProductBundle/Entity/ProductManagerTest.php +++ b/tests/ProductBundle/Entity/ProductManagerTest.php @@ -1,7 +1,7 @@ * @@ -19,24 +19,6 @@ */ class ProductManagerTest extends \PHPUnit_Framework_TestCase { - protected function getProductManager($qbCallback) - { - if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { - $this->markTestSkipped('Not compatible with PHPUnit 5.'); - } - - $em = EntityManagerMockFactory::create($this, $qbCallback, array( - 'sku', - 'slug', - 'name', - )); - - $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); - $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); - - return new ProductManager('Sonata\PageBundle\Entity\BaseProduct', $registry); - } - public function testGetPager() { $self = $this; @@ -87,7 +69,7 @@ public function testGetPagerWithMultipleSort() }) ->getPager(array(), 1, 10, array( 'name' => 'ASC', - 'sku' => 'DESC', + 'sku' => 'DESC', )); } @@ -112,4 +94,22 @@ public function testGetPagerWithDisabledProducts() }) ->getPager(array('enabled' => false), 1); } + + protected function getProductManager($qbCallback) + { + if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) { + $this->markTestSkipped('Not compatible with PHPUnit 5.'); + } + + $em = EntityManagerMockFactory::create($this, $qbCallback, array( + 'sku', + 'slug', + 'name', + )); + + $registry = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); + $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em)); + + return new ProductManager('Sonata\PageBundle\Entity\BaseProduct', $registry); + } } diff --git a/tests/ProductBundle/Form/Type/ApiProductTypeTest.php b/tests/ProductBundle/Form/Type/ApiProductTypeTest.php index 30990264a..db2e1c12d 100644 --- a/tests/ProductBundle/Form/Type/ApiProductTypeTest.php +++ b/tests/ProductBundle/Form/Type/ApiProductTypeTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/ProductBundle/Menu/ProductMenuBuilderTest.php b/tests/ProductBundle/Menu/ProductMenuBuilderTest.php index 3681b5f47..7968d71d4 100644 --- a/tests/ProductBundle/Menu/ProductMenuBuilderTest.php +++ b/tests/ProductBundle/Menu/ProductMenuBuilderTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/ProductBundle/Model/BaseProductProviderTest.php b/tests/ProductBundle/Model/BaseProductProviderTest.php index bcf7d5fa1..ee2c75c93 100644 --- a/tests/ProductBundle/Model/BaseProductProviderTest.php +++ b/tests/ProductBundle/Model/BaseProductProviderTest.php @@ -1,7 +1,7 @@ * @@ -538,7 +538,7 @@ public function testGetVariatedProperties() $expected = array( 'price' => 84, - 'name' => 'variation', + 'name' => 'variation', ); $this->assertEquals($expected, $provider->getVariatedProperties($variation)); @@ -567,7 +567,7 @@ public function testGetVariation() $expected = array( 'price' => 84, - 'name' => 'variation', + 'name' => 'variation', ); $this->assertEquals($variation2, $provider->getVariation($product, array('price' => 42, 'name' => 'avariation'))); diff --git a/tests/ProductBundle/Resources/XliffTest.php b/tests/ProductBundle/Resources/XliffTest.php index b9da04ddf..af6e88d8a 100644 --- a/tests/ProductBundle/Resources/XliffTest.php +++ b/tests/ProductBundle/Resources/XliffTest.php @@ -1,7 +1,7 @@ * diff --git a/tests/ProductBundle/Seo/Services/FacebookTest.php b/tests/ProductBundle/Seo/Services/FacebookTest.php index b631d456a..4c73098f5 100644 --- a/tests/ProductBundle/Seo/Services/FacebookTest.php +++ b/tests/ProductBundle/Seo/Services/FacebookTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Test\ProductBundle\Seo\Services; use Sonata\ProductBundle\Entity\BaseProduct; diff --git a/tests/ProductBundle/Seo/Services/TwitterTest.php b/tests/ProductBundle/Seo/Services/TwitterTest.php index 06c38ba93..3e584b38b 100644 --- a/tests/ProductBundle/Seo/Services/TwitterTest.php +++ b/tests/ProductBundle/Seo/Services/TwitterTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Sonata\Test\ProductBundle\Seo\Services; use Sonata\ProductBundle\Entity\BaseProduct; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 9d5089577..f5dd02580 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,11 +1,11 @@ + * (c) Thomas Rabaix * - * for the full copyright and license information, please view the LICENSE + * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ From 2cf50daa79913c132b219ab58b2d24b5f6dbc661 Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL Date: Fri, 24 Jun 2016 15:01:34 +0200 Subject: [PATCH 3/4] XML lint --- build.xml | 250 ++++------ .../Resources/config/api_controllers.xml | 18 +- .../Resources/config/api_form.xml | 35 +- src/BasketBundle/Resources/config/basket.xml | 31 +- .../Resources/config/basket_entity.xml | 10 +- .../Resources/config/basket_session.xml | 10 +- .../config/doctrine/BaseBasket.orm.xml | 25 +- .../config/doctrine/BaseBasketElement.orm.xml | 9 +- src/BasketBundle/Resources/config/form.xml | 36 +- src/BasketBundle/Resources/config/orm.xml | 10 +- .../Resources/config/routing/api.xml | 11 +- .../Resources/config/routing/basket.xml | 18 +- .../Resources/config/serializer.xml | 15 +- .../config/serializer/Component/Basket.xml | 23 +- .../serializer/Component/BasketElement.xml | 20 +- .../config/serializer/Entity.BaseBasket.xml | 23 +- .../serializer/Entity.BaseBasketElement.xml | 20 +- src/BasketBundle/Resources/config/twig.xml | 13 +- .../Resources/config/validation.xml | 82 ++-- .../Resources/config/validator.xml | 18 +- .../translations/SonataBasketBundle.en.xliff | 7 +- .../translations/SonataBasketBundle.fr.xliff | 7 +- .../translations/validators.en.xliff | 6 +- .../translations/validators.fr.xliff | 6 +- src/CustomerBundle/Resources/config/admin.xml | 21 +- .../Resources/config/api_controllers.xml | 21 +- .../Resources/config/api_form.xml | 23 +- src/CustomerBundle/Resources/config/block.xml | 17 +- .../config/doctrine/BaseAddress.orm.xml | 39 +- .../config/doctrine/BaseCustomer.orm.xml | 38 +- src/CustomerBundle/Resources/config/form.xml | 21 +- src/CustomerBundle/Resources/config/orm.xml | 15 +- .../Resources/config/routing/api.xml | 13 +- .../Resources/config/routing/customer.xml | 14 +- .../Resources/config/seo_block.xml | 15 +- .../Resources/config/serializer.xml | 15 +- .../config/serializer/Entity.BaseAddress.xml | 34 +- .../config/serializer/Entity.BaseCustomer.xml | 32 +- src/CustomerBundle/Resources/config/twig.xml | 14 +- .../Resources/config/validation.xml | 29 +- .../SonataCustomerBundle.en.xliff | 19 +- .../SonataCustomerBundle.fr.xliff | 19 +- .../Resources/config/delivery.xml | 25 +- src/DeliveryBundle/Resources/config/form.xml | 16 +- .../SonataDeliveryBundle.en.xliff | 10 +- .../SonataDeliveryBundle.fr.xliff | 10 +- src/InvoiceBundle/Resources/config/admin.xml | 18 +- .../Resources/config/api_controllers.xml | 10 +- .../config/doctrine/BaseInvoice.orm.xml | 42 +- .../doctrine/BaseInvoiceElement.orm.xml | 20 +- src/InvoiceBundle/Resources/config/form.xml | 12 +- src/InvoiceBundle/Resources/config/orm.xml | 15 +- .../Resources/config/renderer.xml | 11 +- .../Resources/config/routing/api.xml | 11 +- .../Resources/config/routing/invoice.xml | 11 +- .../Resources/config/serializer.xml | 23 +- .../config/serializer/Entity.BaseInvoice.xml | 44 +- .../serializer/Entity.BaseInvoiceElement.xml | 21 +- .../Resources/config/validation.xml | 55 +-- .../translations/SonataInvoiceBundle.en.xliff | 15 +- .../translations/SonataInvoiceBundle.fr.xliff | 13 +- src/OrderBundle/Resources/config/admin.xml | 31 +- .../Resources/config/api_controllers.xml | 10 +- src/OrderBundle/Resources/config/block.xml | 21 +- .../config/doctrine/BaseOrder.orm.xml | 87 ++-- .../config/doctrine/BaseOrderElement.orm.xml | 42 +- src/OrderBundle/Resources/config/form.xml | 12 +- src/OrderBundle/Resources/config/orm.xml | 15 +- .../Resources/config/routing/api.xml | 11 +- .../Resources/config/routing/order.xml | 10 +- .../Resources/config/routing/order_admin.xml | 14 +- .../Resources/config/seo_block.xml | 15 +- .../Resources/config/serializer.xml | 20 +- .../config/serializer/Entity.BaseOrder.xml | 84 ++-- .../serializer/Entity.BaseOrderElement.xml | 40 +- src/OrderBundle/Resources/config/twig.xml | 10 +- .../Resources/config/validation.xml | 91 ++-- .../translations/SonataOrderBundle.en.xliff | 19 +- .../translations/SonataOrderBundle.fr.xliff | 19 +- .../Resources/config/browser.xml | 12 +- .../Resources/config/consumer.xml | 30 +- .../config/doctrine/BaseTransaction.orm.xml | 28 +- src/PaymentBundle/Resources/config/form.xml | 20 +- .../Resources/config/generator.xml | 12 +- src/PaymentBundle/Resources/config/orm.xml | 12 +- .../Resources/config/payment.xml | 85 ++-- .../Resources/config/routing/payment.xml | 12 +- .../config/routing/payment_debug.xml | 10 +- .../Resources/config/selector.xml | 15 +- .../serializer/Entity.BaseTransaction.xml | 20 +- .../Resources/config/transformer.xml | 42 +- .../Resources/config/validation.xml | 20 +- .../translations/SonataPaymentBundle.en.xliff | 437 +++++++++--------- .../translations/SonataPaymentBundle.fr.xliff | 437 +++++++++--------- src/PriceBundle/Resources/config/price.xml | 22 +- src/ProductBundle/Resources/config/admin.xml | 62 +-- .../Resources/config/api_controllers.xml | 16 +- .../Resources/config/api_form.xml | 21 +- src/ProductBundle/Resources/config/block.xml | 58 +-- .../config/doctrine/BaseDelivery.orm.xml | 21 +- .../config/doctrine/BasePackage.orm.xml | 22 +- .../config/doctrine/BaseProduct.orm.xml | 48 +- .../doctrine/BaseProductCategory.orm.xml | 20 +- .../doctrine/BaseProductCollection.orm.xml | 18 +- src/ProductBundle/Resources/config/form.xml | 28 +- src/ProductBundle/Resources/config/menu.xml | 14 +- src/ProductBundle/Resources/config/orm.xml | 25 +- .../Resources/config/product.xml | 39 +- .../Resources/config/routing/api.xml | 11 +- .../Resources/config/routing/catalog.xml | 10 +- .../Resources/config/routing/product.xml | 12 +- .../config/routing/product_admin.xml | 13 +- .../Resources/config/serializer.xml | 15 +- .../config/serializer/Entity.BaseDelivery.xml | 21 +- .../config/serializer/Entity.BasePackage.xml | 21 +- .../config/serializer/Entity.BaseProduct.xml | 46 +- .../serializer/Entity.BaseProductCategory.xml | 17 +- .../Entity.BaseProductCollection.xml | 14 +- src/ProductBundle/Resources/config/twig.xml | 15 +- .../Resources/config/validation.xml | 28 +- .../Resources/config/doctrine/Entity.orm.xml | 10 +- .../translations/SonataProductBundle.en.xliff | 14 +- .../translations/SonataProductBundle.fr.xliff | 14 +- .../translations/validators.en.xliff | 6 +- .../translations/validators.fr.xliff | 6 +- 125 files changed, 1475 insertions(+), 2439 deletions(-) diff --git a/build.xml b/build.xml index 1b6e2573b..095644ef7 100644 --- a/build.xml +++ b/build.xml @@ -1,239 +1,147 @@ - - - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - + + - - - + + + - - - - - + - - - - + + - - - - - + + - - - + - - + - - + - - - - - + + - - - + - - + + - + - - - - + - - + + - - - - + - + + + - + - + - - - + + - - - - - - - - - + + + + - - - - - + + - - - + - - - - + + + + - - - - - - - + + - - - - - + + - - - + - - - - + + + + - - - - - - + + - - - + - - - - - + + + + - - - - + - - - + - diff --git a/src/BasketBundle/Resources/config/api_controllers.xml b/src/BasketBundle/Resources/config/api_controllers.xml index e6ca94e9e..01f36730d 100644 --- a/src/BasketBundle/Resources/config/api_controllers.xml +++ b/src/BasketBundle/Resources/config/api_controllers.xml @@ -1,16 +1,12 @@ - - - - + + - - - - - + + + + + diff --git a/src/BasketBundle/Resources/config/api_form.xml b/src/BasketBundle/Resources/config/api_form.xml index 6e3233cfb..42fa4b6fa 100644 --- a/src/BasketBundle/Resources/config/api_form.xml +++ b/src/BasketBundle/Resources/config/api_form.xml @@ -1,44 +1,31 @@ - - - - + + - - - - - + + + sonata_basket_api_form_basket_parent %sonata.basket.basket.class% sonata_api_write - - - + %sonata.basket.basket.class% - + - - - - - - + + + sonata_basket_api_form_basket_element_parent %sonata.basket.basket_element.class% sonata_api_write - - - + %sonata.basket.basket_element.class% diff --git a/src/BasketBundle/Resources/config/basket.xml b/src/BasketBundle/Resources/config/basket.xml index 081f3a87b..be06d2572 100644 --- a/src/BasketBundle/Resources/config/basket.xml +++ b/src/BasketBundle/Resources/config/basket.xml @@ -1,39 +1,30 @@ - - - - + + Sonata\Component\Customer\CustomerSelector - - - - - + + + + - - + - - - + + - - - + sonata.basket.block.nb_items - + diff --git a/src/BasketBundle/Resources/config/basket_entity.xml b/src/BasketBundle/Resources/config/basket_entity.xml index 85f7e8946..1cff317da 100644 --- a/src/BasketBundle/Resources/config/basket_entity.xml +++ b/src/BasketBundle/Resources/config/basket_entity.xml @@ -1,15 +1,11 @@ - - - - + + - + diff --git a/src/BasketBundle/Resources/config/basket_session.xml b/src/BasketBundle/Resources/config/basket_session.xml index fd976963a..97e9fc4dc 100644 --- a/src/BasketBundle/Resources/config/basket_session.xml +++ b/src/BasketBundle/Resources/config/basket_session.xml @@ -1,15 +1,11 @@ - - - - + + - + diff --git a/src/BasketBundle/Resources/config/doctrine/BaseBasket.orm.xml b/src/BasketBundle/Resources/config/doctrine/BaseBasket.orm.xml index bf5ef2ba9..8b1cc92e3 100644 --- a/src/BasketBundle/Resources/config/doctrine/BaseBasket.orm.xml +++ b/src/BasketBundle/Resources/config/doctrine/BaseBasket.orm.xml @@ -1,19 +1,14 @@ - - + - - - - - - - - - + + + + + + + + + - diff --git a/src/BasketBundle/Resources/config/doctrine/BaseBasketElement.orm.xml b/src/BasketBundle/Resources/config/doctrine/BaseBasketElement.orm.xml index 53278cbd8..30fe5ff35 100644 --- a/src/BasketBundle/Resources/config/doctrine/BaseBasketElement.orm.xml +++ b/src/BasketBundle/Resources/config/doctrine/BaseBasketElement.orm.xml @@ -1,11 +1,6 @@ - - + - @@ -15,7 +10,5 @@ - - diff --git a/src/BasketBundle/Resources/config/form.xml b/src/BasketBundle/Resources/config/form.xml index edea36bad..9de025289 100644 --- a/src/BasketBundle/Resources/config/form.xml +++ b/src/BasketBundle/Resources/config/form.xml @@ -1,36 +1,24 @@ - - - - + + - + - - - + %sonata.customer.address.class% - + - - - - - + + + - - - - - - + + + + - - diff --git a/src/BasketBundle/Resources/config/orm.xml b/src/BasketBundle/Resources/config/orm.xml index 51cdcc788..5506de666 100644 --- a/src/BasketBundle/Resources/config/orm.xml +++ b/src/BasketBundle/Resources/config/orm.xml @@ -1,19 +1,13 @@ - - - - + + %sonata.basket.basket.class% - %sonata.basket.basket_element.class% - diff --git a/src/BasketBundle/Resources/config/routing/api.xml b/src/BasketBundle/Resources/config/routing/api.xml index eb22d271d..829107b2d 100644 --- a/src/BasketBundle/Resources/config/routing/api.xml +++ b/src/BasketBundle/Resources/config/routing/api.xml @@ -1,9 +1,4 @@ - - - - - - + + + diff --git a/src/BasketBundle/Resources/config/routing/basket.xml b/src/BasketBundle/Resources/config/routing/basket.xml index eb60d53f6..255d4ffab 100644 --- a/src/BasketBundle/Resources/config/routing/basket.xml +++ b/src/BasketBundle/Resources/config/routing/basket.xml @@ -1,47 +1,33 @@ - - - - + + SonataBasketBundle:Basket:index - SonataBasketBundle:Basket:addProduct - SonataBasketBundle:Basket:update - SonataBasketBundle:Basket:reset - SonataBasketBundle:Basket:authenticationStep - SonataBasketBundle:Basket:deliveryAddressStep - SonataBasketBundle:Basket:deliveryStep - SonataBasketBundle:Basket:paymentAddressStep - SonataBasketBundle:Basket:paymentStep - SonataBasketBundle:Basket:finalReviewStep - diff --git a/src/BasketBundle/Resources/config/serializer.xml b/src/BasketBundle/Resources/config/serializer.xml index 9c9eee30d..9a36aabdf 100644 --- a/src/BasketBundle/Resources/config/serializer.xml +++ b/src/BasketBundle/Resources/config/serializer.xml @@ -1,16 +1,9 @@ - - - - + + - - - + + - - diff --git a/src/BasketBundle/Resources/config/serializer/Component/Basket.xml b/src/BasketBundle/Resources/config/serializer/Component/Basket.xml index 97decc86e..142bc91d8 100644 --- a/src/BasketBundle/Resources/config/serializer/Component/Basket.xml +++ b/src/BasketBundle/Resources/config/serializer/Component/Basket.xml @@ -1,18 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/BasketBundle/Resources/config/serializer/Component/BasketElement.xml b/src/BasketBundle/Resources/config/serializer/Component/BasketElement.xml index a951a6751..725cb9db6 100644 --- a/src/BasketBundle/Resources/config/serializer/Component/BasketElement.xml +++ b/src/BasketBundle/Resources/config/serializer/Component/BasketElement.xml @@ -1,16 +1,14 @@ - - - - - - - - - - - + + + + + + + + + diff --git a/src/BasketBundle/Resources/config/serializer/Entity.BaseBasket.xml b/src/BasketBundle/Resources/config/serializer/Entity.BaseBasket.xml index 144fa10fd..e3eaaf84a 100644 --- a/src/BasketBundle/Resources/config/serializer/Entity.BaseBasket.xml +++ b/src/BasketBundle/Resources/config/serializer/Entity.BaseBasket.xml @@ -1,18 +1,15 @@ - - - - - - - - - - - - - + + + + + + + + + + diff --git a/src/BasketBundle/Resources/config/serializer/Entity.BaseBasketElement.xml b/src/BasketBundle/Resources/config/serializer/Entity.BaseBasketElement.xml index fbbc9ec44..fcbf6b9d0 100644 --- a/src/BasketBundle/Resources/config/serializer/Entity.BaseBasketElement.xml +++ b/src/BasketBundle/Resources/config/serializer/Entity.BaseBasketElement.xml @@ -1,16 +1,14 @@ - - - - - - - - - - - + + + + + + + + + diff --git a/src/BasketBundle/Resources/config/twig.xml b/src/BasketBundle/Resources/config/twig.xml index 95793b923..0424f5da4 100644 --- a/src/BasketBundle/Resources/config/twig.xml +++ b/src/BasketBundle/Resources/config/twig.xml @@ -1,13 +1,8 @@ - - - - + + - - + + - diff --git a/src/BasketBundle/Resources/config/validation.xml b/src/BasketBundle/Resources/config/validation.xml index 67e60505a..a79b42204 100644 --- a/src/BasketBundle/Resources/config/validation.xml +++ b/src/BasketBundle/Resources/config/validation.xml @@ -1,87 +1,73 @@ - - - + + - - - - + - - - + - - - + - - - + - - - - - - - - - - - - - @@ -91,7 +77,6 @@ - - - - - - + - - - diff --git a/src/BasketBundle/Resources/config/validator.xml b/src/BasketBundle/Resources/config/validator.xml index 51c2acb57..10928a3a9 100644 --- a/src/BasketBundle/Resources/config/validator.xml +++ b/src/BasketBundle/Resources/config/validator.xml @@ -1,18 +1,10 @@ - - - - + + - - - - - + + + - - diff --git a/src/BasketBundle/Resources/translations/SonataBasketBundle.en.xliff b/src/BasketBundle/Resources/translations/SonataBasketBundle.en.xliff index 1bb18caae..59c2c8a31 100644 --- a/src/BasketBundle/Resources/translations/SonataBasketBundle.en.xliff +++ b/src/BasketBundle/Resources/translations/SonataBasketBundle.en.xliff @@ -1,4 +1,4 @@ - + @@ -224,11 +224,11 @@ sonata_basket_address_address2 - + sonata_basket_address_address3 - + sonata_basket_address_postcode @@ -302,7 +302,6 @@ undeliverable_country The %country% is not in our delivery zone for one or several products of your basket. - basket_index_title Your basket diff --git a/src/BasketBundle/Resources/translations/SonataBasketBundle.fr.xliff b/src/BasketBundle/Resources/translations/SonataBasketBundle.fr.xliff index d596e53ef..82bf3741a 100644 --- a/src/BasketBundle/Resources/translations/SonataBasketBundle.fr.xliff +++ b/src/BasketBundle/Resources/translations/SonataBasketBundle.fr.xliff @@ -1,4 +1,4 @@ - + @@ -224,11 +224,11 @@ sonata_basket_address_address2 - + sonata_basket_address_address3 - + sonata_basket_address_postcode @@ -302,7 +302,6 @@ undeliverable_country Le pays %country% n'est pas desservi par nos modes de livraison pour un ou plusieurs éléments de votre panier. - basket_index_title Votre panier diff --git a/src/BasketBundle/Resources/translations/validators.en.xliff b/src/BasketBundle/Resources/translations/validators.en.xliff index a84825bc1..5d51230d2 100644 --- a/src/BasketBundle/Resources/translations/validators.en.xliff +++ b/src/BasketBundle/Resources/translations/validators.en.xliff @@ -1,5 +1,5 @@ - - + + @@ -24,4 +24,4 @@ - \ No newline at end of file + diff --git a/src/BasketBundle/Resources/translations/validators.fr.xliff b/src/BasketBundle/Resources/translations/validators.fr.xliff index e42bf5ee7..541dbf251 100644 --- a/src/BasketBundle/Resources/translations/validators.fr.xliff +++ b/src/BasketBundle/Resources/translations/validators.fr.xliff @@ -1,5 +1,5 @@ - - + + @@ -24,4 +24,4 @@ - \ No newline at end of file + diff --git a/src/CustomerBundle/Resources/config/admin.xml b/src/CustomerBundle/Resources/config/admin.xml index 8679027ba..db25ce063 100644 --- a/src/CustomerBundle/Resources/config/admin.xml +++ b/src/CustomerBundle/Resources/config/admin.xml @@ -1,40 +1,31 @@ - - - + + Sonata\CustomerBundle\Admin\CustomerAdmin SonataAdminBundle:CRUD - Sonata\CustomerBundle\Admin\AddressAdmin SonataAdminBundle:CRUD - - + %sonata.customer.admin.customer.entity% %sonata.customer.admin.customer.controller% - - + - - + - - + %sonata.customer.admin.address.entity% %sonata.customer.admin.address.controller% - diff --git a/src/CustomerBundle/Resources/config/api_controllers.xml b/src/CustomerBundle/Resources/config/api_controllers.xml index 155e81654..4854fc5e2 100644 --- a/src/CustomerBundle/Resources/config/api_controllers.xml +++ b/src/CustomerBundle/Resources/config/api_controllers.xml @@ -1,20 +1,15 @@ - - - - + + - - + + - - - - - + + + + diff --git a/src/CustomerBundle/Resources/config/api_form.xml b/src/CustomerBundle/Resources/config/api_form.xml index cbf02139d..921ece1cd 100644 --- a/src/CustomerBundle/Resources/config/api_form.xml +++ b/src/CustomerBundle/Resources/config/api_form.xml @@ -1,25 +1,18 @@ - - - - + + - - - - + + + sonata_customer_api_form_customer %sonata.customer.admin.customer.entity% sonata_api_write - - - - - + + + sonata_customer_api_form_address %sonata.customer.admin.address.entity% sonata_api_write diff --git a/src/CustomerBundle/Resources/config/block.xml b/src/CustomerBundle/Resources/config/block.xml index 288589159..4b59b168f 100644 --- a/src/CustomerBundle/Resources/config/block.xml +++ b/src/CustomerBundle/Resources/config/block.xml @@ -1,19 +1,12 @@ - - - - + + - sonata.customer.block.recent_customers - - - - + + + - diff --git a/src/CustomerBundle/Resources/config/doctrine/BaseAddress.orm.xml b/src/CustomerBundle/Resources/config/doctrine/BaseAddress.orm.xml index ccd4d8ba2..3a8b96b2a 100644 --- a/src/CustomerBundle/Resources/config/doctrine/BaseAddress.orm.xml +++ b/src/CustomerBundle/Resources/config/doctrine/BaseAddress.orm.xml @@ -1,26 +1,23 @@ - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + diff --git a/src/CustomerBundle/Resources/config/doctrine/BaseCustomer.orm.xml b/src/CustomerBundle/Resources/config/doctrine/BaseCustomer.orm.xml index 24b9f68a5..31de98b53 100644 --- a/src/CustomerBundle/Resources/config/doctrine/BaseCustomer.orm.xml +++ b/src/CustomerBundle/Resources/config/doctrine/BaseCustomer.orm.xml @@ -1,27 +1,23 @@ - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - + - - + + diff --git a/src/CustomerBundle/Resources/config/form.xml b/src/CustomerBundle/Resources/config/form.xml index bbea4a091..c54af5218 100644 --- a/src/CustomerBundle/Resources/config/form.xml +++ b/src/CustomerBundle/Resources/config/form.xml @@ -1,27 +1,18 @@ - - - - + + %sonata.customer.address.class% getTypesList sonata_customer_address - - - + + - %sonata.customer.address.class% getTypesList sonata_customer_address_types - - + - - - \ No newline at end of file + diff --git a/src/CustomerBundle/Resources/config/orm.xml b/src/CustomerBundle/Resources/config/orm.xml index 73b216e9f..3ab475e49 100644 --- a/src/CustomerBundle/Resources/config/orm.xml +++ b/src/CustomerBundle/Resources/config/orm.xml @@ -1,24 +1,17 @@ - - - - + + Sonata\CustomerBundle\Entity\AddressManager Sonata\CustomerBundle\Entity\CustomerManager - %sonata.customer.address.class% - + - %sonata.customer.customer.class% - + - diff --git a/src/CustomerBundle/Resources/config/routing/api.xml b/src/CustomerBundle/Resources/config/routing/api.xml index abe3c5a76..965c470c0 100644 --- a/src/CustomerBundle/Resources/config/routing/api.xml +++ b/src/CustomerBundle/Resources/config/routing/api.xml @@ -1,10 +1,5 @@ - - - - - - - + + + + diff --git a/src/CustomerBundle/Resources/config/routing/customer.xml b/src/CustomerBundle/Resources/config/routing/customer.xml index 4e80e82bf..213efec2f 100644 --- a/src/CustomerBundle/Resources/config/routing/customer.xml +++ b/src/CustomerBundle/Resources/config/routing/customer.xml @@ -1,31 +1,21 @@ - - - - + + SonataCustomerBundle:Customer:addresses - SonataCustomerBundle:Customer:addAddress - SonataCustomerBundle:Customer:deleteAddress - SonataCustomerBundle:Customer:setCurrentAddress - SonataCustomerBundle:Customer:editAddress - SonataCustomerBundle:Customer:updateAddress - diff --git a/src/CustomerBundle/Resources/config/seo_block.xml b/src/CustomerBundle/Resources/config/seo_block.xml index 5356f8c00..11c48568a 100644 --- a/src/CustomerBundle/Resources/config/seo_block.xml +++ b/src/CustomerBundle/Resources/config/seo_block.xml @@ -1,22 +1,17 @@ - - - + + Sonata\CustomerBundle\Block\Breadcrumb\CustomerAddressBreadcrumbBlockService - - customer_address sonata.customer.block.breadcrumb_address - - - + + + diff --git a/src/CustomerBundle/Resources/config/serializer.xml b/src/CustomerBundle/Resources/config/serializer.xml index eb20110ae..132d35b87 100644 --- a/src/CustomerBundle/Resources/config/serializer.xml +++ b/src/CustomerBundle/Resources/config/serializer.xml @@ -1,16 +1,9 @@ - - - - + + - - - + + - - diff --git a/src/CustomerBundle/Resources/config/serializer/Entity.BaseAddress.xml b/src/CustomerBundle/Resources/config/serializer/Entity.BaseAddress.xml index d29a6d695..835e36f3f 100644 --- a/src/CustomerBundle/Resources/config/serializer/Entity.BaseAddress.xml +++ b/src/CustomerBundle/Resources/config/serializer/Entity.BaseAddress.xml @@ -1,24 +1,20 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/CustomerBundle/Resources/config/serializer/Entity.BaseCustomer.xml b/src/CustomerBundle/Resources/config/serializer/Entity.BaseCustomer.xml index 5722f37a8..4856144d0 100644 --- a/src/CustomerBundle/Resources/config/serializer/Entity.BaseCustomer.xml +++ b/src/CustomerBundle/Resources/config/serializer/Entity.BaseCustomer.xml @@ -1,23 +1,19 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/src/CustomerBundle/Resources/config/twig.xml b/src/CustomerBundle/Resources/config/twig.xml index 1646f4bbd..8952e3711 100644 --- a/src/CustomerBundle/Resources/config/twig.xml +++ b/src/CustomerBundle/Resources/config/twig.xml @@ -1,15 +1,9 @@ - - - - + + - - - + + - diff --git a/src/CustomerBundle/Resources/config/validation.xml b/src/CustomerBundle/Resources/config/validation.xml index cf3f61602..b0b8ead23 100644 --- a/src/CustomerBundle/Resources/config/validation.xml +++ b/src/CustomerBundle/Resources/config/validation.xml @@ -1,31 +1,22 @@ - - - + + - + - - + - - + - - + - - + - @@ -35,7 +26,6 @@ - - - - - - diff --git a/src/CustomerBundle/Resources/translations/SonataCustomerBundle.en.xliff b/src/CustomerBundle/Resources/translations/SonataCustomerBundle.en.xliff index c15e2507b..295d784fa 100644 --- a/src/CustomerBundle/Resources/translations/SonataCustomerBundle.en.xliff +++ b/src/CustomerBundle/Resources/translations/SonataCustomerBundle.en.xliff @@ -1,5 +1,5 @@ - - + + @@ -12,7 +12,6 @@ Address - address.form.group_address_label @@ -22,7 +21,6 @@ address.form.group_contact_label Contact - form_address.group_advanced_label Advanced @@ -39,7 +37,6 @@ address.form.group_advanced_label Advanced - form.label_firstname @@ -163,11 +160,11 @@ sonata_customer_address_address2 - + sonata_customer_address_address3 - + sonata_customer_address_postcode @@ -187,7 +184,6 @@ - show.label_firstname @@ -202,7 +198,6 @@ Locale - breadcrumb.link_customer_list @@ -225,7 +220,6 @@ Create address - customer.sidemenu.link_customer_edit @@ -256,7 +250,6 @@ Addresses - list.label_name @@ -315,7 +308,6 @@ Fax - filter.label_firstname @@ -354,7 +346,6 @@ Customer id - type_delivery @@ -369,7 +360,6 @@ Contact - address_new @@ -444,7 +434,6 @@ Set default - sonata_customer_addresses_breadcrumb Addresses diff --git a/src/CustomerBundle/Resources/translations/SonataCustomerBundle.fr.xliff b/src/CustomerBundle/Resources/translations/SonataCustomerBundle.fr.xliff index 9b04aca5c..36dca1e5a 100644 --- a/src/CustomerBundle/Resources/translations/SonataCustomerBundle.fr.xliff +++ b/src/CustomerBundle/Resources/translations/SonataCustomerBundle.fr.xliff @@ -1,5 +1,5 @@ - - + + @@ -12,7 +12,6 @@ Adresse - address.form.group_address_label @@ -22,7 +21,6 @@ address.form.group_contact_label Contact - form_address.group_advanced_label Avancée @@ -39,7 +37,6 @@ address.form.group_advanced_label Avancée - form.label_firstname @@ -163,11 +160,11 @@ sonata_customer_address_address2 - + sonata_customer_address_address3 - + sonata_customer_address_postcode @@ -187,7 +184,6 @@ - show.label_firstname @@ -202,7 +198,6 @@ Locale - breadcrumb.link_customer_list @@ -225,7 +220,6 @@ Création d'adresse - customer.sidemenu.link_customer_edit @@ -256,7 +250,6 @@ Adresses - list.label_name @@ -315,7 +308,6 @@ Fax - filter.label_firstname @@ -354,7 +346,6 @@ ID Client - type_delivery @@ -369,7 +360,6 @@ Contact - address_new @@ -444,7 +434,6 @@ Définir par défaut - sonata_customer_addresses_breadcrumb Adresses diff --git a/src/DeliveryBundle/Resources/config/delivery.xml b/src/DeliveryBundle/Resources/config/delivery.xml index 0c53cd4b4..33e7cd45f 100644 --- a/src/DeliveryBundle/Resources/config/delivery.xml +++ b/src/DeliveryBundle/Resources/config/delivery.xml @@ -1,33 +1,24 @@ - - - - + + Sonata\Component\Delivery\Selector Sonata\Component\Delivery\Pool - - - + - - - + + - + - - + true - - + false diff --git a/src/DeliveryBundle/Resources/config/form.xml b/src/DeliveryBundle/Resources/config/form.xml index 24f90efac..0e0665b92 100644 --- a/src/DeliveryBundle/Resources/config/form.xml +++ b/src/DeliveryBundle/Resources/config/form.xml @@ -1,15 +1,9 @@ - - - - + + - - - - + + + - diff --git a/src/DeliveryBundle/Resources/translations/SonataDeliveryBundle.en.xliff b/src/DeliveryBundle/Resources/translations/SonataDeliveryBundle.en.xliff index fad9a1c88..6ea704ac5 100644 --- a/src/DeliveryBundle/Resources/translations/SonataDeliveryBundle.en.xliff +++ b/src/DeliveryBundle/Resources/translations/SonataDeliveryBundle.en.xliff @@ -1,15 +1,13 @@ - - + + - delivery Delivery - breadcrumb.link_delivery_list @@ -20,7 +18,6 @@ Edit - status_open @@ -83,7 +80,6 @@ Sent - - \ No newline at end of file + diff --git a/src/DeliveryBundle/Resources/translations/SonataDeliveryBundle.fr.xliff b/src/DeliveryBundle/Resources/translations/SonataDeliveryBundle.fr.xliff index 60ccb7cba..54d6a6752 100644 --- a/src/DeliveryBundle/Resources/translations/SonataDeliveryBundle.fr.xliff +++ b/src/DeliveryBundle/Resources/translations/SonataDeliveryBundle.fr.xliff @@ -1,15 +1,13 @@ - - + + - delivery Livraison - breadcrumb.link_delivery_list @@ -20,7 +18,6 @@ Edition - status_open @@ -83,7 +80,6 @@ Envoyé - - \ No newline at end of file + diff --git a/src/InvoiceBundle/Resources/config/admin.xml b/src/InvoiceBundle/Resources/config/admin.xml index ede3cfb00..1d9fb2163 100644 --- a/src/InvoiceBundle/Resources/config/admin.xml +++ b/src/InvoiceBundle/Resources/config/admin.xml @@ -1,23 +1,17 @@ - - - + + Sonata\InvoiceBundle\Admin\InvoiceAdmin - - - + + %sonata.invoice.admin.invoice.entity% - - + - + - diff --git a/src/InvoiceBundle/Resources/config/api_controllers.xml b/src/InvoiceBundle/Resources/config/api_controllers.xml index 249727723..d441838fb 100644 --- a/src/InvoiceBundle/Resources/config/api_controllers.xml +++ b/src/InvoiceBundle/Resources/config/api_controllers.xml @@ -1,12 +1,8 @@ - - - - + + - + diff --git a/src/InvoiceBundle/Resources/config/doctrine/BaseInvoice.orm.xml b/src/InvoiceBundle/Resources/config/doctrine/BaseInvoice.orm.xml index a92f46f69..6b7ce2967 100644 --- a/src/InvoiceBundle/Resources/config/doctrine/BaseInvoice.orm.xml +++ b/src/InvoiceBundle/Resources/config/doctrine/BaseInvoice.orm.xml @@ -1,26 +1,24 @@ - + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/src/InvoiceBundle/Resources/config/doctrine/BaseInvoiceElement.orm.xml b/src/InvoiceBundle/Resources/config/doctrine/BaseInvoiceElement.orm.xml index a476bccb3..ac6151fb1 100644 --- a/src/InvoiceBundle/Resources/config/doctrine/BaseInvoiceElement.orm.xml +++ b/src/InvoiceBundle/Resources/config/doctrine/BaseInvoiceElement.orm.xml @@ -1,15 +1,13 @@ - + - - - - - - - - - - + + + + + + + + diff --git a/src/InvoiceBundle/Resources/config/form.xml b/src/InvoiceBundle/Resources/config/form.xml index 58947b926..f17c5c95d 100644 --- a/src/InvoiceBundle/Resources/config/form.xml +++ b/src/InvoiceBundle/Resources/config/form.xml @@ -1,17 +1,11 @@ - - - - + + %sonata.invoice.invoice.class% getStatusList sonata_invoice_status - - + - diff --git a/src/InvoiceBundle/Resources/config/orm.xml b/src/InvoiceBundle/Resources/config/orm.xml index 5105dbdeb..80311343a 100644 --- a/src/InvoiceBundle/Resources/config/orm.xml +++ b/src/InvoiceBundle/Resources/config/orm.xml @@ -1,24 +1,17 @@ - - - - + + Sonata\InvoiceBundle\Entity\InvoiceManager Sonata\InvoiceBundle\Entity\InvoiceElementManager - %sonata.invoice.invoice.class% - + - %sonata.invoice.invoice_element.class% - + - diff --git a/src/InvoiceBundle/Resources/config/renderer.xml b/src/InvoiceBundle/Resources/config/renderer.xml index 0eda9df6b..c1f8ff71c 100644 --- a/src/InvoiceBundle/Resources/config/renderer.xml +++ b/src/InvoiceBundle/Resources/config/renderer.xml @@ -1,13 +1,8 @@ - - - - + + - + - diff --git a/src/InvoiceBundle/Resources/config/routing/api.xml b/src/InvoiceBundle/Resources/config/routing/api.xml index c111d6aa4..645d0f363 100644 --- a/src/InvoiceBundle/Resources/config/routing/api.xml +++ b/src/InvoiceBundle/Resources/config/routing/api.xml @@ -1,9 +1,4 @@ - - - - - - + + + diff --git a/src/InvoiceBundle/Resources/config/routing/invoice.xml b/src/InvoiceBundle/Resources/config/routing/invoice.xml index b662f1ee5..f924e54b4 100644 --- a/src/InvoiceBundle/Resources/config/routing/invoice.xml +++ b/src/InvoiceBundle/Resources/config/routing/invoice.xml @@ -1,19 +1,12 @@ - - - - + + SonataInvoiceBundle:Invoice:index - SonataInvoiceBundle:Invoice:view - SonataInvoiceBundle:Invoice:download - diff --git a/src/InvoiceBundle/Resources/config/serializer.xml b/src/InvoiceBundle/Resources/config/serializer.xml index 5814c081c..8ea478363 100644 --- a/src/InvoiceBundle/Resources/config/serializer.xml +++ b/src/InvoiceBundle/Resources/config/serializer.xml @@ -1,16 +1,9 @@ - - - - - - - - - - - - - + + + + + + + + diff --git a/src/InvoiceBundle/Resources/config/serializer/Entity.BaseInvoice.xml b/src/InvoiceBundle/Resources/config/serializer/Entity.BaseInvoice.xml index 4cd000170..efedf0f44 100644 --- a/src/InvoiceBundle/Resources/config/serializer/Entity.BaseInvoice.xml +++ b/src/InvoiceBundle/Resources/config/serializer/Entity.BaseInvoice.xml @@ -1,29 +1,25 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/InvoiceBundle/Resources/config/serializer/Entity.BaseInvoiceElement.xml b/src/InvoiceBundle/Resources/config/serializer/Entity.BaseInvoiceElement.xml index 8fac3d205..14d619b43 100644 --- a/src/InvoiceBundle/Resources/config/serializer/Entity.BaseInvoiceElement.xml +++ b/src/InvoiceBundle/Resources/config/serializer/Entity.BaseInvoiceElement.xml @@ -1,17 +1,14 @@ - - - - - - - - - - - - + + + + + + + + + diff --git a/src/InvoiceBundle/Resources/config/validation.xml b/src/InvoiceBundle/Resources/config/validation.xml index 0a7316b38..9b4c07837 100644 --- a/src/InvoiceBundle/Resources/config/validation.xml +++ b/src/InvoiceBundle/Resources/config/validation.xml @@ -1,75 +1,56 @@ - - - + + - + - - + - - + - - + - - + - - + - - + - - + - - + - - - + + - - + - - + - - + - - + - - + - diff --git a/src/InvoiceBundle/Resources/translations/SonataInvoiceBundle.en.xliff b/src/InvoiceBundle/Resources/translations/SonataInvoiceBundle.en.xliff index 53e3e4f77..ec37e5a9d 100644 --- a/src/InvoiceBundle/Resources/translations/SonataInvoiceBundle.en.xliff +++ b/src/InvoiceBundle/Resources/translations/SonataInvoiceBundle.en.xliff @@ -1,8 +1,7 @@ - - + + - invoice @@ -17,7 +16,6 @@ Payment - breadcrumb.link_invoice_list @@ -28,7 +26,6 @@ Edit - list.label_id @@ -55,7 +52,6 @@ Total incl. VAT - invoice.form.group_main_label @@ -69,7 +65,6 @@ invoice.form.group_misc_label Miscellaneous - form.label_reference Reference @@ -90,7 +85,6 @@ form.label_total_excl Total excl. VAT - form.label_name Name @@ -140,7 +134,6 @@ Customer - status_open @@ -155,7 +148,6 @@ Conflict - filter.label_reference @@ -170,7 +162,6 @@ Status - sonata.invoice.subtitle_billing @@ -233,14 +224,12 @@ Total VAT - invoice_view_title Your invoice - diff --git a/src/InvoiceBundle/Resources/translations/SonataInvoiceBundle.fr.xliff b/src/InvoiceBundle/Resources/translations/SonataInvoiceBundle.fr.xliff index 787c95feb..707633e6c 100644 --- a/src/InvoiceBundle/Resources/translations/SonataInvoiceBundle.fr.xliff +++ b/src/InvoiceBundle/Resources/translations/SonataInvoiceBundle.fr.xliff @@ -1,8 +1,7 @@ - - + + - invoice @@ -17,7 +16,6 @@ Paiement - breadcrumb.link_invoice_list @@ -28,7 +26,6 @@ Edition - list.label_id @@ -55,7 +52,6 @@ Total TTC - invoice.form.group_main_label @@ -69,7 +65,6 @@ invoice.form.group_misc_label Divers - form.label_reference Référence @@ -90,7 +85,6 @@ form.label_total_excl Total TTC - form.label_name Nom @@ -140,7 +134,6 @@ Client - status_open @@ -155,7 +148,6 @@ En conflict - filter.label_reference @@ -170,7 +162,6 @@ Statut - sonata.invoice.subtitle_billing diff --git a/src/OrderBundle/Resources/config/admin.xml b/src/OrderBundle/Resources/config/admin.xml index 16f2ae727..922f78351 100644 --- a/src/OrderBundle/Resources/config/admin.xml +++ b/src/OrderBundle/Resources/config/admin.xml @@ -1,48 +1,41 @@ - - - + + Sonata\OrderBundle\Admin\OrderAdmin SonataOrderBundle:OrderCRUD - Sonata\OrderBundle\Admin\OrderElementAdmin SonataAdminBundle:CRUD - - - + + %sonata.order.admin.order.entity% %sonata.order.admin.order.controller% - + - + - + - + - - - + + %sonata.order.admin.order_element.entity% %sonata.order.admin.order_element.controller% - + - + - diff --git a/src/OrderBundle/Resources/config/api_controllers.xml b/src/OrderBundle/Resources/config/api_controllers.xml index d23e5b38c..b3fe600c4 100644 --- a/src/OrderBundle/Resources/config/api_controllers.xml +++ b/src/OrderBundle/Resources/config/api_controllers.xml @@ -1,12 +1,8 @@ - - - - + + - + diff --git a/src/OrderBundle/Resources/config/block.xml b/src/OrderBundle/Resources/config/block.xml index cde23e05e..24ce1862b 100644 --- a/src/OrderBundle/Resources/config/block.xml +++ b/src/OrderBundle/Resources/config/block.xml @@ -1,21 +1,14 @@ - - - - + + - sonata.order.block.recent_orders - - - - - - + + + + + - diff --git a/src/OrderBundle/Resources/config/doctrine/BaseOrder.orm.xml b/src/OrderBundle/Resources/config/doctrine/BaseOrder.orm.xml index c50f7ffad..418ea4a44 100644 --- a/src/OrderBundle/Resources/config/doctrine/BaseOrder.orm.xml +++ b/src/OrderBundle/Resources/config/doctrine/BaseOrder.orm.xml @@ -1,52 +1,47 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/src/OrderBundle/Resources/config/doctrine/BaseOrderElement.orm.xml b/src/OrderBundle/Resources/config/doctrine/BaseOrderElement.orm.xml index 306d76d8d..6bc2d2aba 100644 --- a/src/OrderBundle/Resources/config/doctrine/BaseOrderElement.orm.xml +++ b/src/OrderBundle/Resources/config/doctrine/BaseOrderElement.orm.xml @@ -1,29 +1,25 @@ - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + diff --git a/src/OrderBundle/Resources/config/form.xml b/src/OrderBundle/Resources/config/form.xml index 74a401d21..3eac4b08d 100644 --- a/src/OrderBundle/Resources/config/form.xml +++ b/src/OrderBundle/Resources/config/form.xml @@ -1,17 +1,11 @@ - - - - + + %sonata.order.order.class% getStatusList sonata_order_status - - + - diff --git a/src/OrderBundle/Resources/config/orm.xml b/src/OrderBundle/Resources/config/orm.xml index 29f8d6716..64a6e6ef0 100644 --- a/src/OrderBundle/Resources/config/orm.xml +++ b/src/OrderBundle/Resources/config/orm.xml @@ -1,24 +1,17 @@ - - - - + + Sonata\OrderBundle\Entity\OrderManager Sonata\OrderBundle\Entity\OrderElementManager - %sonata.order.order.class% - + - %sonata.order.order_element.class% - + - diff --git a/src/OrderBundle/Resources/config/routing/api.xml b/src/OrderBundle/Resources/config/routing/api.xml index a1cd1476f..30313701f 100644 --- a/src/OrderBundle/Resources/config/routing/api.xml +++ b/src/OrderBundle/Resources/config/routing/api.xml @@ -1,9 +1,4 @@ - - - - - - + + + diff --git a/src/OrderBundle/Resources/config/routing/order.xml b/src/OrderBundle/Resources/config/routing/order.xml index 379fe5882..21cde89c7 100644 --- a/src/OrderBundle/Resources/config/routing/order.xml +++ b/src/OrderBundle/Resources/config/routing/order.xml @@ -1,17 +1,11 @@ - - - - + + SonataOrderBundle:Order:index - SonataOrderBundle:Order:view - SonataOrderBundle:Order:view diff --git a/src/OrderBundle/Resources/config/routing/order_admin.xml b/src/OrderBundle/Resources/config/routing/order_admin.xml index 7b432c32c..76ff5c969 100644 --- a/src/OrderBundle/Resources/config/routing/order_admin.xml +++ b/src/OrderBundle/Resources/config/routing/order_admin.xml @@ -1,31 +1,21 @@ - - - - + + SonataOrderBundle:OrderAdmin:index - SonataOrderBundle:OrderAdmin:view - SonataOrderBundle:OrderAdmin:download - SonataOrderBundle:OrderAdmin:update - SonataOrderBundle:OrderAdmin:viewOrderElement - SonataOrderBundle:OrderAdmin:updateOrderElement - diff --git a/src/OrderBundle/Resources/config/seo_block.xml b/src/OrderBundle/Resources/config/seo_block.xml index 939d4e7c5..ba4abeade 100644 --- a/src/OrderBundle/Resources/config/seo_block.xml +++ b/src/OrderBundle/Resources/config/seo_block.xml @@ -1,22 +1,17 @@ - - - + + Sonata\OrderBundle\Block\Breadcrumb\UserOrderBreadcrumbBlockService - - user_order sonata.order.block.breadcrumb_order - - - + + + diff --git a/src/OrderBundle/Resources/config/serializer.xml b/src/OrderBundle/Resources/config/serializer.xml index a125688e1..4443784ef 100644 --- a/src/OrderBundle/Resources/config/serializer.xml +++ b/src/OrderBundle/Resources/config/serializer.xml @@ -1,21 +1,13 @@ - - - - + + - - - + + - - - + + - - diff --git a/src/OrderBundle/Resources/config/serializer/Entity.BaseOrder.xml b/src/OrderBundle/Resources/config/serializer/Entity.BaseOrder.xml index 44a6375af..7bb6462f8 100644 --- a/src/OrderBundle/Resources/config/serializer/Entity.BaseOrder.xml +++ b/src/OrderBundle/Resources/config/serializer/Entity.BaseOrder.xml @@ -1,50 +1,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/OrderBundle/Resources/config/serializer/Entity.BaseOrderElement.xml b/src/OrderBundle/Resources/config/serializer/Entity.BaseOrderElement.xml index ef8bf5d24..1b14d2a02 100644 --- a/src/OrderBundle/Resources/config/serializer/Entity.BaseOrderElement.xml +++ b/src/OrderBundle/Resources/config/serializer/Entity.BaseOrderElement.xml @@ -1,28 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/src/OrderBundle/Resources/config/twig.xml b/src/OrderBundle/Resources/config/twig.xml index fa99731de..ab019f602 100644 --- a/src/OrderBundle/Resources/config/twig.xml +++ b/src/OrderBundle/Resources/config/twig.xml @@ -1,12 +1,8 @@ - - - - + + - + diff --git a/src/OrderBundle/Resources/config/validation.xml b/src/OrderBundle/Resources/config/validation.xml index 2a664d72d..f1f618be6 100644 --- a/src/OrderBundle/Resources/config/validation.xml +++ b/src/OrderBundle/Resources/config/validation.xml @@ -1,118 +1,87 @@ - - - + + - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - - + + - - + - - + - - + - - + - - + - - - + + - - + - - + - - + - - + - - + - - + - - + - - + - - diff --git a/src/OrderBundle/Resources/translations/SonataOrderBundle.en.xliff b/src/OrderBundle/Resources/translations/SonataOrderBundle.en.xliff index f4e58791c..bbbef29bc 100644 --- a/src/OrderBundle/Resources/translations/SonataOrderBundle.en.xliff +++ b/src/OrderBundle/Resources/translations/SonataOrderBundle.en.xliff @@ -1,8 +1,7 @@ - - + + - order @@ -13,7 +12,6 @@ Your order - sonata.order.sidemenu.link_order_edit @@ -32,7 +30,6 @@ Generate invoice - breadcrumb.link_order_list @@ -63,20 +60,17 @@ Create element - oRDER_TO_INVOICE_generate_success Invoice generated with success - order_element.form.group_main_label General - order.form.group_main_label General @@ -94,7 +88,6 @@ Misc - filter.label_reference @@ -125,7 +118,6 @@ Payment Status - list.label_id @@ -204,7 +196,6 @@ Delivery status - status_open @@ -255,7 +246,6 @@ Stopped - form.label_locale Locale @@ -397,7 +387,6 @@ Description - sonata.order.view.in_progress_title @@ -520,7 +509,6 @@ Delivery status - sonata.order.invoice_generate_confirm_title @@ -539,7 +527,6 @@ Generate invoice - order_list @@ -554,7 +541,6 @@ View all orders - order_index_title @@ -565,7 +551,6 @@ Your order - sonata_order_user_breadcrumb Orders diff --git a/src/OrderBundle/Resources/translations/SonataOrderBundle.fr.xliff b/src/OrderBundle/Resources/translations/SonataOrderBundle.fr.xliff index 426ccfe57..f4a2ef816 100644 --- a/src/OrderBundle/Resources/translations/SonataOrderBundle.fr.xliff +++ b/src/OrderBundle/Resources/translations/SonataOrderBundle.fr.xliff @@ -1,8 +1,7 @@ - - + + - order @@ -13,7 +12,6 @@ Votre commande - sonata.order.sidemenu.link_order_edit @@ -32,7 +30,6 @@ Générer la facture - breadcrumb.link_order_list @@ -63,20 +60,17 @@ Création d'un élément - oRDER_TO_INVOICE_generate_success Facture générée avec succès - order_element.form.group_main_label Générale - order.form.group_main_label Général @@ -94,7 +88,6 @@ Divers - filter.label_reference @@ -125,7 +118,6 @@ Statut paiement - list.label_id @@ -204,7 +196,6 @@ Statut de livraison - status_open @@ -255,7 +246,6 @@ Arrêté - form.label_locale Locale @@ -397,7 +387,6 @@ Description - sonata.order.view.in_progress_title @@ -520,7 +509,6 @@ Statut Livraison - sonata.order.invoice_generate_confirm_title @@ -539,7 +527,6 @@ Générer la facture - order_list @@ -554,7 +541,6 @@ Voir toutes les commandes - order_index_title @@ -565,7 +551,6 @@ Votre commande - sonata_order_user_breadcrumb Commandes diff --git a/src/PaymentBundle/Resources/config/browser.xml b/src/PaymentBundle/Resources/config/browser.xml index fd9b3de1d..0d02d3060 100644 --- a/src/PaymentBundle/Resources/config/browser.xml +++ b/src/PaymentBundle/Resources/config/browser.xml @@ -1,23 +1,15 @@ - - - - + + - - - - diff --git a/src/PaymentBundle/Resources/config/consumer.xml b/src/PaymentBundle/Resources/config/consumer.xml index dfd544480..b3f53a1fc 100644 --- a/src/PaymentBundle/Resources/config/consumer.xml +++ b/src/PaymentBundle/Resources/config/consumer.xml @@ -1,28 +1,20 @@ - - - + + Sonata\PaymentBundle\Consumer\PaymentProcessOrderConsumer Sonata\PaymentBundle\Consumer\PaymentProcessOrderElementConsumer - - - - - - - + + + + + - - - - - - + + + + - diff --git a/src/PaymentBundle/Resources/config/doctrine/BaseTransaction.orm.xml b/src/PaymentBundle/Resources/config/doctrine/BaseTransaction.orm.xml index b3002ef6b..193d8b86e 100644 --- a/src/PaymentBundle/Resources/config/doctrine/BaseTransaction.orm.xml +++ b/src/PaymentBundle/Resources/config/doctrine/BaseTransaction.orm.xml @@ -1,18 +1,12 @@ - - - - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/PaymentBundle/Resources/config/form.xml b/src/PaymentBundle/Resources/config/form.xml index 4a95f920c..a0f3e0258 100644 --- a/src/PaymentBundle/Resources/config/form.xml +++ b/src/PaymentBundle/Resources/config/form.xml @@ -1,17 +1,11 @@ - - - - + + - %sonata.payment.transaction.class% - getStatusList - sonata_payment_transaction_status - - - + %sonata.payment.transaction.class% + getStatusList + sonata_payment_transaction_status + + - diff --git a/src/PaymentBundle/Resources/config/generator.xml b/src/PaymentBundle/Resources/config/generator.xml index 86635953f..19fd7d9c5 100644 --- a/src/PaymentBundle/Resources/config/generator.xml +++ b/src/PaymentBundle/Resources/config/generator.xml @@ -1,17 +1,11 @@ - - - - + + Sonata\Component\Generator\MysqlReference - - + - diff --git a/src/PaymentBundle/Resources/config/orm.xml b/src/PaymentBundle/Resources/config/orm.xml index 28a903832..c1b704a97 100644 --- a/src/PaymentBundle/Resources/config/orm.xml +++ b/src/PaymentBundle/Resources/config/orm.xml @@ -1,18 +1,12 @@ - - - - + + Sonata\PaymentBundle\Entity\TransactionManager - %sonata.payment.transaction.class% - + - diff --git a/src/PaymentBundle/Resources/config/payment.xml b/src/PaymentBundle/Resources/config/payment.xml index c447b9164..59c1c54ed 100644 --- a/src/PaymentBundle/Resources/config/payment.xml +++ b/src/PaymentBundle/Resources/config/payment.xml @@ -1,9 +1,5 @@ - - - - + + Sonata\Component\Payment\Pool Sonata\Component\Payment\PaymentHandler @@ -16,70 +12,53 @@ Sonata\Component\Payment\Debug\DebugPayment Sonata\Component\Payment\Ogone\OgonePayment - - - + - - - + + - - - - - - + + + + - - - - - + + + - - - - - - - + + + + + %kernel.debug% - - - - + + - - - - + + + - - - - - - + + + + %kernel.debug% - - - - - - - + + + + + + - - diff --git a/src/PaymentBundle/Resources/config/routing/payment.xml b/src/PaymentBundle/Resources/config/routing/payment.xml index 92a67d739..04f29212f 100644 --- a/src/PaymentBundle/Resources/config/routing/payment.xml +++ b/src/PaymentBundle/Resources/config/routing/payment.xml @@ -1,25 +1,17 @@ - - - - + + SonataPaymentBundle:Payment:confirmation - SonataPaymentBundle:Payment:error - SonataPaymentBundle:Payment:sendbank - SonataPaymentBundle:Payment:callback - SonataPaymentBundle:Payment:terms diff --git a/src/PaymentBundle/Resources/config/routing/payment_debug.xml b/src/PaymentBundle/Resources/config/routing/payment_debug.xml index dcb31777d..8d1ade6e8 100644 --- a/src/PaymentBundle/Resources/config/routing/payment_debug.xml +++ b/src/PaymentBundle/Resources/config/routing/payment_debug.xml @@ -1,15 +1,9 @@ - - - - + + SonataPaymentBundle:DebugPayment:payment - SonataPaymentBundle:DebugPayment:processPayment - diff --git a/src/PaymentBundle/Resources/config/selector.xml b/src/PaymentBundle/Resources/config/selector.xml index 08b1e0bd8..77148d2ed 100644 --- a/src/PaymentBundle/Resources/config/selector.xml +++ b/src/PaymentBundle/Resources/config/selector.xml @@ -1,15 +1,10 @@ - - - - + + - - - + + + - diff --git a/src/PaymentBundle/Resources/config/serializer/Entity.BaseTransaction.xml b/src/PaymentBundle/Resources/config/serializer/Entity.BaseTransaction.xml index d20c3fc7d..f90276017 100644 --- a/src/PaymentBundle/Resources/config/serializer/Entity.BaseTransaction.xml +++ b/src/PaymentBundle/Resources/config/serializer/Entity.BaseTransaction.xml @@ -1,17 +1,13 @@ - - - - - - - - - - - - + + + + + + + + diff --git a/src/PaymentBundle/Resources/config/transformer.xml b/src/PaymentBundle/Resources/config/transformer.xml index 96b5cfc6e..afc12d00c 100644 --- a/src/PaymentBundle/Resources/config/transformer.xml +++ b/src/PaymentBundle/Resources/config/transformer.xml @@ -1,40 +1,28 @@ - - - - + + Sonata\Component\Transformer\BasketTransformer Sonata\Component\Transformer\InvoiceTransformer - - - + - - - - + + + - - - - - - + + + + - - - - - - - + + + + + - diff --git a/src/PaymentBundle/Resources/config/validation.xml b/src/PaymentBundle/Resources/config/validation.xml index bd2f718e0..2fb01053f 100644 --- a/src/PaymentBundle/Resources/config/validation.xml +++ b/src/PaymentBundle/Resources/config/validation.xml @@ -1,25 +1,17 @@ - - - + + - + - - + - - + - - + - diff --git a/src/PaymentBundle/Resources/translations/SonataPaymentBundle.en.xliff b/src/PaymentBundle/Resources/translations/SonataPaymentBundle.en.xliff index 287b53376..1ecd104ca 100644 --- a/src/PaymentBundle/Resources/translations/SonataPaymentBundle.en.xliff +++ b/src/PaymentBundle/Resources/translations/SonataPaymentBundle.en.xliff @@ -1,173 +1,172 @@ - + - - - - basket_not_valid - Your basket is not valid. - - - basket_not_valid_with_current_payment_method - Your basket is not valid with the current payment method. - - - message_error_payment - There is an error. Your payment can’t be completed. - - - message_not_validated_payment - Your payment can’t be validated. - - - message_pending_payment - Your payment is pending. - - - message_validation_payment - + + + + basket_not_valid + Your basket is not valid. + + + basket_not_valid_with_current_payment_method + Your basket is not valid with the current payment method. + + + message_error_payment + There is an error. Your payment can’t be completed. + + + message_not_validated_payment + Your payment can’t be validated. + + + message_pending_payment + Your payment is pending. + + + message_validation_payment + You can view your order history by going to the your account page and by clicking on 'Orders'.
- Thanks for shopping with us online!]]> -
-
- - title_error_payment - Payment error - - - title_not_validated_confirmation_payment - Confirmation payment invalid - - - title_pending_confirmation_payment - Confirmation payment pending - - - title_validation_confirmation_payment - Confirmation payment valid - - - process_to_paiement_bank_page - Process to paiement (bank page) - - - process_to_paiement_btn - Check out - - - status_stopped - Stopped - - - status_open - Open - - - status_pending - Pending - - - status_validated - Validated - - - status_cancelled - Cancelled - - - status_error - Error - - - contract_status_sent_to_user - Sent to user - - - contract_status_to_send - To send - - - contract_status_waiting_customer - Waiting customer - - - contract_status_validated - Validated - - - contract_status_canceled - Canceled - - - contract_status_expired - Expired - - - order_unknown - Order unknown - - - open - Open - - - pending - Pending - - - validated - Validated - - - cancelled - Cancelled - - - status_unknown - Unknown - - - error_validation - Error validation - - - wrong_callback - Wrong callback - - - wrong_request - Wrong request - - - order_to_open - Order to open - - - method - Method - - - message_view_order_payment - Check your order - - - message_view_user_profile - Go to your profile - - - debug_payment_title - Payment simulation - - - debug_payment_alert_title - Warning! - - - debug_payment_alert_text - Debug payment method is for debug purpose only. Do not use in a production environment. - - - debug_payment_help - + + + title_error_payment + Payment error + + + title_not_validated_confirmation_payment + Confirmation payment invalid + + + title_pending_confirmation_payment + Confirmation payment pending + + + title_validation_confirmation_payment + Confirmation payment valid + + + process_to_paiement_bank_page + Process to paiement (bank page) + + + process_to_paiement_btn + Check out + + + status_stopped + Stopped + + + status_open + Open + + + status_pending + Pending + + + status_validated + Validated + + + status_cancelled + Cancelled + + + status_error + Error + + + contract_status_sent_to_user + Sent to user + + + contract_status_to_send + To send + + + contract_status_waiting_customer + Waiting customer + + + contract_status_validated + Validated + + + contract_status_canceled + Canceled + + + contract_status_expired + Expired + + + order_unknown + Order unknown + + + open + Open + + + pending + Pending + + + validated + Validated + + + cancelled + Cancelled + + + status_unknown + Unknown + + + error_validation + Error validation + + + wrong_callback + Wrong callback + + + wrong_request + Wrong request + + + order_to_open + Order to open + + + method + Method + + + message_view_order_payment + Check your order + + + message_view_user_profile + Go to your profile + + + debug_payment_title + Payment simulation + + + debug_payment_alert_title + Warning! + + + debug_payment_alert_text + Debug payment method is for debug purpose only. Do not use in a production environment. + + + debug_payment_help +
    @@ -176,55 +175,55 @@
  • Cancel payment : Simulates a cancellation (payment cancelled by the user before submitted to the bank).
]]>
-
- - debug_payment_ok_action - Bank action : Accept payment - - - debug_payment_ko_action - Bank action : Refuse payment - - - debug_payment_cancel_action - User action : Cancel payment - - - debug_payment_data_title - Order details - - - debug_payment_data_header - These are some data stored in your current order. - - - debug_payment_id - Id - - - debug_payment_reference - Reference - - - debug_payment_status - Status - - - debug_payment_payment_status - Payment status - - - debug_payment_delivery_status - Delivery status - - - debug_payment_payment_method - Payment method - - - debug_payment_delivery_method - Delivery method - - -
+
+ + debug_payment_ok_action + Bank action : Accept payment + + + debug_payment_ko_action + Bank action : Refuse payment + + + debug_payment_cancel_action + User action : Cancel payment + + + debug_payment_data_title + Order details + + + debug_payment_data_header + These are some data stored in your current order. + + + debug_payment_id + Id + + + debug_payment_reference + Reference + + + debug_payment_status + Status + + + debug_payment_payment_status + Payment status + + + debug_payment_delivery_status + Delivery status + + + debug_payment_payment_method + Payment method + + + debug_payment_delivery_method + Delivery method + + +
diff --git a/src/PaymentBundle/Resources/translations/SonataPaymentBundle.fr.xliff b/src/PaymentBundle/Resources/translations/SonataPaymentBundle.fr.xliff index 322688231..ffc55cac6 100644 --- a/src/PaymentBundle/Resources/translations/SonataPaymentBundle.fr.xliff +++ b/src/PaymentBundle/Resources/translations/SonataPaymentBundle.fr.xliff @@ -1,173 +1,172 @@ - + - - - - basket_not_valid - Le panier n'est pas valide. - - - basket_not_valid_with_current_payment_method - Le panier n'est pas valide avec la méthode paiement actuelle. - - - message_error_payment - Erreur du paiement. - - - message_not_validated_payment - Paiement non valide. - - - message_pending_payment - Paiement en attente. - - - message_validation_payment - + + + + basket_not_valid + Le panier n'est pas valide. + + + basket_not_valid_with_current_payment_method + Le panier n'est pas valide avec la méthode paiement actuelle. + + + message_error_payment + Erreur du paiement. + + + message_not_validated_payment + Paiement non valide. + + + message_pending_payment + Paiement en attente. + + + message_validation_payment + Vous pouvez visualiser l'historique de vos commandes en allant sur la page de votre compte puis en cliquant sur 'Mes commandes'.
- Merci d'avoir acheté en ligne avec nous !]]> -
-
- - title_error_payment - Erreur de paiement - - - title_not_validated_confirmation_payment - Confirmation de paiement non valide - - - title_pending_confirmation_payment - Confirmation de paiement en attente - - - title_validation_confirmation_payment - Confirmation de paiement valide - - - process_to_paiement_bank_page - Procéder au paiement (page blanche) - - - process_to_paiement_btn - Payer - - - status_stopped - Arrêtée - - - status_open - En cours - - - status_pending - En attente - - - status_validated - Validée - - - status_cancelled - Annulée - - - status_error - En erreur - - - contract_status_sent_to_user - Envoyé au client - - - contract_status_to_send - A envoyer - - - contract_status_waiting_customer - En attente du client - - - contract_status_validated - Validé - - - contract_status_canceled - Annulé - - - contract_status_expired - Expiré - - - order_unknown - Commande inconnue - - - open - Ouvert - - - pending - En attente - - - validated - Validé - - - cancelled - Annulé - - - status_unknown - Inconnu - - - error_validation - Erreur de validation - - - wrong_callback - Erreur de callback - - - wrong_request - Erreur de requête - - - order_to_open - Commande à ouvrir - - - method - Méthode - - - message_view_order_payment - Vérifier votre commande - - - message_view_user_profile - Aller à votre profil - - - debug_payment_title - Simulateur de paiement - - - debug_payment_alert_title - Attention! - - - debug_payment_alert_text - Ce moyen de paiement est réservé au développement. Ne pas utiliser en production. - - - debug_payment_help - + + + title_error_payment + Erreur de paiement + + + title_not_validated_confirmation_payment + Confirmation de paiement non valide + + + title_pending_confirmation_payment + Confirmation de paiement en attente + + + title_validation_confirmation_payment + Confirmation de paiement valide + + + process_to_paiement_bank_page + Procéder au paiement (page blanche) + + + process_to_paiement_btn + Payer + + + status_stopped + Arrêtée + + + status_open + En cours + + + status_pending + En attente + + + status_validated + Validée + + + status_cancelled + Annulée + + + status_error + En erreur + + + contract_status_sent_to_user + Envoyé au client + + + contract_status_to_send + A envoyer + + + contract_status_waiting_customer + En attente du client + + + contract_status_validated + Validé + + + contract_status_canceled + Annulé + + + contract_status_expired + Expiré + + + order_unknown + Commande inconnue + + + open + Ouvert + + + pending + En attente + + + validated + Validé + + + cancelled + Annulé + + + status_unknown + Inconnu + + + error_validation + Erreur de validation + + + wrong_callback + Erreur de callback + + + wrong_request + Erreur de requête + + + order_to_open + Commande à ouvrir + + + method + Méthode + + + message_view_order_payment + Vérifier votre commande + + + message_view_user_profile + Aller à votre profil + + + debug_payment_title + Simulateur de paiement + + + debug_payment_alert_title + Attention! + + + debug_payment_alert_text + Ce moyen de paiement est réservé au développement. Ne pas utiliser en production. + + + debug_payment_help +
    @@ -176,55 +175,55 @@
  • Annuler le paiement : Simule une annulation (paiement annulé par l'utilisateur avant l'envoi à la banque).
]]>
-
- - debug_payment_ok_action - Action de la banque : Accepter le paiement - - - debug_payment_ko_action - Action de la banque : Refuser le paiement - - - debug_payment_cancel_action - Action de l'utilisateur : Annuler le paiement - - - debug_payment_data_title - Détails de la commande - - - debug_payment_data_header - Voici quelques informations utiles enregistrées dans votre commande actuelle. - - - debug_payment_id - Id - - - debug_payment_reference - Référence - - - debug_payment_status - Etat de la commande - - - debug_payment_payment_status - Etat du paiement - - - debug_payment_delivery_status - Etat de la livraison - - - debug_payment_payment_method - Méthode de paiement - - - debug_payment_delivery_method - Méthode de livraison - - -
+
+ + debug_payment_ok_action + Action de la banque : Accepter le paiement + + + debug_payment_ko_action + Action de la banque : Refuser le paiement + + + debug_payment_cancel_action + Action de l'utilisateur : Annuler le paiement + + + debug_payment_data_title + Détails de la commande + + + debug_payment_data_header + Voici quelques informations utiles enregistrées dans votre commande actuelle. + + + debug_payment_id + Id + + + debug_payment_reference + Référence + + + debug_payment_status + Etat de la commande + + + debug_payment_payment_status + Etat du paiement + + + debug_payment_delivery_status + Etat de la livraison + + + debug_payment_payment_method + Méthode de paiement + + + debug_payment_delivery_method + Méthode de livraison + + +
diff --git a/src/PriceBundle/Resources/config/price.xml b/src/PriceBundle/Resources/config/price.xml index 517388a75..77f692795 100644 --- a/src/PriceBundle/Resources/config/price.xml +++ b/src/PriceBundle/Resources/config/price.xml @@ -1,9 +1,5 @@ - - - - + + Sonata\Component\Currency\CurrencyDetector Sonata\Component\Currency\CurrencyManager @@ -11,28 +7,22 @@ Sonata\Component\Currency\CurrencyDataTransformer Sonata\Component\Currency\CurrencyFormType - %sonata.price.currency.manager.class% - - - + %sonata.price.currency% - + - - + - - + - diff --git a/src/ProductBundle/Resources/config/admin.xml b/src/ProductBundle/Resources/config/admin.xml index ddc7ef116..1dc2504c3 100644 --- a/src/ProductBundle/Resources/config/admin.xml +++ b/src/ProductBundle/Resources/config/admin.xml @@ -1,104 +1,80 @@ - - - + + Sonata\ProductBundle\Admin\ProductAdmin SonataProductBundle:ProductAdmin - Sonata\ProductBundle\Admin\ProductVariationAdmin SonataProductBundle:ProductVariationAdmin - Sonata\ProductBundle\Admin\ProductCategoryAdmin SonataAdminBundle:CRUD - Sonata\ProductBundle\Admin\ProductCollectionAdmin SonataAdminBundle:CRUD - Sonata\ProductBundle\Admin\DeliveryAdmin SonataAdminBundle:CRUD - Sonata\ProductBundle\Model\DoctrineModelManager - - - + + %sonata.product.admin.product.entity% %sonata.product.admin.product.controller% - - + - - + - - + - - + - - + - - + - - - - + + %sonata.product.admin.product.entity% %sonata.product.admin.product.variation.controller% - - + - - + - - + %sonata.product.admin.product_category.entity% %sonata.product.admin.product_category.controller% - - + %sonata.product.admin.product_collection.entity% %sonata.product.admin.product_collection.controller% - - + %sonata.product.admin.delivery.entity% %sonata.product.admin.delivery.controller% - - - + + - diff --git a/src/ProductBundle/Resources/config/api_controllers.xml b/src/ProductBundle/Resources/config/api_controllers.xml index e9de4af9c..a66b97f19 100644 --- a/src/ProductBundle/Resources/config/api_controllers.xml +++ b/src/ProductBundle/Resources/config/api_controllers.xml @@ -1,15 +1,11 @@ - - - - + + - - - - + + + + diff --git a/src/ProductBundle/Resources/config/api_form.xml b/src/ProductBundle/Resources/config/api_form.xml index 066058e0c..1775c0d16 100644 --- a/src/ProductBundle/Resources/config/api_form.xml +++ b/src/ProductBundle/Resources/config/api_form.xml @@ -1,24 +1,17 @@ - - - - + + - - - - + + + sonata_product_api_form_product_parent %sonata.product.admin.product.entity% sonata_api_write - - - - + + diff --git a/src/ProductBundle/Resources/config/block.xml b/src/ProductBundle/Resources/config/block.xml index f4e991191..6917a1b03 100644 --- a/src/ProductBundle/Resources/config/block.xml +++ b/src/ProductBundle/Resources/config/block.xml @@ -1,68 +1,52 @@ - - - - + + - catalog sonata.product.block.breadcrumb - - - + + + - - sonata.product.block.recent_products - - - + + + %sonata.product.admin.product.entity% - - sonata.product.block.similar_products - - - - + + + + %sonata.product.admin.product.entity% - - sonata.product.block.categories_menu - - - + + + - - sonata.product.block.product_menu - - - + + + - - sonata.product.block.variations_form - - - + + + - diff --git a/src/ProductBundle/Resources/config/doctrine/BaseDelivery.orm.xml b/src/ProductBundle/Resources/config/doctrine/BaseDelivery.orm.xml index d15604e98..9c962bdd7 100644 --- a/src/ProductBundle/Resources/config/doctrine/BaseDelivery.orm.xml +++ b/src/ProductBundle/Resources/config/doctrine/BaseDelivery.orm.xml @@ -1,16 +1,13 @@ - + - - - - - - - - - - - + + + + + + + + diff --git a/src/ProductBundle/Resources/config/doctrine/BasePackage.orm.xml b/src/ProductBundle/Resources/config/doctrine/BasePackage.orm.xml index 614ce1ec5..cde16daab 100644 --- a/src/ProductBundle/Resources/config/doctrine/BasePackage.orm.xml +++ b/src/ProductBundle/Resources/config/doctrine/BasePackage.orm.xml @@ -1,16 +1,12 @@ - + - - - - - - - - - - - - + + + + + + + + diff --git a/src/ProductBundle/Resources/config/doctrine/BaseProduct.orm.xml b/src/ProductBundle/Resources/config/doctrine/BaseProduct.orm.xml index 0eabf921a..7d6223d40 100644 --- a/src/ProductBundle/Resources/config/doctrine/BaseProduct.orm.xml +++ b/src/ProductBundle/Resources/config/doctrine/BaseProduct.orm.xml @@ -1,34 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/src/ProductBundle/Resources/config/doctrine/BaseProductCategory.orm.xml b/src/ProductBundle/Resources/config/doctrine/BaseProductCategory.orm.xml index e26ee19d2..bc20960c9 100644 --- a/src/ProductBundle/Resources/config/doctrine/BaseProductCategory.orm.xml +++ b/src/ProductBundle/Resources/config/doctrine/BaseProductCategory.orm.xml @@ -1,15 +1,9 @@ - - - - - - - - - - + + + + + + + - diff --git a/src/ProductBundle/Resources/config/doctrine/BaseProductCollection.orm.xml b/src/ProductBundle/Resources/config/doctrine/BaseProductCollection.orm.xml index 123f00762..49b9441da 100644 --- a/src/ProductBundle/Resources/config/doctrine/BaseProductCollection.orm.xml +++ b/src/ProductBundle/Resources/config/doctrine/BaseProductCollection.orm.xml @@ -1,14 +1,8 @@ - - - - - - - - - + + + + + + - diff --git a/src/ProductBundle/Resources/config/form.xml b/src/ProductBundle/Resources/config/form.xml index 41bfb65fb..91f6f22ef 100644 --- a/src/ProductBundle/Resources/config/form.xml +++ b/src/ProductBundle/Resources/config/form.xml @@ -1,23 +1,15 @@ - - - - + + - %sonata.product.delivery.class% - getStatusList - sonata_product_delivery_status - - - - + %sonata.product.delivery.class% + getStatusList + sonata_product_delivery_status + + - - - - + + + - diff --git a/src/ProductBundle/Resources/config/menu.xml b/src/ProductBundle/Resources/config/menu.xml index a9b674cac..aca6443d3 100644 --- a/src/ProductBundle/Resources/config/menu.xml +++ b/src/ProductBundle/Resources/config/menu.xml @@ -1,14 +1,10 @@ - - - + + - - - + + + - diff --git a/src/ProductBundle/Resources/config/orm.xml b/src/ProductBundle/Resources/config/orm.xml index 44bfcccaa..90788c935 100644 --- a/src/ProductBundle/Resources/config/orm.xml +++ b/src/ProductBundle/Resources/config/orm.xml @@ -1,9 +1,5 @@ - - - - + + Sonata\ProductBundle\Entity\DeliveryManager Sonata\ProductBundle\Entity\PackageManager @@ -11,33 +7,26 @@ Sonata\ProductBundle\Entity\ProductCategoryManager Sonata\ProductBundle\Entity\ProductCollectionManager - %sonata.product.delivery.class% - + - %sonata.product.package.class% - + - %sonata.product.product.class% - + - %sonata.product.product_category.class% - + - %sonata.product.product_collection.class% - + - - diff --git a/src/ProductBundle/Resources/config/product.xml b/src/ProductBundle/Resources/config/product.xml index 8623ac458..25a7cf9d0 100644 --- a/src/ProductBundle/Resources/config/product.xml +++ b/src/ProductBundle/Resources/config/product.xml @@ -1,15 +1,10 @@ - - - - + + Sonata\Component\Product\Pool Sonata\Component\Subscriber\ORMInheritanceSubscriber Sonata\Component\Product\SeoProductIterator Sonata\Component\Product\ProductFinder - Sonata\ProductBundle\Seo\Services\Twitter %sonata.product.seo.product.site% %sonata.product.seo.product.creator% @@ -18,47 +13,41 @@ %sonata.product.seo.product.media_format% Sonata\ProductBundle\Seo\Services\Facebook - - - - + + %sonata.product.admin.product.entity% - - + %sonata.product.product.class% - + sonata_product_view - - + - - - - + + + %sonata.product.seo.product.site% %sonata.product.seo.product.creator% %sonata.product.seo.product.domain% %sonata.product.seo.product.media_format% - - - - + + + + %sonata.product.seo.product.domain% %sonata.product.seo.product.media_format% - diff --git a/src/ProductBundle/Resources/config/routing/api.xml b/src/ProductBundle/Resources/config/routing/api.xml index 81bb59fc1..e9cdd3ff6 100644 --- a/src/ProductBundle/Resources/config/routing/api.xml +++ b/src/ProductBundle/Resources/config/routing/api.xml @@ -1,9 +1,4 @@ - - - - - - + + + diff --git a/src/ProductBundle/Resources/config/routing/catalog.xml b/src/ProductBundle/Resources/config/routing/catalog.xml index bae6863f1..9a5505b99 100644 --- a/src/ProductBundle/Resources/config/routing/catalog.xml +++ b/src/ProductBundle/Resources/config/routing/catalog.xml @@ -1,17 +1,11 @@ - - - - + + SonataProductBundle:Catalog:index - SonataProductBundle:Catalog:index 0 all - diff --git a/src/ProductBundle/Resources/config/routing/product.xml b/src/ProductBundle/Resources/config/routing/product.xml index 44631d545..9649570dc 100644 --- a/src/ProductBundle/Resources/config/routing/product.xml +++ b/src/ProductBundle/Resources/config/routing/product.xml @@ -1,23 +1,15 @@ - - - - + + SonataProductBundle:Product:getPriceStockForQuantity - SonataProductBundle:Product:view - SonataProductBundle:Product:viewVariations - SonataProductBundle:Product:variationToProduct - diff --git a/src/ProductBundle/Resources/config/routing/product_admin.xml b/src/ProductBundle/Resources/config/routing/product_admin.xml index b4024c298..74d065409 100644 --- a/src/ProductBundle/Resources/config/routing/product_admin.xml +++ b/src/ProductBundle/Resources/config/routing/product_admin.xml @@ -1,24 +1,15 @@ - - - - - + + SonataProductBundle:ProductAdmin:edit - SonataProductBundle:ProductAdmin:edit - SonataProductBundle:ProductAdmin:edit - SonataProductBundle:ProductAdmin:edit - diff --git a/src/ProductBundle/Resources/config/serializer.xml b/src/ProductBundle/Resources/config/serializer.xml index c4ed92255..72ebe1db7 100644 --- a/src/ProductBundle/Resources/config/serializer.xml +++ b/src/ProductBundle/Resources/config/serializer.xml @@ -1,16 +1,9 @@ - - - - + + - - - + + - - diff --git a/src/ProductBundle/Resources/config/serializer/Entity.BaseDelivery.xml b/src/ProductBundle/Resources/config/serializer/Entity.BaseDelivery.xml index 78ff508d4..06bdde4f9 100644 --- a/src/ProductBundle/Resources/config/serializer/Entity.BaseDelivery.xml +++ b/src/ProductBundle/Resources/config/serializer/Entity.BaseDelivery.xml @@ -1,18 +1,13 @@ - - - - - - - - - - - - - + + + + + + + + diff --git a/src/ProductBundle/Resources/config/serializer/Entity.BasePackage.xml b/src/ProductBundle/Resources/config/serializer/Entity.BasePackage.xml index 6696d62a9..4434f6f8d 100644 --- a/src/ProductBundle/Resources/config/serializer/Entity.BasePackage.xml +++ b/src/ProductBundle/Resources/config/serializer/Entity.BasePackage.xml @@ -1,18 +1,13 @@ - - - - - - - - - - - - - + + + + + + + + diff --git a/src/ProductBundle/Resources/config/serializer/Entity.BaseProduct.xml b/src/ProductBundle/Resources/config/serializer/Entity.BaseProduct.xml index d36fd9730..6c097771e 100644 --- a/src/ProductBundle/Resources/config/serializer/Entity.BaseProduct.xml +++ b/src/ProductBundle/Resources/config/serializer/Entity.BaseProduct.xml @@ -1,32 +1,24 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/src/ProductBundle/Resources/config/serializer/Entity.BaseProductCategory.xml b/src/ProductBundle/Resources/config/serializer/Entity.BaseProductCategory.xml index a6dea6932..cfdc171ab 100644 --- a/src/ProductBundle/Resources/config/serializer/Entity.BaseProductCategory.xml +++ b/src/ProductBundle/Resources/config/serializer/Entity.BaseProductCategory.xml @@ -1,16 +1,11 @@ - - - - - - - - - - - + + + + + + diff --git a/src/ProductBundle/Resources/config/serializer/Entity.BaseProductCollection.xml b/src/ProductBundle/Resources/config/serializer/Entity.BaseProductCollection.xml index 616237be9..e1bdf676d 100644 --- a/src/ProductBundle/Resources/config/serializer/Entity.BaseProductCollection.xml +++ b/src/ProductBundle/Resources/config/serializer/Entity.BaseProductCollection.xml @@ -1,14 +1,10 @@ - - - - - - - - - + + + + + diff --git a/src/ProductBundle/Resources/config/twig.xml b/src/ProductBundle/Resources/config/twig.xml index 7ae66d9de..032ea9378 100644 --- a/src/ProductBundle/Resources/config/twig.xml +++ b/src/ProductBundle/Resources/config/twig.xml @@ -1,16 +1,11 @@ - - - - + + - - + + %sonata.basket.basket_element.class% - + - diff --git a/src/ProductBundle/Resources/config/validation.xml b/src/ProductBundle/Resources/config/validation.xml index e695267ad..38d343792 100644 --- a/src/ProductBundle/Resources/config/validation.xml +++ b/src/ProductBundle/Resources/config/validation.xml @@ -1,40 +1,30 @@ - - - + + - + - - + - - + - - + - - - + + - - + - diff --git a/src/ProductBundle/Resources/skeleton/product/Resources/config/doctrine/Entity.orm.xml b/src/ProductBundle/Resources/skeleton/product/Resources/config/doctrine/Entity.orm.xml index 70bce9126..0a83429ca 100644 --- a/src/ProductBundle/Resources/skeleton/product/Resources/config/doctrine/Entity.orm.xml +++ b/src/ProductBundle/Resources/skeleton/product/Resources/config/doctrine/Entity.orm.xml @@ -1,4 +1,4 @@ - + - - + - diff --git a/src/ProductBundle/Resources/translations/SonataProductBundle.en.xliff b/src/ProductBundle/Resources/translations/SonataProductBundle.en.xliff index b8d63f8c0..0fded5cf4 100644 --- a/src/ProductBundle/Resources/translations/SonataProductBundle.en.xliff +++ b/src/ProductBundle/Resources/translations/SonataProductBundle.en.xliff @@ -1,8 +1,7 @@ - - + + - title_select_provider @@ -65,7 +64,6 @@ Quantity - sidemenu.link_product_edit @@ -100,7 +98,6 @@ Deliveries - list.label_enabled @@ -167,7 +164,6 @@ Collection - filter.label_enabled @@ -202,7 +198,6 @@ Product - breadcrumb.link_delivery_history @@ -241,7 +236,6 @@ Categories - form.label_sub_description @@ -344,7 +338,6 @@ Collection - variation_not_found @@ -387,7 +380,6 @@ Show more - product.sidemenu.link_add_variation @@ -414,7 +406,6 @@ Product variations creation in error! - product.sidemenu.link_product_edit Product @@ -452,6 +443,5 @@ No other products available in the same collection. - diff --git a/src/ProductBundle/Resources/translations/SonataProductBundle.fr.xliff b/src/ProductBundle/Resources/translations/SonataProductBundle.fr.xliff index f6e3b816a..5cd5b50ab 100644 --- a/src/ProductBundle/Resources/translations/SonataProductBundle.fr.xliff +++ b/src/ProductBundle/Resources/translations/SonataProductBundle.fr.xliff @@ -1,8 +1,7 @@ - - + + - title_select_provider @@ -65,7 +64,6 @@ Quantité - sidemenu.link_product_edit @@ -100,7 +98,6 @@ Modes de livraison - list.label_enabled @@ -167,7 +164,6 @@ Collection - filter.label_enabled @@ -202,7 +198,6 @@ Produit - breadcrumb.link_delivery_history @@ -241,7 +236,6 @@ Catégories - form.label_sub_description @@ -344,7 +338,6 @@ Collection - variation_not_found @@ -387,7 +380,6 @@ En savoir plus - product.sidemenu.link_add_variation @@ -414,7 +406,6 @@ Création de la variation du produit en erreur! - product.sidemenu.link_product_edit Produit @@ -435,7 +426,6 @@ list.label_is_variation Variation? - form.label_price_including_vat Prix TTC diff --git a/src/ProductBundle/Resources/translations/validators.en.xliff b/src/ProductBundle/Resources/translations/validators.en.xliff index b38c8884e..573d8a0cb 100644 --- a/src/ProductBundle/Resources/translations/validators.en.xliff +++ b/src/ProductBundle/Resources/translations/validators.en.xliff @@ -1,5 +1,5 @@ - - + + @@ -8,4 +8,4 @@ - \ No newline at end of file + diff --git a/src/ProductBundle/Resources/translations/validators.fr.xliff b/src/ProductBundle/Resources/translations/validators.fr.xliff index 1d5c5624b..b7fe2ec23 100644 --- a/src/ProductBundle/Resources/translations/validators.fr.xliff +++ b/src/ProductBundle/Resources/translations/validators.fr.xliff @@ -1,5 +1,5 @@ - - + + @@ -8,4 +8,4 @@ - \ No newline at end of file + From 272eec57836e99a0c6960826cd639be705947c3c Mon Sep 17 00:00:00 2001 From: Sullivan SENECHAL Date: Fri, 24 Jun 2016 15:05:36 +0200 Subject: [PATCH 4/4] Fix PHPUnit test with Symfony command --- tests/ProductBundle/Command/GenerateProductCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ProductBundle/Command/GenerateProductCommandTest.php b/tests/ProductBundle/Command/GenerateProductCommandTest.php index 2d2ea5f13..f0b7f85eb 100644 --- a/tests/ProductBundle/Command/GenerateProductCommandTest.php +++ b/tests/ProductBundle/Command/GenerateProductCommandTest.php @@ -12,7 +12,7 @@ namespace Sonata\Test\ProductBundle\Command; use Sonata\ProductBundle\Command\GenerateProductCommand; -use Symfony\Bundle\FrameworkBundle\Console\Application; +use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; /**