diff --git a/.gitignore b/.gitignore
index 30f3ee22d..d8cbe7f51 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
vendor/
phpunit.xml
+composer.lock
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
new file mode 100644
index 000000000..4b1808a27
--- /dev/null
+++ b/.scrutinizer.yml
@@ -0,0 +1,3 @@
+tools:
+ external_code_coverage:
+ timeout: 600
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index a5d5cf873..7ac878aed 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,22 +1,40 @@
language: php
-matrix:
- allow_failures:
- - php: hhvm
+sudo: false
+
+git:
+ depth: 1
-php:
- - 5.3
- - 5.4
- - 5.5
- - hhvm
+cache:
+ directories:
+ - $HOME/.composer/cache
+
+matrix:
+ include:
+ - php: hhvm
+ sudo: required
+ dist: trusty
+ group: edge
+ - php: hhvm-nightly
+ sudo: required
+ dist: trusty
+ group: edge
+ - php: 5.5
+ - php: 5.6
+ - php: 7.0
+ - php: 5.5
+ env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'
+ fast_finish: true
before_script:
+ - if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then PHPUNIT_FLAGS="--coverage-clover clover"; else PHPUNIT_FLAGS=""; fi
+ - if [[ $TRAVIS_PHP_VERSION != '5.6' && ! $TRAVIS_PHP_VERSION = hhvm* ]]; then phpenv config-rm xdebug.ini; fi
- composer self-update
- - composer install --dev
+ - composer update $COMPOSER_FLAGS
-script: vendor/bin/phpunit --coverage-clover clover
+script: vendor/bin/phpunit $PHPUNIT_FLAGS
after_success:
- - wget https://scrutinizer-ci.com/ocular.phar
- - php ocular.phar code-coverage:upload --format=php-clover clover
+ - if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
+ - if [[ $TRAVIS_PHP_VERSION = '5.6' ]]; then php ocular.phar code-coverage:upload --format=php-clover clover; fi
diff --git a/README.md b/README.md
index 6d0164c1c..dd9f551a7 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-Serializer [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/schmittjoh/serializer/badges/quality-score.png?s=189df68e00c75d3fe155bc0da0b53b53709a9895)](https://scrutinizer-ci.com/g/schmittjoh/serializer/)
+Serializer [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/schmittjoh/serializer/badges/quality-score.png?s=189df68e00c75d3fe155bc0da0b53b53709a9895)](https://scrutinizer-ci.com/g/schmittjoh/serializer/) [![Build Status](https://travis-ci.org/schmittjoh/serializer.svg?branch=master)](https://travis-ci.org/schmittjoh/serializer)
==========
Learn more about it in its [documentation](http://jmsyst.com/libs/serializer).
diff --git a/composer.json b/composer.json
index 4829581e2..311f3e7d0 100644
--- a/composer.json
+++ b/composer.json
@@ -12,29 +12,32 @@
}
],
"require": {
- "php": ">=5.3.2",
+ "php": ">=5.5.0",
"jms/metadata": "~1.1",
"jms/parser-lib": "1.*",
+ "phpoption/phpoption": "^1.1",
"phpcollection/phpcollection": "~0.1",
- "doctrine/annotations": "1.*",
- "doctrine/instantiator": "~1.0.3"
+ "doctrine/annotations": "^1.0",
+ "doctrine/instantiator": "^1.0.3"
+ },
+ "conflict": {
+ "twig/twig": "<1.12"
},
"suggest": {
"symfony/yaml": "Required if you'd like to serialize data to YAML format."
},
- "minimum-stability": "dev",
"require-dev": {
- "twig/twig": ">=1.8,<2.0-dev",
+ "twig/twig": "~1.12|~2.0",
"doctrine/orm": "~2.1",
- "doctrine/phpcr-odm": "~1.0.1",
- "jackalope/jackalope-doctrine-dbal": "1.0.*",
+ "jackalope/jackalope-doctrine-dbal": "^1.1.5",
+ "doctrine/phpcr-odm": "^1.3|^2.0",
"propel/propel1": "~1.7",
- "symfony/yaml": "2.*",
- "symfony/translation": "~2.0",
- "symfony/validator": "~2.0",
+ "symfony/yaml": "^2.1",
+ "symfony/translation": "^2.1",
+ "symfony/validator": "^2.2",
"symfony/form": "~2.1",
- "symfony/filesystem": "2.*",
- "phpunit/phpunit": "~4.0"
+ "symfony/filesystem": "^2.1",
+ "phpunit/phpunit": "^4.8|^5.0"
},
"autoload": {
"psr-0": {
@@ -43,7 +46,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "0.17-dev"
+ "dev-master": "1.3-dev"
}
}
}
diff --git a/composer.lock b/composer.lock
deleted file mode 100644
index a411b052c..000000000
--- a/composer.lock
+++ /dev/null
@@ -1,2710 +0,0 @@
-{
- "_readme": [
- "This file locks the dependencies of your project to a known state",
- "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
- "This file is @generated automatically"
- ],
- "hash": "e46f04cd4220c50a1b3a7562449e1d32",
- "packages": [
- {
- "name": "doctrine/annotations",
- "version": "v1.1.2",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/annotations.git",
- "reference": "40db0c96985aab2822edbc4848b3bd2429e02670"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/annotations/zipball/40db0c96985aab2822edbc4848b3bd2429e02670",
- "reference": "40db0c96985aab2822edbc4848b3bd2429e02670",
- "shasum": ""
- },
- "require": {
- "doctrine/lexer": "1.*",
- "php": ">=5.3.2"
- },
- "require-dev": {
- "doctrine/cache": "1.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Common\\Annotations\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jonathan Wage",
- "email": "jonwage@gmail.com",
- "homepage": "http://www.jwage.com/",
- "role": "Creator"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com",
- "homepage": "http://www.instaclick.com"
- },
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Docblock Annotations Parser",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "annotations",
- "docblock",
- "parser"
- ],
- "time": "2013-06-16 21:33:03"
- },
- {
- "name": "doctrine/lexer",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/lexer.git",
- "reference": "57d5a024b48709c56ce5bb93072948359220f36c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/lexer/zipball/57d5a024b48709c56ce5bb93072948359220f36c",
- "reference": "57d5a024b48709c56ce5bb93072948359220f36c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Common\\Lexer\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com",
- "homepage": "http://www.instaclick.com"
- },
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "lexer",
- "parser"
- ],
- "time": "2013-11-19 06:15:26"
- },
- {
- "name": "jms/metadata",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/metadata.git",
- "reference": "3cb8bd396b961c156e964e3f58c9ad5206acf0a0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/3cb8bd396b961c156e964e3f58c9ad5206acf0a0",
- "reference": "3cb8bd396b961c156e964e3f58c9ad5206acf0a0",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "require-dev": {
- "doctrine/cache": "~1.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.5.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Metadata\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Class/method/property metadata management in PHP",
- "keywords": [
- "annotations",
- "metadata",
- "xml",
- "yaml"
- ],
- "time": "2013-12-02 21:16:56"
- },
- {
- "name": "jms/parser-lib",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/parser-lib.git",
- "reference": "d5961fa3fa039aa5ee0e50021c6681ba949e360c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/d5961fa3fa039aa5ee0e50021c6681ba949e360c",
- "reference": "d5961fa3fa039aa5ee0e50021c6681ba949e360c",
- "shasum": ""
- },
- "require": {
- "phpoption/phpoption": ">=0.9,<2.0-dev"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.1-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "JMS\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "description": "A library for easily creating recursive-descent parsers.",
- "time": "2013-08-09 15:53:02"
- },
- {
- "name": "phpcollection/phpcollection",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/php-collection.git",
- "reference": "5c8ec0d1091c95b973b59a3bf0eb19c5de72d8d1"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/5c8ec0d1091c95b973b59a3bf0eb19c5de72d8d1",
- "reference": "5c8ec0d1091c95b973b59a3bf0eb19c5de72d8d1",
- "shasum": ""
- },
- "require": {
- "phpoption/phpoption": "1.*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "0.2-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "PhpCollection": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "General-Purpose Collection Library for PHP",
- "keywords": [
- "collection",
- "list",
- "map",
- "sequence",
- "set"
- ],
- "time": "2013-08-22 09:46:14"
- },
- {
- "name": "phpoption/phpoption",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/schmittjoh/php-option.git",
- "reference": "1c7e8016289d17d83ced49c56d0f266fd0568941"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/1c7e8016289d17d83ced49c56d0f266fd0568941",
- "reference": "1c7e8016289d17d83ced49c56d0f266fd0568941",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "PhpOption\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache2"
- ],
- "authors": [
- {
- "name": "Johannes M. Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Option Type for PHP",
- "keywords": [
- "language",
- "option",
- "php",
- "type"
- ],
- "time": "2013-05-19 11:09:35"
- }
- ],
- "packages-dev": [
- {
- "name": "doctrine/cache",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/cache.git",
- "reference": "ff36d4216fef8242c3d8ee97fceee977e3c9b9a6"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/cache/zipball/ff36d4216fef8242c3d8ee97fceee977e3c9b9a6",
- "reference": "ff36d4216fef8242c3d8ee97fceee977e3c9b9a6",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.2"
- },
- "conflict": {
- "doctrine/common": ">2.2,<2.4"
- },
- "require-dev": {
- "phpunit/phpunit": ">=3.7",
- "satooshi/php-coveralls": "~0.6"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Common\\Cache\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jonathan Wage",
- "email": "jonwage@gmail.com",
- "homepage": "http://www.jwage.com/",
- "role": "Creator"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com",
- "homepage": "http://www.instaclick.com"
- },
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Caching library offering an object-oriented API for many cache backends",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "cache",
- "caching"
- ],
- "time": "2013-11-23 16:10:06"
- },
- {
- "name": "doctrine/collections",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/collections.git",
- "reference": "bcb53776a096a0c64579cc8d8ec0db62f1109fbc"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/collections/zipball/bcb53776a096a0c64579cc8d8ec0db62f1109fbc",
- "reference": "bcb53776a096a0c64579cc8d8ec0db62f1109fbc",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Common\\Collections\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jonathan H. Wage",
- "email": "jonwage@gmail.com",
- "homepage": "http://www.jwage.com/",
- "role": "Creator"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com",
- "homepage": "http://www.instaclick.com"
- },
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Collections Abstraction library",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "array",
- "collections",
- "iterator"
- ],
- "time": "2013-08-29 16:56:45"
- },
- {
- "name": "doctrine/common",
- "version": "2.4.x-dev",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/common.git",
- "reference": "c94d6ff79e25418b1225e187c782bf4742f23a8b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/common/zipball/c94d6ff79e25418b1225e187c782bf4742f23a8b",
- "reference": "c94d6ff79e25418b1225e187c782bf4742f23a8b",
- "shasum": ""
- },
- "require": {
- "doctrine/annotations": "1.*",
- "doctrine/cache": "1.*",
- "doctrine/collections": "1.*",
- "doctrine/inflector": "1.*",
- "doctrine/lexer": "1.*",
- "php": ">=5.3.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.4.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Common\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jonathan Wage",
- "email": "jonwage@gmail.com",
- "homepage": "http://www.jwage.com/",
- "role": "Creator"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com",
- "homepage": "http://www.instaclick.com"
- },
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Common Library for Doctrine projects",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "annotations",
- "collections",
- "eventmanager",
- "persistence",
- "spl"
- ],
- "time": "2013-09-07 10:20:35"
- },
- {
- "name": "doctrine/dbal",
- "version": "2.3.x-dev",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/dbal.git",
- "reference": "69e91a3ea72c120f2516cf7983df6e9b550d00ea"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/dbal/zipball/69e91a3ea72c120f2516cf7983df6e9b550d00ea",
- "reference": "69e91a3ea72c120f2516cf7983df6e9b550d00ea",
- "shasum": ""
- },
- "require": {
- "doctrine/common": ">=2.3.0,<2.5-dev",
- "php": ">=5.3.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.3.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\DBAL": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jonathan Wage",
- "email": "jonwage@gmail.com",
- "homepage": "http://www.jwage.com/",
- "role": "Creator"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com",
- "homepage": "http://www.instaclick.com"
- },
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- }
- ],
- "description": "Database Abstraction Layer",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "database",
- "dbal",
- "persistence",
- "queryobject"
- ],
- "time": "2013-11-13 00:02:59"
- },
- {
- "name": "doctrine/inflector",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/inflector.git",
- "reference": "8b4b3ccec7aafc596e2fc1e593c9f2e78f939c8c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/inflector/zipball/8b4b3ccec7aafc596e2fc1e593c9f2e78f939c8c",
- "reference": "8b4b3ccec7aafc596e2fc1e593c9f2e78f939c8c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Common\\Inflector\\": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jonathan Wage",
- "email": "jonwage@gmail.com",
- "homepage": "http://www.jwage.com/",
- "role": "Creator"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com",
- "homepage": "http://www.instaclick.com"
- },
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- },
- {
- "name": "Johannes Schmitt",
- "email": "schmittjoh@gmail.com",
- "homepage": "http://jmsyst.com",
- "role": "Developer of wrapped JMSSerializerBundle"
- }
- ],
- "description": "Common String Manipulations with regard to casing and singular/plural rules.",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "inflection",
- "pluralize",
- "singularize",
- "string"
- ],
- "time": "2013-04-10 16:14:30"
- },
- {
- "name": "doctrine/instantiator",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/instantiator.git",
- "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119",
- "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3,<8.0-DEV"
- },
- "require-dev": {
- "athletic/athletic": "~0.1.8",
- "ext-pdo": "*",
- "ext-phar": "*",
- "phpunit/phpunit": "~4.0",
- "squizlabs/php_codesniffer": "2.0.*@ALPHA"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\Instantiator\\": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Marco Pivetta",
- "email": "ocramius@gmail.com",
- "homepage": "http://ocramius.github.com/"
- }
- ],
- "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
- "homepage": "https://github.com/doctrine/instantiator",
- "keywords": [
- "constructor",
- "instantiate"
- ],
- "time": "2014-10-13 12:58:55"
- },
- {
- "name": "doctrine/orm",
- "version": "2.3.x-dev",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/doctrine2.git",
- "reference": "1a30e0a2e069999de835722bfbafe3da146b8ebb"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/1a30e0a2e069999de835722bfbafe3da146b8ebb",
- "reference": "1a30e0a2e069999de835722bfbafe3da146b8ebb",
- "shasum": ""
- },
- "require": {
- "doctrine/dbal": "2.3.*",
- "ext-pdo": "*",
- "php": ">=5.3.2",
- "symfony/console": "2.*"
- },
- "suggest": {
- "symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
- },
- "bin": [
- "bin/doctrine",
- "bin/doctrine.php"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.3.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\ORM": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jonathan Wage",
- "email": "jonwage@gmail.com",
- "homepage": "http://www.jwage.com/",
- "role": "Creator"
- },
- {
- "name": "Guilherme Blanco",
- "email": "guilhermeblanco@gmail.com",
- "homepage": "http://www.instaclick.com"
- },
- {
- "name": "Roman Borschel",
- "email": "roman@code-factory.org"
- },
- {
- "name": "Benjamin Eberlei",
- "email": "kontakt@beberlei.de"
- }
- ],
- "description": "Object-Relational-Mapper for PHP",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "database",
- "orm"
- ],
- "time": "2013-10-29 08:25:52"
- },
- {
- "name": "doctrine/phpcr-odm",
- "version": "1.0.x-dev",
- "source": {
- "type": "git",
- "url": "https://github.com/doctrine/phpcr-odm.git",
- "reference": "a4f63ec755f8a76f854777424a99d02fe41d3adc"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/doctrine/phpcr-odm/zipball/a4f63ec755f8a76f854777424a99d02fe41d3adc",
- "reference": "a4f63ec755f8a76f854777424a99d02fe41d3adc",
- "shasum": ""
- },
- "require": {
- "doctrine/common": "~2.4.0",
- "php": ">=5.3.3",
- "phpcr/phpcr-implementation": "~2.1.0",
- "phpcr/phpcr-utils": "~1.0.0"
- },
- "require-dev": {
- "liip/rmt": "dev-master",
- "symfony/yaml": "~2.0"
- },
- "suggest": {
- "jackalope/jackalope-doctrine-dbal": "~1.0.0",
- "jackalope/jackalope-jackrabbit": "~1.0.0",
- "symfony/yaml": "~2.0"
- },
- "bin": [
- "bin/phpcrodm",
- "bin/phpcrodm.php"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Doctrine\\ODM\\PHPCR": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Jordi Boggiano",
- "email": "j.boggiano@seld.be",
- "homepage": "http://seld.be",
- "role": "Developer"
- },
- {
- "name": "Lukas Kahwe Smith",
- "email": "smith@pooteeweet.org"
- },
- {
- "name": "David Buchmann",
- "email": "david@liip.ch"
- }
- ],
- "description": "Object-Document-Mapper for PHPCR",
- "homepage": "http://www.doctrine-project.org",
- "keywords": [
- "database",
- "odm",
- "phpcr"
- ],
- "time": "2013-12-04 16:02:18"
- },
- {
- "name": "jackalope/jackalope",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/jackalope/jackalope.git",
- "reference": "605a3fb6d83c906d19ad88b2347be9453c96a19f"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/jackalope/jackalope/zipball/605a3fb6d83c906d19ad88b2347be9453c96a19f",
- "reference": "605a3fb6d83c906d19ad88b2347be9453c96a19f",
- "shasum": ""
- },
- "require": {
- "ext-libxml": "*",
- "jackalope/jackalope-transport": "*",
- "php": ">=5.3.2",
- "phpcr/phpcr": "~2.1.0",
- "phpcr/phpcr-utils": "~1.0.0"
- },
- "provide": {
- "phpcr/phpcr-implementation": "2.1.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Jackalope\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT",
- "Apache-2.0"
- ],
- "authors": [
- {
- "name": "Jackalope Community",
- "homepage": "https://github.com/jackalope/jackalope/contributors"
- }
- ],
- "description": "Jackalope PHPCR library",
- "homepage": "http://jackalope.github.io",
- "keywords": [
- "phpcr"
- ],
- "time": "2013-11-06 10:28:46"
- },
- {
- "name": "jackalope/jackalope-doctrine-dbal",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/jackalope/jackalope-doctrine-dbal.git",
- "reference": "8dd5db26e05f763680350c7be0b5a0c6784f4484"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/jackalope/jackalope-doctrine-dbal/zipball/8dd5db26e05f763680350c7be0b5a0c6784f4484",
- "reference": "8dd5db26e05f763680350c7be0b5a0c6784f4484",
- "shasum": ""
- },
- "require": {
- "doctrine/dbal": ">=2.2.0,<2.5",
- "jackalope/jackalope": "~1.0.0",
- "php": ">=5.3.3",
- "phpcr/phpcr": "~2.1.0-RC1",
- "phpcr/phpcr-utils": "~1.0.0"
- },
- "provide": {
- "jackalope/jackalope-transport": "1.0.0"
- },
- "require-dev": {
- "phpcr/phpcr-api-tests": "2.1.0"
- },
- "bin": [
- "bin/jackalope"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Jackalope\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT",
- "Apache-2.0"
- ],
- "authors": [
- {
- "name": "Jackalope Community",
- "homepage": "https://github.com/jackalope/jackalope-jackrabbit/contributors"
- }
- ],
- "description": "Jackalope Transport library for Doctrine DBAL",
- "homepage": "http://jackalope.github.io",
- "keywords": [
- "doctrine-dbal",
- "phpcr",
- "transport implementation"
- ],
- "time": "2013-12-01 11:46:25"
- },
- {
- "name": "phing/phing",
- "version": "2.6.1",
- "source": {
- "type": "git",
- "url": "https://github.com/phingofficial/phing.git",
- "reference": "3f7d71bf561bafea39087250f777b349438cc32e"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phingofficial/phing/zipball/3f7d71bf561bafea39087250f777b349438cc32e",
- "reference": "3f7d71bf561bafea39087250f777b349438cc32e",
- "shasum": ""
- },
- "require": {
- "php": ">=5.2.0"
- },
- "bin": [
- "bin/phing"
- ],
- "type": "library",
- "autoload": {
- "classmap": [
- "classes/phing/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- "classes"
- ],
- "license": [
- "LGPL3"
- ],
- "authors": [
- {
- "name": "Michiel Rook",
- "email": "mrook@php.net"
- },
- {
- "name": "Phing Community",
- "homepage": "http://www.phing.info/trac/wiki/Development/Contributors"
- }
- ],
- "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.",
- "homepage": "http://www.phing.info/",
- "keywords": [
- "build",
- "task",
- "tool"
- ],
- "time": "2013-08-26 21:13:03"
- },
- {
- "name": "phpcr/phpcr",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/phpcr/phpcr.git",
- "reference": "f9483968fb77584e47c1dbf2dbc7906447f8c5b1"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpcr/phpcr/zipball/f9483968fb77584e47c1dbf2dbc7906447f8c5b1",
- "reference": "f9483968fb77584e47c1dbf2dbc7906447f8c5b1",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.1-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "PHPCR": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT",
- "Apache-2.0"
- ],
- "authors": [
- {
- "name": "Lukas Kahwe Smith",
- "email": "smith@pooteeweet.org"
- },
- {
- "name": "David Buchmann",
- "email": "david@liip.ch"
- },
- {
- "name": "Karsten Dambekalns",
- "email": "karsten@typo3.org"
- }
- ],
- "description": "PHP Content Repository interfaces",
- "homepage": "http://phpcr.github.io",
- "keywords": [
- "contentrepository",
- "phpcr"
- ],
- "time": "2013-10-07 15:34:44"
- },
- {
- "name": "phpcr/phpcr-utils",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/phpcr/phpcr-utils.git",
- "reference": "89165eab123907050b914e16a77d373c4e1eb310"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpcr/phpcr-utils/zipball/89165eab123907050b914e16a77d373c4e1eb310",
- "reference": "89165eab123907050b914e16a77d373c4e1eb310",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0",
- "phpcr/phpcr": "~2.1.0",
- "symfony/console": "~2.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "PHPCR\\Util": "src"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT",
- "Apache-2.0"
- ],
- "authors": [
- {
- "name": "Lukas Kahwe Smith",
- "email": "smith@pooteeweet.org"
- },
- {
- "name": "David Buchmann",
- "email": "david@liip.ch"
- },
- {
- "name": "Daniel Barsotti",
- "email": "daniel.barsotti@liip.ch",
- "role": "maintainer"
- },
- {
- "name": "Nacho MartÃn",
- "email": "nitram.ohcan@gmail.com"
- }
- ],
- "description": "PHP Content Repository implementation independant utilities",
- "homepage": "http://phpcr.github.com",
- "keywords": [
- "cli",
- "contentrepository",
- "phpcr"
- ],
- "time": "2013-11-13 12:10:20"
- },
- {
- "name": "phpdocumentor/reflection-docblock",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
- "reference": "fd0ac2007401505fb596fdfb859ec4e103d69e55"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/fd0ac2007401505fb596fdfb859ec4e103d69e55",
- "reference": "fd0ac2007401505fb596fdfb859ec4e103d69e55",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0"
- },
- "suggest": {
- "dflydev/markdown": "~1.0",
- "erusev/parsedown": "~1.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "phpDocumentor": [
- "src/"
- ]
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Mike van Riel",
- "email": "mike.vanriel@naenius.com"
- }
- ],
- "time": "2014-09-02 14:26:20"
- },
- {
- "name": "phpspec/prophecy",
- "version": "v1.3.1",
- "source": {
- "type": "git",
- "url": "https://github.com/phpspec/prophecy.git",
- "reference": "9ca52329bcdd1500de24427542577ebf3fc2f1c9"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/9ca52329bcdd1500de24427542577ebf3fc2f1c9",
- "reference": "9ca52329bcdd1500de24427542577ebf3fc2f1c9",
- "shasum": ""
- },
- "require": {
- "doctrine/instantiator": "~1.0,>=1.0.2",
- "phpdocumentor/reflection-docblock": "~2.0"
- },
- "require-dev": {
- "phpspec/phpspec": "~2.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Prophecy\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Konstantin Kudryashov",
- "email": "ever.zet@gmail.com",
- "homepage": "http://everzet.com"
- },
- {
- "name": "Marcello Duarte",
- "email": "marcello.duarte@gmail.com"
- }
- ],
- "description": "Highly opinionated mocking framework for PHP 5.3+",
- "homepage": "http://phpspec.org",
- "keywords": [
- "Double",
- "Dummy",
- "fake",
- "mock",
- "spy",
- "stub"
- ],
- "time": "2014-11-17 16:23:49"
- },
- {
- "name": "phpunit/php-code-coverage",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "b8781bdc6379749fd3f3f76aa5109957f46bc9e6"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b8781bdc6379749fd3f3f76aa5109957f46bc9e6",
- "reference": "b8781bdc6379749fd3f3f76aa5109957f46bc9e6",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "phpunit/php-file-iterator": "~1.3",
- "phpunit/php-text-template": "~1.2",
- "phpunit/php-token-stream": "~1.3",
- "sebastian/environment": "~1.0",
- "sebastian/version": "~1.0"
- },
- "require-dev": {
- "ext-xdebug": ">=2.1.4",
- "phpunit/phpunit": "~4.3"
- },
- "suggest": {
- "ext-dom": "*",
- "ext-xdebug": ">=2.2.1",
- "ext-xmlwriter": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "3.0.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
- "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
- "keywords": [
- "coverage",
- "testing",
- "xunit"
- ],
- "time": "2014-12-02 13:16:21"
- },
- {
- "name": "phpunit/php-file-iterator",
- "version": "1.3.4",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb",
- "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "File/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "FilterIterator implementation that filters files based on a list of suffixes.",
- "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
- "keywords": [
- "filesystem",
- "iterator"
- ],
- "time": "2013-10-10 15:34:57"
- },
- {
- "name": "phpunit/php-text-template",
- "version": "1.2.0",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-text-template.git",
- "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
- "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "Text/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Simple template engine.",
- "homepage": "https://github.com/sebastianbergmann/php-text-template/",
- "keywords": [
- "template"
- ],
- "time": "2014-01-30 17:20:04"
- },
- {
- "name": "phpunit/php-timer",
- "version": "1.0.5",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-timer.git",
- "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
- "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "PHP/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- ""
- ],
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Utility class for timing",
- "homepage": "https://github.com/sebastianbergmann/php-timer/",
- "keywords": [
- "timer"
- ],
- "time": "2013-08-02 07:42:54"
- },
- {
- "name": "phpunit/php-token-stream",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "f8d5d08c56de5cfd592b3340424a81733259a876"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876",
- "reference": "f8d5d08c56de5cfd592b3340424a81733259a876",
- "shasum": ""
- },
- "require": {
- "ext-tokenizer": "*",
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.3-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Wrapper around PHP's tokenizer extension.",
- "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
- "keywords": [
- "tokenizer"
- ],
- "time": "2014-08-31 06:12:13"
- },
- {
- "name": "phpunit/phpunit",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "e3692ba00e445b66477bb65659dcf768c29a0cb8"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e3692ba00e445b66477bb65659dcf768c29a0cb8",
- "reference": "e3692ba00e445b66477bb65659dcf768c29a0cb8",
- "shasum": ""
- },
- "require": {
- "ext-dom": "*",
- "ext-json": "*",
- "ext-pcre": "*",
- "ext-reflection": "*",
- "ext-spl": "*",
- "php": ">=5.3.3",
- "phpspec/prophecy": "~1.3.1",
- "phpunit/php-code-coverage": "3.0.*@dev",
- "phpunit/php-file-iterator": "~1.3.2",
- "phpunit/php-text-template": "~1.2",
- "phpunit/php-timer": "~1.0.2",
- "phpunit/phpunit-mock-objects": "2.4.*@dev",
- "sebastian/comparator": "1.1.*@dev",
- "sebastian/diff": "~1.1",
- "sebastian/environment": "~1.2",
- "sebastian/exporter": "~1.0",
- "sebastian/global-state": "1.0.*@dev",
- "sebastian/version": "~1.0",
- "symfony/yaml": "~2.0"
- },
- "suggest": {
- "phpunit/php-invoker": "~1.1"
- },
- "bin": [
- "phpunit"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "4.5.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de",
- "role": "lead"
- }
- ],
- "description": "The PHP Unit Testing framework.",
- "homepage": "https://phpunit.de/",
- "keywords": [
- "phpunit",
- "testing",
- "xunit"
- ],
- "time": "2014-11-27 18:04:59"
- },
- {
- "name": "phpunit/phpunit-mock-objects",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "96c5b81f9842f38fe6c73ad0020306cc4862a9e3"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/96c5b81f9842f38fe6c73ad0020306cc4862a9e3",
- "reference": "96c5b81f9842f38fe6c73ad0020306cc4862a9e3",
- "shasum": ""
- },
- "require": {
- "doctrine/instantiator": "~1.0,>=1.0.2",
- "php": ">=5.3.3",
- "phpunit/php-text-template": "~1.2"
- },
- "require-dev": {
- "phpunit/phpunit": "4.4.*@dev"
- },
- "suggest": {
- "ext-soap": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.4.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sb@sebastian-bergmann.de",
- "role": "lead"
- }
- ],
- "description": "Mock Object library for PHPUnit",
- "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
- "keywords": [
- "mock",
- "xunit"
- ],
- "time": "2014-10-04 10:04:20"
- },
- {
- "name": "propel/propel1",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/propelorm/Propel.git",
- "reference": "93f9fc84d1ee631f7b4d92bf3bdba4da82fef015"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/propelorm/Propel/zipball/93f9fc84d1ee631f7b4d92bf3bdba4da82fef015",
- "reference": "93f9fc84d1ee631f7b4d92bf3bdba4da82fef015",
- "shasum": ""
- },
- "require": {
- "phing/phing": "~2.4",
- "php": ">=5.2.4"
- },
- "require-dev": {
- "pear-pear.php.net/pear_packagefilemanager2": "@stable"
- },
- "bin": [
- "generator/bin/propel-gen",
- "generator/bin/propel-gen.bat"
- ],
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.7-dev"
- }
- },
- "autoload": {
- "classmap": [
- "runtime/lib",
- "generator/lib"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "include-path": [
- "runtime/lib",
- "generator/lib"
- ],
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "William Durand",
- "email": "william.durand1@gmail.com",
- "homepage": "http://www.willdurand.fr"
- }
- ],
- "description": "Propel is an open-source Object-Relational Mapping (ORM) for PHP5.",
- "homepage": "http://www.propelorm.org/",
- "keywords": [
- "Active Record",
- "database",
- "mapping",
- "orm",
- "persistence"
- ],
- "time": "2013-11-11 11:10:35"
- },
- {
- "name": "sebastian/comparator",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/comparator.git",
- "reference": "c484a80f97573ab934e37826dba0135a3301b26a"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/c484a80f97573ab934e37826dba0135a3301b26a",
- "reference": "c484a80f97573ab934e37826dba0135a3301b26a",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "sebastian/diff": "~1.1",
- "sebastian/exporter": "~1.0"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.1"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.1.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Jeff Welch",
- "email": "whatthejeff@gmail.com"
- },
- {
- "name": "Volker Dusch",
- "email": "github@wallbash.com"
- },
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@2bepublished.at"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Provides the functionality to compare PHP values for equality",
- "homepage": "http://www.github.com/sebastianbergmann/comparator",
- "keywords": [
- "comparator",
- "compare",
- "equality"
- ],
- "time": "2014-11-16 21:32:38"
- },
- {
- "name": "sebastian/diff",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/diff.git",
- "reference": "f38057b48125c2b421361da224a8aa800d70aeca"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/f38057b48125c2b421361da224a8aa800d70aeca",
- "reference": "f38057b48125c2b421361da224a8aa800d70aeca",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.2"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Kore Nordmann",
- "email": "mail@kore-nordmann.de"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Diff implementation",
- "homepage": "http://www.github.com/sebastianbergmann/diff",
- "keywords": [
- "diff"
- ],
- "time": "2014-11-22 06:25:40"
- },
- {
- "name": "sebastian/environment",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/environment.git",
- "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7",
- "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.2.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Provides functionality to handle HHVM/PHP environments",
- "homepage": "http://www.github.com/sebastianbergmann/environment",
- "keywords": [
- "Xdebug",
- "environment",
- "hhvm"
- ],
- "time": "2014-10-25 08:00:45"
- },
- {
- "name": "sebastian/exporter",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/exporter.git",
- "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0",
- "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Jeff Welch",
- "email": "whatthejeff@gmail.com"
- },
- {
- "name": "Volker Dusch",
- "email": "github@wallbash.com"
- },
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@2bepublished.at"
- },
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- },
- {
- "name": "Adam Harvey",
- "email": "aharvey@php.net"
- }
- ],
- "description": "Provides the functionality to export PHP variables for visualization",
- "homepage": "http://www.github.com/sebastianbergmann/exporter",
- "keywords": [
- "export",
- "exporter"
- ],
- "time": "2014-09-10 00:51:36"
- },
- {
- "name": "sebastian/global-state",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/global-state.git",
- "reference": "231d48620efde984fd077ee92916099a3ece9a59"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/231d48620efde984fd077ee92916099a3ece9a59",
- "reference": "231d48620efde984fd077ee92916099a3ece9a59",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.2"
- },
- "suggest": {
- "ext-uopz": "*"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de"
- }
- ],
- "description": "Snapshotting of global state",
- "homepage": "http://www.github.com/sebastianbergmann/global-state",
- "keywords": [
- "global state"
- ],
- "time": "2014-10-06 09:49:11"
- },
- {
- "name": "sebastian/version",
- "version": "1.0.3",
- "source": {
- "type": "git",
- "url": "https://github.com/sebastianbergmann/version.git",
- "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
- "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43",
- "shasum": ""
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "src/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Sebastian Bergmann",
- "email": "sebastian@phpunit.de",
- "role": "lead"
- }
- ],
- "description": "Library that helps with managing the version number of Git-hosted PHP projects",
- "homepage": "https://github.com/sebastianbergmann/version",
- "time": "2014-03-07 15:35:33"
- },
- {
- "name": "symfony/console",
- "version": "dev-master",
- "target-dir": "Symfony/Component/Console",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Console.git",
- "reference": "ff8d5444c1b4dc7675aaeecd35f7ed1f0872c242"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Console/zipball/ff8d5444c1b4dc7675aaeecd35f7ed1f0872c242",
- "reference": "ff8d5444c1b4dc7675aaeecd35f7ed1f0872c242",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "symfony/event-dispatcher": "~2.1"
- },
- "suggest": {
- "symfony/event-dispatcher": ""
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.5-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Console\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony Console Component",
- "homepage": "http://symfony.com",
- "time": "2013-11-28 10:27:35"
- },
- {
- "name": "symfony/event-dispatcher",
- "version": "2.1.x-dev",
- "target-dir": "Symfony/Component/EventDispatcher",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/EventDispatcher.git",
- "reference": "e1d18ff0ff6f3e45ac82f000bc221135df635527"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/e1d18ff0ff6f3e45ac82f000bc221135df635527",
- "reference": "e1d18ff0ff6f3e45ac82f000bc221135df635527",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "symfony/dependency-injection": "2.1.*"
- },
- "suggest": {
- "symfony/dependency-injection": "2.1.*",
- "symfony/http-kernel": "2.1.*"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\EventDispatcher": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony EventDispatcher Component",
- "homepage": "http://symfony.com",
- "time": "2013-02-11 11:26:14"
- },
- {
- "name": "symfony/filesystem",
- "version": "dev-master",
- "target-dir": "Symfony/Component/Filesystem",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Filesystem.git",
- "reference": "c136348f53ef538f1a3fa0b25b73c9c3bf223b31"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Filesystem/zipball/c136348f53ef538f1a3fa0b25b73c9c3bf223b31",
- "reference": "c136348f53ef538f1a3fa0b25b73c9c3bf223b31",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.5-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Filesystem\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony Filesystem Component",
- "homepage": "http://symfony.com",
- "time": "2013-11-24 20:17:07"
- },
- {
- "name": "symfony/form",
- "version": "2.3.x-dev",
- "target-dir": "Symfony/Component/Form",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Form.git",
- "reference": "9a90bf14fe3dd91f46fc6e75cb1813fd0f6ff118"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Form/zipball/9a90bf14fe3dd91f46fc6e75cb1813fd0f6ff118",
- "reference": "9a90bf14fe3dd91f46fc6e75cb1813fd0f6ff118",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "symfony/event-dispatcher": "~2.1",
- "symfony/intl": "~2.3",
- "symfony/options-resolver": "~2.1",
- "symfony/property-access": "~2.3"
- },
- "require-dev": {
- "symfony/http-foundation": "~2.2",
- "symfony/validator": "~2.2"
- },
- "suggest": {
- "symfony/http-foundation": "",
- "symfony/validator": ""
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.3-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Form\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony Form Component",
- "homepage": "http://symfony.com",
- "time": "2014-01-29 06:46:08"
- },
- {
- "name": "symfony/icu",
- "version": "1.2.x-dev",
- "target-dir": "Symfony/Component/Icu",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Icu.git",
- "reference": "98e197da54df1f966dd5e8a4992135703569c987"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Icu/zipball/98e197da54df1f966dd5e8a4992135703569c987",
- "reference": "98e197da54df1f966dd5e8a4992135703569c987",
- "shasum": ""
- },
- "require": {
- "lib-icu": ">=4.4",
- "php": ">=5.3.3",
- "symfony/intl": "~2.3"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Icu\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@gmail.com"
- }
- ],
- "description": "Contains an excerpt of the ICU data and classes to load it.",
- "homepage": "http://symfony.com",
- "keywords": [
- "icu",
- "intl"
- ],
- "time": "2013-10-04 10:06:38"
- },
- {
- "name": "symfony/intl",
- "version": "dev-master",
- "target-dir": "Symfony/Component/Intl",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Intl.git",
- "reference": "e36018d0170a9fcc22cf66a8bca23d433dce3b16"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Intl/zipball/e36018d0170a9fcc22cf66a8bca23d433dce3b16",
- "reference": "e36018d0170a9fcc22cf66a8bca23d433dce3b16",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3",
- "symfony/icu": "~1.0-RC"
- },
- "require-dev": {
- "symfony/filesystem": ">=2.1"
- },
- "suggest": {
- "ext-intl": "to use the component with locales other than \"en\""
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.5-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Intl\\": ""
- },
- "classmap": [
- "Symfony/Component/Intl/Resources/stubs"
- ],
- "files": [
- "Symfony/Component/Intl/Resources/stubs/functions.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- },
- {
- "name": "Igor Wiedler",
- "email": "igor@wiedler.ch",
- "homepage": "http://wiedler.ch/igor/"
- },
- {
- "name": "Bernhard Schussek",
- "email": "bschussek@gmail.com"
- },
- {
- "name": "Eriksen Costa",
- "email": "eriksen.costa@infranology.com.br"
- }
- ],
- "description": "A PHP replacement layer for the C intl extension that includes additional data from the ICU library.",
- "homepage": "http://symfony.com",
- "keywords": [
- "i18n",
- "icu",
- "internationalization",
- "intl",
- "l10n",
- "localization"
- ],
- "time": "2014-01-24 14:36:35"
- },
- {
- "name": "symfony/locale",
- "version": "2.1.x-dev",
- "target-dir": "Symfony/Component/Locale",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Locale.git",
- "reference": "3ad6a5129809b3815a2b9056eee470dc2877717f"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Locale/zipball/3ad6a5129809b3815a2b9056eee470dc2877717f",
- "reference": "3ad6a5129809b3815a2b9056eee470dc2877717f",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "suggest": {
- "ext-intl": ">=5.3.3"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Locale": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony Locale Component",
- "homepage": "http://symfony.com",
- "time": "2013-01-10 04:41:59"
- },
- {
- "name": "symfony/options-resolver",
- "version": "2.1.x-dev",
- "target-dir": "Symfony/Component/OptionsResolver",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/OptionsResolver.git",
- "reference": "1a1319747462c2d457c3e1c8c2c9a26ad4bcb67b"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/OptionsResolver/zipball/1a1319747462c2d457c3e1c8c2c9a26ad4bcb67b",
- "reference": "1a1319747462c2d457c3e1c8c2c9a26ad4bcb67b",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\OptionsResolver": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony OptionsResolver Component",
- "homepage": "http://symfony.com",
- "keywords": [
- "config",
- "configuration",
- "options"
- ],
- "time": "2013-01-09 08:51:07"
- },
- {
- "name": "symfony/property-access",
- "version": "dev-master",
- "target-dir": "Symfony/Component/PropertyAccess",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/PropertyAccess.git",
- "reference": "0a1328b9b197753b2e19aaa24f05c21b2760f0b7"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/0a1328b9b197753b2e19aaa24f05c21b2760f0b7",
- "reference": "0a1328b9b197753b2e19aaa24f05c21b2760f0b7",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.5-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\PropertyAccess\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony PropertyAccess Component",
- "homepage": "http://symfony.com",
- "keywords": [
- "access",
- "array",
- "extraction",
- "index",
- "injection",
- "object",
- "property",
- "property path",
- "reflection"
- ],
- "time": "2014-01-07 13:29:57"
- },
- {
- "name": "symfony/translation",
- "version": "2.1.x-dev",
- "target-dir": "Symfony/Component/Translation",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Translation.git",
- "reference": "39ba7a5dc560959667c45c9353b70f43182ca4b3"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Translation/zipball/39ba7a5dc560959667c45c9353b70f43182ca4b3",
- "reference": "39ba7a5dc560959667c45c9353b70f43182ca4b3",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "symfony/config": "2.1.*",
- "symfony/yaml": "2.1.*"
- },
- "suggest": {
- "symfony/config": "2.1.*",
- "symfony/yaml": "2.1.*"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Translation": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony Translation Component",
- "homepage": "http://symfony.com",
- "time": "2013-04-20 08:25:59"
- },
- {
- "name": "symfony/validator",
- "version": "2.1.x-dev",
- "target-dir": "Symfony/Component/Validator",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Validator.git",
- "reference": "20e121114768672e0a90a25a378e5b14e1331ec0"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Validator/zipball/20e121114768672e0a90a25a378e5b14e1331ec0",
- "reference": "20e121114768672e0a90a25a378e5b14e1331ec0",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "require-dev": {
- "symfony/http-foundation": "2.1.*",
- "symfony/locale": "2.1.*",
- "symfony/yaml": "2.1.*"
- },
- "suggest": {
- "doctrine/common": "~2.1",
- "symfony/http-foundation": "2.1.*",
- "symfony/yaml": "2.1.*"
- },
- "type": "library",
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Validator": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony Validator Component",
- "homepage": "http://symfony.com",
- "time": "2013-08-06 05:58:11"
- },
- {
- "name": "symfony/yaml",
- "version": "dev-master",
- "target-dir": "Symfony/Component/Yaml",
- "source": {
- "type": "git",
- "url": "https://github.com/symfony/Yaml.git",
- "reference": "1481f096caead542c2dfadd67d9fd6124d97e273"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/1481f096caead542c2dfadd67d9fd6124d97e273",
- "reference": "1481f096caead542c2dfadd67d9fd6124d97e273",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.3"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "2.5-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Symfony\\Component\\Yaml\\": ""
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Symfony Community",
- "homepage": "http://symfony.com/contributors"
- }
- ],
- "description": "Symfony Yaml Component",
- "homepage": "http://symfony.com",
- "time": "2013-11-26 16:42:52"
- },
- {
- "name": "twig/twig",
- "version": "dev-master",
- "source": {
- "type": "git",
- "url": "https://github.com/fabpot/Twig.git",
- "reference": "fcecb284f0c3d8f04ea282b70363a2a2023570d9"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/fabpot/Twig/zipball/fcecb284f0c3d8f04ea282b70363a2a2023570d9",
- "reference": "fcecb284f0c3d8f04ea282b70363a2a2023570d9",
- "shasum": ""
- },
- "require": {
- "php": ">=5.2.4"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.15-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Twig_": "lib/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "BSD-3-Clause"
- ],
- "authors": [
- {
- "name": "Fabien Potencier",
- "email": "fabien@symfony.com"
- },
- {
- "name": "Armin Ronacher",
- "email": "armin.ronacher@active-4.com"
- }
- ],
- "description": "Twig, the flexible, fast, and secure template language for PHP",
- "homepage": "http://twig.sensiolabs.org",
- "keywords": [
- "templating"
- ],
- "time": "2013-12-03 14:16:16"
- }
- ],
- "aliases": [],
- "minimum-stability": "dev",
- "stability-flags": [],
- "prefer-stable": false,
- "platform": {
- "php": ">=5.3.2"
- },
- "platform-dev": []
-}
diff --git a/doc/reference/annotations.rst b/doc/reference/annotations.rst
index 25e5f3695..0b1c7fcfd 100644
--- a/doc/reference/annotations.rst
+++ b/doc/reference/annotations.rst
@@ -48,7 +48,7 @@ PHP's ``version_compare`` function.
@Groups
~~~~~~~
-This annotation can be defined on a property to specifiy to if the property
+This annotation can be defined on a property to specify if the property
should be serialized when only serializing specific groups (see
:doc:`../cookbook/exclusion_strategies`).
@@ -148,7 +148,7 @@ default the order is undefined, but you may change it to either "alphabetical",
}
/**
- * @AccessorOrder("custom", custom = {"name", "SomeMethod" ,"id"})
+ * @AccessorOrder("custom", custom = {"name", "someMethod" ,"id"})
*
* Resulting Property Order: name, mood, id
*/
@@ -211,7 +211,7 @@ the object has been deserialized.
@HandlerCallback
~~~~~~~~~~~~~~~~
This annotation can be defined on a method if serialization/deserialization is handled
-by the object iself.
+by the object itself.
.. code-block :: php
@@ -475,6 +475,8 @@ Resulting XML:
+You can also specify the entry tag namespace using the ``namespace`` attribute (``@XmlList(inline = true, entry = "comment", namespace="http://www.example.com/ns")``).
+
@XmlMap
~~~~~~~
Similar to @XmlList, but the keys of the array are meaningful.
diff --git a/doc/reference/xml_reference.rst b/doc/reference/xml_reference.rst
index 214113d8a..4a0712307 100644
--- a/doc/reference/xml_reference.rst
+++ b/doc/reference/xml_reference.rst
@@ -18,6 +18,7 @@ XML Reference
since-version="1.0"
until-version="1.1"
xml-attribute="true"
+ xml-value="true"
access-type="public_method"
accessor-getter="getSomeProperty"
accessor-setter="setSomeProperty"
@@ -32,7 +33,7 @@ XML Reference
your type contains "<" or ">" characters. -->
-
+
diff --git a/doc/reference/yml_reference.rst b/doc/reference/yml_reference.rst
index 05db24bf7..a7728596c 100644
--- a/doc/reference/yml_reference.rst
+++ b/doc/reference/yml_reference.rst
@@ -44,10 +44,12 @@ YAML Reference
xml_list:
inline: true
entry_name: foo
+ namespace: http://www.w3.org/2005/Atom
xml_map:
inline: true
key_attribute_name: foo
entry_name: bar
+ namespace: http://www.w3.org/2005/Atom
xml_attribute_map: true
xml_element:
cdata: false
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 9c173800b..cd62f11a7 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -23,4 +23,9 @@
performance
+
+
+ src
+
+
diff --git a/src/JMS/Serializer/Annotation/XmlCollection.php b/src/JMS/Serializer/Annotation/XmlCollection.php
index dd98dc53b..c0e44feb4 100644
--- a/src/JMS/Serializer/Annotation/XmlCollection.php
+++ b/src/JMS/Serializer/Annotation/XmlCollection.php
@@ -29,4 +29,14 @@ abstract class XmlCollection
* @var boolean
*/
public $inline = false;
+
+ /**
+ * @var string
+ */
+ public $namespace;
+
+ /**
+ * @var boolean
+ */
+ public $skipWhenEmpty = true;
}
diff --git a/src/JMS/Serializer/Construction/ObjectConstructorInterface.php b/src/JMS/Serializer/Construction/ObjectConstructorInterface.php
index 6c1bb03d6..240264bee 100644
--- a/src/JMS/Serializer/Construction/ObjectConstructorInterface.php
+++ b/src/JMS/Serializer/Construction/ObjectConstructorInterface.php
@@ -39,6 +39,7 @@ interface ObjectConstructorInterface
* @param ClassMetadata $metadata
* @param mixed $data
* @param array $type ["name" => string, "params" => array]
+ * @param DeserializationContext $context
*
* @return object
*/
diff --git a/src/JMS/Serializer/Context.php b/src/JMS/Serializer/Context.php
index 597efadd6..c3fc0c50a 100644
--- a/src/JMS/Serializer/Context.php
+++ b/src/JMS/Serializer/Context.php
@@ -51,7 +51,7 @@ abstract class Context
/** @var ExclusionStrategyInterface */
private $exclusionStrategy;
- /** @var boolean */
+ /** @var boolean|null */
private $serializeNull;
private $initialized = false;
@@ -184,6 +184,12 @@ public function enableMaxDepthChecks()
return $this;
}
+ /**
+ * Set if NULLs should be serialized (TRUE) ot not (FALSE)
+ *
+ * @param bool $bool
+ * @return $this
+ */
public function setSerializeNull($bool)
{
$this->serializeNull = (boolean) $bool;
@@ -191,6 +197,14 @@ public function setSerializeNull($bool)
return $this;
}
+ /**
+ * Returns TRUE when NULLs should be serialized
+ * Returns FALSE when NULLs should not be serialized
+ * Returns NULL when NULLs should not be serialized,
+ * but the user has not explicitly decided to use this policy
+ *
+ * @return bool|null
+ */
public function shouldSerializeNull()
{
return $this->serializeNull;
diff --git a/src/JMS/Serializer/Exception/ValidationFailedException.php b/src/JMS/Serializer/Exception/ValidationFailedException.php
index 5044afce8..e06912eaa 100644
--- a/src/JMS/Serializer/Exception/ValidationFailedException.php
+++ b/src/JMS/Serializer/Exception/ValidationFailedException.php
@@ -18,19 +18,25 @@
namespace JMS\Serializer\Exception;
-use Symfony\Component\Validator\ConstraintViolationList;
+use Symfony\Component\Validator\ConstraintViolationListInterface;
class ValidationFailedException extends RuntimeException
{
+ /**
+ * @var ConstraintViolationListInterface
+ */
private $list;
- public function __construct(ConstraintViolationList $list)
+ public function __construct(ConstraintViolationListInterface $list)
{
parent::__construct(sprintf('Validation failed with %d error(s).', count($list)));
$this->list = $list;
}
+ /**
+ * @return ConstraintViolationListInterface
+ */
public function getConstraintViolationList()
{
return $this->list;
diff --git a/src/JMS/Serializer/GenericDeserializationVisitor.php b/src/JMS/Serializer/GenericDeserializationVisitor.php
index 91c727ba0..99b7a0606 100644
--- a/src/JMS/Serializer/GenericDeserializationVisitor.php
+++ b/src/JMS/Serializer/GenericDeserializationVisitor.php
@@ -162,7 +162,15 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
{
$name = $this->namingStrategy->translateName($metadata);
- if (null === $data || ! array_key_exists($name, $data)) {
+ if (null === $data) {
+ return;
+ }
+
+ if ( ! is_array($data)) {
+ throw new RuntimeException(sprintf('Invalid data "%s"(%s), expected "%s".', $data, $metadata->type['name'], $metadata->reflection->class));
+ }
+
+ if ( ! array_key_exists($name, $data)) {
return;
}
@@ -172,13 +180,7 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
$v = $data[$name] !== null ? $this->navigator->accept($data[$name], $metadata->type, $context) : null;
- if (null === $metadata->setter) {
- $metadata->reflection->setValue($this->currentObject, $v);
-
- return;
- }
-
- $this->currentObject->{$metadata->setter}($v);
+ $metadata->setValue($this->currentObject, $v);
}
public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context)
diff --git a/src/JMS/Serializer/GenericSerializationVisitor.php b/src/JMS/Serializer/GenericSerializationVisitor.php
index af2690893..eb0bdf35d 100644
--- a/src/JMS/Serializer/GenericSerializationVisitor.php
+++ b/src/JMS/Serializer/GenericSerializationVisitor.php
@@ -98,14 +98,20 @@ public function visitArray($data, array $type, Context $context)
$rs = array();
}
+ $isList = isset($type['params'][0]) && ! isset($type['params'][1]);
+
foreach ($data as $k => $v) {
$v = $this->navigator->accept($v, $this->getElementType($type), $context);
- if (null === $v && ( ! is_string($k) || ! $context->shouldSerializeNull())) {
+ if (null === $v && ( ! is_string($k) || $context->shouldSerializeNull() !== true)) {
continue;
}
- $rs[$k] = $v;
+ if ($isList) {
+ $rs[] = $v;
+ } else {
+ $rs[$k] = $v;
+ }
}
return $rs;
@@ -138,7 +144,7 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
$v = $metadata->getValue($data);
$v = $this->navigator->accept($v, $metadata->type, $context);
- if (null === $v && ! $context->shouldSerializeNull()) {
+ if (null === $v && $context->shouldSerializeNull() !== true) {
return;
}
@@ -157,8 +163,8 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
* Allows you to add additional data to the current object/root element.
*
* @param string $key
- * @param scalar|array|null $value This value must either be a regular scalar, or an array.
- * It must not contain any objects anymore.
+ * @param integer|float|boolean|string|array|null $value This value must either be a regular scalar, or an array.
+ * It must not contain any objects anymore.
*/
public function addData($key, $value)
{
@@ -169,12 +175,23 @@ public function addData($key, $value)
$this->data[$key] = $value;
}
+ /**
+ * Checks if some data key exists.
+ *
+ * @param string $key
+ * @return boolean
+ */
+ public function hasData($key)
+ {
+ return isset($this->data[$key]);
+ }
+
/**
* Allows you to replace existing data on the current object/root element.
*
* @param string $key
- * @param scalar|array|null $value This value must either be a regular scalar, or an array.
- * It must not contain any objects anymore.
+ * @param integer|float|boolean|string|array|null $value This value must either be a regular scalar, or an array.
+ * It must not contain any objects anymore.
*/
public function replaceData($key, $value)
{
diff --git a/src/JMS/Serializer/GraphNavigator.php b/src/JMS/Serializer/GraphNavigator.php
index 87a4908f7..c3b10b952 100644
--- a/src/JMS/Serializer/GraphNavigator.php
+++ b/src/JMS/Serializer/GraphNavigator.php
@@ -188,7 +188,7 @@ public function accept($data, array $type = null, Context $context)
$metadata = $this->metadataFactory->getMetadataForClass($type['name']);
if ($context instanceof DeserializationContext && ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) {
- $metadata = $this->resolveMetadata($context, $data, $metadata);
+ $metadata = $this->resolveMetadata($data, $metadata);
}
if (null !== $exclusionStrategy && $exclusionStrategy->shouldSkipClass($metadata, $context)) {
@@ -249,7 +249,7 @@ public function accept($data, array $type = null, Context $context)
}
}
- private function resolveMetadata(DeserializationContext $context, $data, ClassMetadata $metadata)
+ private function resolveMetadata($data, ClassMetadata $metadata)
{
switch (true) {
case is_array($data) && isset($data[$metadata->discriminatorFieldName]):
diff --git a/src/JMS/Serializer/Handler/ArrayCollectionHandler.php b/src/JMS/Serializer/Handler/ArrayCollectionHandler.php
index 25fe055e3..7bb1632f8 100644
--- a/src/JMS/Serializer/Handler/ArrayCollectionHandler.php
+++ b/src/JMS/Serializer/Handler/ArrayCollectionHandler.php
@@ -23,7 +23,6 @@
use JMS\Serializer\GraphNavigator;
use JMS\Serializer\VisitorInterface;
use Doctrine\Common\Collections\Collection;
-use JMS\Serializer\Handler\SubscribingHandlerInterface;
class ArrayCollectionHandler implements SubscribingHandlerInterface
{
diff --git a/src/JMS/Serializer/Handler/DateHandler.php b/src/JMS/Serializer/Handler/DateHandler.php
index 22505816c..cc6b421a5 100644
--- a/src/JMS/Serializer/Handler/DateHandler.php
+++ b/src/JMS/Serializer/Handler/DateHandler.php
@@ -69,6 +69,12 @@ public function serializeDateTime(VisitorInterface $visitor, \DateTime $date, ar
if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) {
return $visitor->visitSimpleString($date->format($this->getFormat($type)), $type, $context);
}
+
+ $format = $this->getFormat($type);
+ if ('U' === $format) {
+ return $visitor->visitInteger($date->format($format), $type, $context);
+ }
+
return $visitor->visitString($date->format($this->getFormat($type)), $type, $context);
}
diff --git a/src/JMS/Serializer/Handler/FormErrorHandler.php b/src/JMS/Serializer/Handler/FormErrorHandler.php
index 5ae03be8f..2c4531ea5 100644
--- a/src/JMS/Serializer/Handler/FormErrorHandler.php
+++ b/src/JMS/Serializer/Handler/FormErrorHandler.php
@@ -129,7 +129,8 @@ private function convertFormToArray(GenericSerializationVisitor $visitor, Form $
{
$isRoot = null === $visitor->getRoot();
- $form = $errors = array();
+ $form = new \ArrayObject();
+ $errors = array();
foreach ($data->getErrors() as $error) {
$errors[] = $this->getErrorMessage($error);
}
diff --git a/src/JMS/Serializer/Metadata/ClassMetadata.php b/src/JMS/Serializer/Metadata/ClassMetadata.php
index 044f8a5cd..f81f01ef4 100644
--- a/src/JMS/Serializer/Metadata/ClassMetadata.php
+++ b/src/JMS/Serializer/Metadata/ClassMetadata.php
@@ -266,12 +266,13 @@ private function sortProperties()
case self::ACCESSOR_ORDER_CUSTOM:
$order = $this->customOrder;
- uksort($this->propertyMetadata, function($a, $b) use ($order) {
+ $currentSorting = $this->propertyMetadata ? array_combine(array_keys($this->propertyMetadata), range(1, count($this->propertyMetadata))) : [];
+ uksort($this->propertyMetadata, function($a, $b) use ($order, $currentSorting) {
$existsA = isset($order[$a]);
$existsB = isset($order[$b]);
if ( ! $existsA && ! $existsB) {
- return 0;
+ return $currentSorting[$a] - $currentSorting[$b];
}
if ( ! $existsA) {
diff --git a/src/JMS/Serializer/Metadata/Driver/AnnotationDriver.php b/src/JMS/Serializer/Metadata/Driver/AnnotationDriver.php
index 30fe6142d..739368231 100644
--- a/src/JMS/Serializer/Metadata/Driver/AnnotationDriver.php
+++ b/src/JMS/Serializer/Metadata/Driver/AnnotationDriver.php
@@ -133,7 +133,7 @@ public function loadMetadataForClass(\ReflectionClass $class)
if ( ! $excludeAll) {
foreach ($class->getProperties() as $property) {
- if ($property->class !== $name) {
+ if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
continue;
}
$propertiesMetadata[] = new PropertyMetadata($name, $property->getName());
@@ -170,10 +170,13 @@ public function loadMetadataForClass(\ReflectionClass $class)
$propertyMetadata->xmlCollection = true;
$propertyMetadata->xmlCollectionInline = $annot->inline;
$propertyMetadata->xmlEntryName = $annot->entry;
+ $propertyMetadata->xmlEntryNamespace = $annot->namespace;
+ $propertyMetadata->xmlCollectionSkipWhenEmpty = $annot->skipWhenEmpty;
} elseif ($annot instanceof XmlMap) {
$propertyMetadata->xmlCollection = true;
$propertyMetadata->xmlCollectionInline = $annot->inline;
$propertyMetadata->xmlEntryName = $annot->entry;
+ $propertyMetadata->xmlEntryNamespace = $annot->namespace;
$propertyMetadata->xmlKeyAttribute = $annot->keyAttribute;
} elseif ($annot instanceof XmlKeyValuePairs) {
$propertyMetadata->xmlKeyValuePairs = true;
@@ -211,10 +214,10 @@ public function loadMetadataForClass(\ReflectionClass $class)
}
}
- $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]);
if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
|| (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)) {
+ $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]);
$classMetadata->addPropertyMetadata($propertyMetadata);
}
}
diff --git a/src/JMS/Serializer/Metadata/Driver/DoctrinePHPCRTypeDriver.php b/src/JMS/Serializer/Metadata/Driver/DoctrinePHPCRTypeDriver.php
index 3286cbf18..7cade9cd6 100644
--- a/src/JMS/Serializer/Metadata/Driver/DoctrinePHPCRTypeDriver.php
+++ b/src/JMS/Serializer/Metadata/Driver/DoctrinePHPCRTypeDriver.php
@@ -42,7 +42,7 @@ protected function setPropertyType(DoctrineClassMetadata $doctrineMetadata, Prop
{
$propertyName = $propertyMetadata->name;
if ($doctrineMetadata->hasField($propertyName) && $fieldType = $this->normalizeFieldType($doctrineMetadata->getTypeOfField($propertyName))) {
- $field = $doctrineMetadata->getField($propertyName);
+ $field = $doctrineMetadata->getFieldMapping($propertyName);
if ( ! empty($field['multivalue'])) {
$fieldType = 'array';
}
diff --git a/src/JMS/Serializer/Metadata/Driver/XmlDriver.php b/src/JMS/Serializer/Metadata/Driver/XmlDriver.php
index 5383abac4..42b3cafcf 100644
--- a/src/JMS/Serializer/Metadata/Driver/XmlDriver.php
+++ b/src/JMS/Serializer/Metadata/Driver/XmlDriver.php
@@ -113,7 +113,7 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $path)
if ( ! $excludeAll) {
foreach ($class->getProperties() as $property) {
- if ($name !== $property->class) {
+ if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
continue;
}
@@ -162,6 +162,7 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $path)
}
if (isset($pElem->{'xml-list'})) {
+
$pMetadata->xmlCollection = true;
$colConfig = $pElem->{'xml-list'};
@@ -172,6 +173,16 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $path)
if (isset($colConfig->attributes()->{'entry-name'})) {
$pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'};
}
+
+ if (isset($colConfig->attributes()->{'skip-when-empty'})) {
+ $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string) $colConfig->attributes()->{'skip-when-empty'};
+ } else {
+ $pMetadata->xmlCollectionSkipWhenEmpty = true;
+ }
+
+ if (isset($colConfig->attributes()->namespace)) {
+ $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace;
+ }
}
if (isset($pElem->{'xml-map'})) {
@@ -186,6 +197,10 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $path)
$pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'};
}
+ if (isset($colConfig->attributes()->namespace)) {
+ $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace;
+ }
+
if (isset($colConfig->attributes()->{'key-attribute-name'})) {
$pMetadata->xmlKeyAttribute = (string) $colConfig->attributes()->{'key-attribute-name'};
}
@@ -207,7 +222,7 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $path)
}
if (isset($pElem->attributes()->{'xml-attribute-map'})) {
- $pMetadata->xmlAttribute = 'true' === (string) $pElem->attributes()->{'xml-attribute-map'};
+ $pMetadata->xmlAttributeMap = 'true' === (string) $pElem->attributes()->{'xml-attribute-map'};
}
if (isset($pElem->attributes()->{'xml-value'})) {
diff --git a/src/JMS/Serializer/Metadata/Driver/YamlDriver.php b/src/JMS/Serializer/Metadata/Driver/YamlDriver.php
index bb1f56b2a..00bb560af 100644
--- a/src/JMS/Serializer/Metadata/Driver/YamlDriver.php
+++ b/src/JMS/Serializer/Metadata/Driver/YamlDriver.php
@@ -64,7 +64,7 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $file)
if ( ! $excludeAll) {
foreach ($class->getProperties() as $property) {
- if ($name !== $property->class) {
+ if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) {
continue;
}
@@ -113,11 +113,21 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $file)
$colConfig = $pConfig['xml_list'];
if (isset($colConfig['inline'])) {
- $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline'];
+ $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline'];
}
if (isset($colConfig['entry_name'])) {
- $pMetadata->xmlEntryName = (string) $colConfig['entry_name'];
+ $pMetadata->xmlEntryName = (string)$colConfig['entry_name'];
+ }
+
+ if (isset($colConfig['skip_when_empty'])) {
+ $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty'];
+ } else {
+ $pMetadata->xmlCollectionSkipWhenEmpty = true;
+ }
+
+ if (isset($colConfig['namespace'])) {
+ $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace'];
}
}
@@ -133,9 +143,14 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $file)
$pMetadata->xmlEntryName = (string) $colConfig['entry_name'];
}
+ if (isset($colConfig['namespace'])) {
+ $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace'];
+ }
+
if (isset($colConfig['key_attribute_name'])) {
$pMetadata->xmlKeyAttribute = $colConfig['key_attribute_name'];
}
+
}
if (isset($pConfig['xml_element'])) {
@@ -194,9 +209,9 @@ protected function loadMetadataFromFile(\ReflectionClass $class, $file)
}
if (isset($config['handler_callbacks'])) {
- foreach ($config['handler_callbacks'] as $direction => $formats) {
+ foreach ($config['handler_callbacks'] as $directionName => $formats) {
+ $direction = GraphNavigator::parseDirection($directionName);
foreach ($formats as $format => $methodName) {
- $direction = GraphNavigator::parseDirection($direction);
$metadata->addHandlerCallback($direction, $format, $methodName);
}
}
diff --git a/src/JMS/Serializer/Metadata/PropertyMetadata.php b/src/JMS/Serializer/Metadata/PropertyMetadata.php
index 34fa8478e..745725e22 100644
--- a/src/JMS/Serializer/Metadata/PropertyMetadata.php
+++ b/src/JMS/Serializer/Metadata/PropertyMetadata.php
@@ -34,7 +34,9 @@ class PropertyMetadata extends BasePropertyMetadata
public $type;
public $xmlCollection = false;
public $xmlCollectionInline = false;
+ public $xmlCollectionSkipWhenEmpty = true;
public $xmlEntryName;
+ public $xmlEntryNamespace;
public $xmlKeyAttribute;
public $xmlAttribute = false;
public $xmlValue = false;
@@ -89,6 +91,16 @@ public function getValue($obj)
return $obj->{$this->getter}();
}
+ public function setValue($obj, $value)
+ {
+ if (null === $this->setter) {
+ parent::setValue($obj, $value);
+ return;
+ }
+
+ $obj->{$this->setter}($value);
+ }
+
public function setType($type)
{
if (null === self::$typeParser) {
@@ -122,11 +134,14 @@ public function serialize()
$this->xmlAttributeMap,
$this->maxDepth,
parent::serialize(),
+ 'xmlEntryNamespace' => $this->xmlEntryNamespace,
+ 'xmlCollectionSkipWhenEmpty' => $this->xmlCollectionSkipWhenEmpty,
));
}
public function unserialize($str)
{
+ $unserialized = unserialize($str);
list(
$this->sinceVersion,
$this->untilVersion,
@@ -149,7 +164,15 @@ public function unserialize($str)
$this->xmlAttributeMap,
$this->maxDepth,
$parentStr
- ) = unserialize($str);
+ ) = $unserialized;
+
+ if (isset($unserialized['xmlEntryNamespace'])){
+ $this->xmlEntryNamespace = $unserialized['xmlEntryNamespace'];
+ }
+ if (isset($unserialized['xmlCollectionSkipWhenEmpty'])){
+ $this->xmlCollectionSkipWhenEmpty = $unserialized['xmlCollectionSkipWhenEmpty'];
+ }
+
parent::unserialize($parentStr);
}
diff --git a/src/JMS/Serializer/SerializationContext.php b/src/JMS/Serializer/SerializationContext.php
index ac878e324..f54040e99 100644
--- a/src/JMS/Serializer/SerializationContext.php
+++ b/src/JMS/Serializer/SerializationContext.php
@@ -48,12 +48,18 @@ public function initialize($format, VisitorInterface $visitor, GraphNavigator $n
public function startVisiting($object)
{
+ if ( ! is_object($object)) {
+ return;
+ }
$this->visitingSet->attach($object);
$this->visitingStack->push($object);
}
public function stopVisiting($object)
{
+ if ( ! is_object($object)) {
+ return;
+ }
$this->visitingSet->detach($object);
$poppedObject = $this->visitingStack->pop();
@@ -65,7 +71,7 @@ public function stopVisiting($object)
public function isVisiting($object)
{
if ( ! is_object($object)) {
- throw new LogicException('Expected object but got '.gettype($object).'. Do you have the wrong @Type mapping or could this be a Doctrine many-to-many relation?');
+ return false;
}
return $this->visitingSet->contains($object);
diff --git a/src/JMS/Serializer/Twig/SerializerExtension.php b/src/JMS/Serializer/Twig/SerializerExtension.php
index 3af4dabec..b5e752bd8 100644
--- a/src/JMS/Serializer/Twig/SerializerExtension.php
+++ b/src/JMS/Serializer/Twig/SerializerExtension.php
@@ -43,27 +43,17 @@ public function __construct(SerializerInterface $serializer)
public function getFilters()
{
return array(
- 'serialize' => new \Twig_Filter_Method($this, 'serialize'),
+ new \Twig_SimpleFilter('serialize', array($this, 'serialize')),
);
}
public function getFunctions()
{
return array(
- 'serialization_context' => new \Twig_Function_Method($this, 'createContext'),
+ new \Twig_SimpleFunction('serialization_context', '\JMS\Serializer\SerializationContext::create'),
);
}
- /**
- * Creates the serialization context
- *
- * @return SerializationContext
- */
- public function createContext()
- {
- return SerializationContext::create();
- }
-
/**
* @param object $object
* @param string $type
diff --git a/src/JMS/Serializer/XmlDeserializationVisitor.php b/src/JMS/Serializer/XmlDeserializationVisitor.php
index fe2fd7d6f..61397d6c3 100644
--- a/src/JMS/Serializer/XmlDeserializationVisitor.php
+++ b/src/JMS/Serializer/XmlDeserializationVisitor.php
@@ -29,6 +29,7 @@ class XmlDeserializationVisitor extends AbstractVisitor
{
private $objectStack;
private $metadataStack;
+ private $objectMetadataStack;
private $currentObject;
private $currentMetadata;
private $result;
@@ -46,6 +47,7 @@ public function setNavigator(GraphNavigator $navigator)
$this->navigator = $navigator;
$this->objectStack = new \SplStack;
$this->metadataStack = new \SplStack;
+ $this->objectMetadataStack = new \SplStack;
$this->result = null;
}
@@ -59,21 +61,18 @@ public function prepare($data)
$previous = libxml_use_internal_errors(true);
$previousEntityLoaderState = libxml_disable_entity_loader($this->disableExternalEntities);
- $dom = new \DOMDocument();
- $dom->loadXML($data);
- foreach ($dom->childNodes as $child) {
- if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
- $internalSubset = $this->getDomDocumentTypeEntitySubset($child, $data);
- if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) {
- throw new InvalidArgumentException(sprintf(
- 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
- $internalSubset
- ));
- }
+ if (false !== stripos($data, 'getDomDocumentTypeEntitySubset($data);
+ if (!in_array($internalSubset, $this->doctypeWhitelist, true)) {
+ throw new InvalidArgumentException(sprintf(
+ 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.',
+ $internalSubset
+ ));
}
}
$doc = simplexml_load_string($data);
+
libxml_use_internal_errors($previous);
libxml_disable_entity_loader($previousEntityLoaderState);
@@ -144,8 +143,14 @@ public function visitDouble($data, array $type, Context $context)
public function visitArray($data, array $type, Context $context)
{
$entryName = null !== $this->currentMetadata && $this->currentMetadata->xmlEntryName ? $this->currentMetadata->xmlEntryName : 'entry';
+ $namespace = null !== $this->currentMetadata && $this->currentMetadata->xmlEntryNamespace ? $this->currentMetadata->xmlEntryNamespace : null;
+
+ if ($namespace === null && $this->objectMetadataStack->count()) {
+ $classMetadata = $this->objectMetadataStack->top();
+ $namespace = isset($classMetadata->xmlNamespaces[''])?$classMetadata->xmlNamespaces['']:$namespace;
+ }
- if ( ! isset($data->$entryName)) {
+ if ( ! isset($data->$entryName) ) {
if (null === $this->result) {
return $this->result = array();
}
@@ -159,11 +164,13 @@ public function visitArray($data, array $type, Context $context)
case 1:
$result = array();
+
if (null === $this->result) {
$this->result = &$result;
}
- foreach ($data->$entryName as $v) {
+ $nodes = $data->children($namespace)->$entryName;
+ foreach ($nodes as $v) {
$result[] = $this->navigator->accept($v, $type['params'][0], $context);
}
@@ -180,12 +187,14 @@ public function visitArray($data, array $type, Context $context)
$this->result = &$result;
}
- foreach ($data->$entryName as $v) {
- if ( ! isset($v[$this->currentMetadata->xmlKeyAttribute])) {
+ $nodes = $data->children($namespace)->$entryName;
+ foreach ($nodes as $v) {
+ $attrs = $v->attributes();
+ if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) {
throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute));
}
- $k = $this->navigator->accept($v[$this->currentMetadata->xmlKeyAttribute], $keyType, $context);
+ $k = $this->navigator->accept($attrs[$this->currentMetadata->xmlKeyAttribute], $keyType, $context);
$result[$k] = $this->navigator->accept($v, $entryType, $context);
}
@@ -199,7 +208,7 @@ public function visitArray($data, array $type, Context $context)
public function startVisitingObject(ClassMetadata $metadata, $object, array $type, Context $context)
{
$this->setCurrentObject($object);
-
+ $this->objectMetadataStack->push($metadata);
if (null === $this->result) {
$this->result = $this->currentObject;
}
@@ -213,22 +222,11 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name));
}
- if ($metadata->xmlAttribute) {
- if ('' !== $namespace = (string) $metadata->xmlNamespace) {
- $registeredNamespaces = $data->getDocNamespaces();
- if (false === $prefix = array_search($namespace, $registeredNamespaces)) {
- $prefix = uniqid('ns-');
- $data->registerXPathNamespace($prefix, $namespace);
- }
- $attributeName = ($prefix === '') ? $name : $prefix.':'.$name;
- $nodes = $data->xpath('./@'.$attributeName);
- if ( ! empty($nodes)) {
- $v = (string) reset($nodes);
- $metadata->reflection->setValue($this->currentObject, $v);
- }
+ if ($metadata->xmlAttribute) {
- } elseif (isset($data[$name])) {
- $v = $this->navigator->accept($data[$name], $metadata->type, $context);
+ $attributes = $data->attributes($metadata->xmlNamespace);
+ if (isset($attributes[$name])) {
+ $v = $this->navigator->accept($attributes[$name], $metadata->type, $context);
$metadata->reflection->setValue($this->currentObject, $v);
}
@@ -244,8 +242,8 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
if ($metadata->xmlCollection) {
$enclosingElem = $data;
- if ( ! $metadata->xmlCollectionInline && isset($data->$name)) {
- $enclosingElem = $data->$name;
+ if (!$metadata->xmlCollectionInline) {
+ $enclosingElem = $data->children($metadata->xmlNamespace)->$name;
}
$this->setCurrentMetadata($metadata);
@@ -256,39 +254,37 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
return;
}
- if ('' !== $namespace = (string) $metadata->xmlNamespace) {
- $registeredNamespaces = $data->getDocNamespaces();
- if (false === $prefix = array_search($namespace, $registeredNamespaces)) {
+ if ($metadata->xmlNamespace) {
+ $node = $data->children($metadata->xmlNamespace)->$name;
+ if (!$node->count()) {
+ return;
+ }
+ } else {
+
+ $namespaces = $data->getDocNamespaces();
+
+ if (isset($namespaces[''])) {
$prefix = uniqid('ns-');
- $data->registerXPathNamespace($prefix, $namespace);
+ $data->registerXPathNamespace($prefix, $namespaces['']);
+ $nodes = $data->xpath('./'.$prefix. ':'.$name );
+ } else {
+ $nodes = $data->xpath('./'. $name );
}
- $elementName = ($prefix === '') ? $name : $prefix.':'.$name;
- $nodes = $data->xpath('./'.$elementName);
if (empty($nodes)) {
return;
}
$node = reset($nodes);
- } else {
- if ( ! isset($data->$name)) {
- return;
- }
- $node = $data->$name;
}
$v = $this->navigator->accept($node, $metadata->type, $context);
- if (null === $metadata->setter) {
- $metadata->reflection->setValue($this->currentObject, $v);
-
- return;
- }
-
- $this->currentObject->{$metadata->setter}($v);
+ $metadata->setValue($this->currentObject, $v);
}
public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context)
{
$rs = $this->currentObject;
+ $this->objectMetadataStack->pop();
$this->revertCurrentObject();
return $rs;
@@ -354,12 +350,8 @@ public function getDoctypeWhitelist()
* @param string $data
* @return string
*/
- private function getDomDocumentTypeEntitySubset(\DOMDocumentType $child, $data)
+ private function getDomDocumentTypeEntitySubset($data)
{
- if (null !== $child->internalSubset) {
- return str_replace(array("\n", "\r"), '', $child->internalSubset);
- }
-
$startPos = $endPos = stripos($data, 'objectMetadataStack = new \SplStack;
+ }
public function setDefaultRootName($name, $namespace = null)
{
@@ -161,11 +168,12 @@ public function visitArray($data, array $type, Context $context)
$entryName = (null !== $this->currentMetadata && null !== $this->currentMetadata->xmlEntryName) ? $this->currentMetadata->xmlEntryName : 'entry';
$keyAttributeName = (null !== $this->currentMetadata && null !== $this->currentMetadata->xmlKeyAttribute) ? $this->currentMetadata->xmlKeyAttribute : null;
+ $namespace = (null !== $this->currentMetadata && null !== $this->currentMetadata->xmlEntryNamespace) ? $this->currentMetadata->xmlEntryNamespace : null;
foreach ($data as $k => $v) {
$tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid($k)) ? $k : $entryName;
- $entryNode = $this->document->createElement($tagName);
+ $entryNode = $this->createElement($tagName, $namespace);
$this->currentNode->appendChild($entryNode);
$this->setCurrentNode($entryNode);
@@ -183,23 +191,27 @@ public function visitArray($data, array $type, Context $context)
public function startVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context)
{
+ $this->objectMetadataStack->push($metadata);
+
if (null === $this->document) {
$this->document = $this->createDocument(null, null, false);
if ($metadata->xmlRootName) {
$rootName = $metadata->xmlRootName;
- $rootNamespace = $metadata->xmlRootNamespace;
+ $rootNamespace = $metadata->xmlRootNamespace?:$this->getClassDefaultNamespace($metadata);
} else {
$rootName = $this->defaultRootName;
$rootNamespace = $this->defaultRootNamespace;
}
+
if ($rootNamespace) {
$this->currentNode = $this->document->createElementNS($rootNamespace, $rootName);
} else {
$this->currentNode = $this->document->createElement($rootName);
}
+
$this->document->appendChild($this->currentNode);
}
-
+
$this->addNamespaceAttributes($metadata, $this->currentNode);
$this->hasValue = false;
@@ -209,7 +221,7 @@ public function visitProperty(PropertyMetadata $metadata, $object, Context $cont
{
$v = $metadata->getValue($object);
- if (null === $v && ! $context->shouldSerializeNull()) {
+ if (null === $v && $context->shouldSerializeNull() !== true) {
return;
}
@@ -219,17 +231,10 @@ public function visitProperty(PropertyMetadata $metadata, $object, Context $cont
$this->revertCurrentMetadata();
if ( ! $node instanceof \DOMCharacterData) {
- throw new RuntimeException(sprintf('Unsupported value for XML attribute. Expected character data, but got %s.', json_encode($v)));
+ throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v)));
}
$attributeName = $this->namingStrategy->translateName($metadata);
- if ('' !== $namespace = (string) $metadata->xmlNamespace) {
- if ( ! $prefix = $this->currentNode->lookupPrefix($namespace)) {
- $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
- }
- $this->currentNode->setAttributeNS($namespace, $prefix.':'.$attributeName, $node->nodeValue);
- } else {
- $this->currentNode->setAttribute($attributeName, $node->nodeValue);
- }
+ $this->setAttributeOnNode($this->currentNode, $attributeName, $node->nodeValue, $metadata->xmlNamespace);
return;
}
@@ -269,14 +274,7 @@ public function visitProperty(PropertyMetadata $metadata, $object, Context $cont
throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v)));
}
- if ('' !== $namespace = (string) $metadata->xmlNamespace) {
- if ( ! $prefix = $this->currentNode->lookupPrefix($namespace)) {
- $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
- }
- $this->currentNode->setAttributeNS($namespace, $prefix.':'.$key, $node->nodeValue);
- } else {
- $this->currentNode->setAttribute($key, $node->nodeValue);
- }
+ $this->setAttributeOnNode($this->currentNode, $key, $node->nodeValue, $metadata->xmlNamespace);
}
return;
@@ -284,13 +282,12 @@ public function visitProperty(PropertyMetadata $metadata, $object, Context $cont
if ($addEnclosingElement = ( ! $metadata->xmlCollection || ! $metadata->xmlCollectionInline) && ! $metadata->inline) {
$elementName = $this->namingStrategy->translateName($metadata);
- if ('' !== $namespace = (string) $metadata->xmlNamespace) {
- if ( ! $prefix = $this->currentNode->lookupPrefix($namespace)) {
- $prefix = 'ns-'.substr(sha1($namespace), 0, 8);
- }
- $element = $this->document->createElementNS($namespace, $prefix.':'.$elementName);
+
+ if (null !== $metadata->xmlNamespace) {
+ $element = $this->createElement($elementName, $metadata->xmlNamespace);
} else {
- $element = $this->document->createElement($elementName);
+ $defaultNamespace = $this->getClassDefaultNamespace($this->objectMetadataStack->top());
+ $element = $this->createElement($elementName, $defaultNamespace);
}
$this->setCurrentNode($element);
}
@@ -306,8 +303,7 @@ public function visitProperty(PropertyMetadata $metadata, $object, Context $cont
if ($addEnclosingElement) {
$this->revertCurrentNode();
- if ($element->hasChildNodes() || $element->hasAttributes()
- || (isset($metadata->type['name']) && $metadata->type['name'] === 'array' && isset($metadata->type['params'][1]))) {
+ if ($this->nodeNotEmpty($element) || ((!$metadata->xmlCollection || !$metadata->xmlCollectionSkipWhenEmpty) && $node === null && $v !== null && !$context->isVisiting($v))) {
$this->currentNode->appendChild($element);
}
}
@@ -315,8 +311,14 @@ public function visitProperty(PropertyMetadata $metadata, $object, Context $cont
$this->hasValue = false;
}
+ private function nodeNotEmpty(\DOMElement $element)
+ {
+ return $element->hasChildNodes() || $element->hasAttributes();
+ }
+
public function endVisitingObject(ClassMetadata $metadata, $data, array $type, Context $context)
{
+ $this->objectMetadataStack->pop();
}
public function getResult()
@@ -421,7 +423,7 @@ private function attachNullNamespace()
$this->nullWasVisited = true;
}
}
-
+
/**
* Adds namespace attributes to the XML root element
*
@@ -434,8 +436,43 @@ private function addNamespaceAttributes(ClassMetadata $metadata, \DOMElement $el
$attribute = 'xmlns';
if ($prefix !== '') {
$attribute .= ':'.$prefix;
+ } elseif ($element->namespaceURI === $uri) {
+ continue;
}
$element->setAttributeNS('http://www.w3.org/2000/xmlns/', $attribute, $uri);
}
}
+
+ private function createElement($tagName, $namespace = null)
+ {
+ if (null === $namespace) {
+ return $this->document->createElement($tagName);
+ }
+ if ($this->currentNode->isDefaultNamespace($namespace)) {
+ return $this->document->createElementNS($namespace, $tagName);
+ }
+ if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) {
+ $prefix = 'ns-'. substr(sha1($namespace), 0, 8);
+ return $this->document->createElementNS($namespace, $prefix . ':' . $tagName);
+ }
+ return $this->document->createElement($prefix . ':' . $tagName);
+ }
+
+ private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null)
+ {
+ if (null !== $namespace) {
+ if (!$prefix = $node->lookupPrefix($namespace)) {
+ $prefix = 'ns-'. substr(sha1($namespace), 0, 8);
+ }
+ $node->setAttributeNS($namespace, $prefix.':'.$name, $value);
+ } else {
+ $node->setAttribute($name, $value);
+ }
+ }
+
+ private function getClassDefaultNamespace(ClassMetadata $metadata)
+ {
+ return (isset($metadata->xmlNamespaces[''])?$metadata->xmlNamespaces['']:null);
+ }
+
}
diff --git a/src/JMS/Serializer/YamlSerializationVisitor.php b/src/JMS/Serializer/YamlSerializationVisitor.php
index 933aa9f80..c23059557 100644
--- a/src/JMS/Serializer/YamlSerializationVisitor.php
+++ b/src/JMS/Serializer/YamlSerializationVisitor.php
@@ -81,10 +81,11 @@ public function visitString($data, array $type, Context $context)
public function visitArray($data, array $type, Context $context)
{
$count = $this->writer->changeCount;
- $isList = array_keys($data) === range(0, count($data) - 1);
+ $isList = (isset($type['params'][0]) && ! isset($type['params'][1]))
+ || array_keys($data) === range(0, count($data) - 1);
foreach ($data as $k => $v) {
- if (null === $v && ( ! is_string($k) || ! $context->shouldSerializeNull())) {
+ if (null === $v && ( ! is_string($k) || $context->shouldSerializeNull() !== true)) {
continue;
}
@@ -111,6 +112,11 @@ public function visitArray($data, array $type, Context $context)
->rtrim(false)
->writeln(' {}')
;
+ } elseif (empty($data)) {
+ $this->writer
+ ->rtrim(false)
+ ->writeln(' []')
+ ;
}
}
@@ -155,7 +161,7 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
{
$v = $metadata->getValue($data);
- if (null === $v && ! $context->shouldSerializeNull()) {
+ if (null === $v && $context->shouldSerializeNull() !== true) {
return;
}
diff --git a/tests/JMS/Serializer/Tests/Fixtures/BlogPost.php b/tests/JMS/Serializer/Tests/Fixtures/BlogPost.php
index 48d9295d7..a0f527901 100644
--- a/tests/JMS/Serializer/Tests/Fixtures/BlogPost.php
+++ b/tests/JMS/Serializer/Tests/Fixtures/BlogPost.php
@@ -107,6 +107,12 @@ class BlogPost
*/
private $publisher;
+ /**
+ * @Type("array")
+ * @XmlList(inline=true, entry="tag", namespace="http://purl.org/dc/elements/1.1/");
+ */
+ private $tag;
+
public function __construct($title, Author $author, \DateTime $createdAt, Publisher $publisher)
{
$this->title = $title;
@@ -136,4 +142,9 @@ public function addComment(Comment $comment)
$this->comments->add($comment);
$this->comments2->add($comment);
}
+
+ public function addTag(Tag $tag)
+ {
+ $this->tag[] = $tag;
+ }
}
diff --git a/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/Author.php b/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/Author.php
index e726197e1..3774ff5e1 100644
--- a/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/Author.php
+++ b/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/Author.php
@@ -32,7 +32,7 @@ class Author
protected $id;
/**
- * @PHPCRODM\String()
+ * @PHPCRODM\Field(type="string")
* @SerializedName("full_name")
*/
private $name;
diff --git a/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/BlogPost.php b/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/BlogPost.php
index 397dc926c..db03ee5ed 100644
--- a/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/BlogPost.php
+++ b/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/BlogPost.php
@@ -39,24 +39,24 @@ class BlogPost
protected $id;
/**
- * @PHPCRODM\String()
+ * @PHPCRODM\Field(type="string")
* @Groups({"comments","post"})
*/
private $title;
/**
- * @PHPCRODM\String()
+ * @PHPCRODM\Field(type="string")
*/
protected $slug;
/**
- * @PHPCRODM\Date()
+ * @PHPCRODM\Field(type="date")
* @XmlAttribute
*/
private $createdAt;
/**
- * @PHPCRODM\Boolean()
+ * @PHPCRODM\Field(type="boolean")
* @Type("integer")
* This boolean to integer conversion is one of the few changes between this
* and the standard BlogPost class. It's used to test the override behavior
diff --git a/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/Comment.php b/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/Comment.php
index 6d27fdac6..587d1717f 100644
--- a/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/Comment.php
+++ b/tests/JMS/Serializer/Tests/Fixtures/DoctrinePHPCR/Comment.php
@@ -39,7 +39,7 @@ class Comment
private $blogPost;
/**
- * @PHPCRODM\String()
+ * @PHPCRODM\Field(type="string")
*/
private $text;
diff --git a/tests/JMS/Serializer/Tests/Fixtures/GetSetObject.php b/tests/JMS/Serializer/Tests/Fixtures/GetSetObject.php
index c6a9722b0..a3e936f41 100644
--- a/tests/JMS/Serializer/Tests/Fixtures/GetSetObject.php
+++ b/tests/JMS/Serializer/Tests/Fixtures/GetSetObject.php
@@ -19,6 +19,7 @@
namespace JMS\Serializer\Tests\Fixtures;
use JMS\Serializer\Annotation\AccessType;
+use JMS\Serializer\Annotation\Exclude;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\ReadOnly;
@@ -36,6 +37,12 @@ class GetSetObject
*/
private $readOnlyProperty = 42;
+ /**
+ * This property should be exlcluded
+ * @Exclude()
+ */
+ private $excludedProperty;
+
public function getId()
{
throw new \RuntimeException('This should not be called.');
diff --git a/tests/JMS/Serializer/Tests/Fixtures/ObjectWithAbsentXmlListNode.php b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithAbsentXmlListNode.php
new file mode 100644
index 000000000..0e29f7012
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithAbsentXmlListNode.php
@@ -0,0 +1,41 @@
+
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace JMS\Serializer\Tests\Fixtures;
+
+use JMS\Serializer\Annotation as Serializer;
+
+class ObjectWithAbsentXmlListNode
+{
+ /**
+ * @Serializer\XmlList(inline=false, entry="comment", skipWhenEmpty=true)
+ * @Serializer\Type("array")
+ */
+ public $absent;
+ /**
+ * @Serializer\XmlList(inline=false, entry="comment", skipWhenEmpty=false)
+ * @Serializer\Type("array")
+ */
+ public $present;
+
+ /**
+ * @Serializer\XmlList(inline=false, entry="comment")
+ * @Serializer\Type("array")
+ */
+ public $skipDefault;
+}
diff --git a/tests/JMS/Serializer/Tests/Fixtures/ObjectWithEmptyNullableAndEmptyArrays.php b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithEmptyNullableAndEmptyArrays.php
new file mode 100644
index 000000000..962f5d83a
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithEmptyNullableAndEmptyArrays.php
@@ -0,0 +1,80 @@
+
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace JMS\Serializer\Tests\Fixtures;
+
+use JMS\Serializer\Annotation as Serializer;
+
+class ObjectWithEmptyNullableAndEmptyArrays
+{
+ /**
+ * @Serializer\XmlList(inline = true, entry = "comment")
+ * @Serializer\Type("array")
+ */
+ public $null_inline = null;
+
+ /**
+ * @Serializer\XmlList(inline = true, entry = "comment")
+ * @Serializer\Type("array")
+ */
+ public $empty_inline = [];
+
+
+ /**
+ * @Serializer\XmlList(inline = true, entry = "comment")
+ * @Serializer\Type("array")
+ */
+ public $not_empty_inline = ['not_empty_inline'];
+
+ /**
+ * @Serializer\XmlList(inline = false, entry = "comment")
+ * @Serializer\Type("array")
+ */
+ public $null_not_inline = null;
+
+ /**
+ * @Serializer\XmlList(inline = false, entry = "comment")
+ * @Serializer\Type("array")
+ */
+ public $empty_not_inline = [];
+
+ /**
+ * @Serializer\XmlList(inline = false, entry = "comment", skipWhenEmpty=false)
+ * @Serializer\Type("array")
+ */
+ public $not_empty_not_inline = ['not_empty_not_inline'];
+
+ /**
+ * @Serializer\XmlList(inline = false, entry = "comment", skipWhenEmpty=false)
+ * @Serializer\Type("array")
+ */
+ public $null_not_inline_skip = null;
+
+ /**
+ * @Serializer\XmlList(inline = false, entry = "comment", skipWhenEmpty=false)
+ * @Serializer\Type("array")
+ */
+ public $empty_not_inline_skip = [];
+
+
+ /**
+ * @Serializer\XmlList(inline = false, entry = "comment", skipWhenEmpty=false)
+ * @Serializer\Type("array")
+ */
+ public $not_empty_not_inline_skip = ['not_empty_not_inline_skip'];
+}
diff --git a/tests/JMS/Serializer/Tests/Fixtures/ObjectWithHandlerCallbacks.php b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithHandlerCallbacks.php
new file mode 100644
index 000000000..35c72b2d9
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithHandlerCallbacks.php
@@ -0,0 +1,46 @@
+
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace JMS\Serializer\Tests\Fixtures;
+
+use JMS\Serializer\Annotation\HandlerCallback;
+use JMS\Serializer\Annotation\Type;
+
+class ObjectWithHandlerCallbacks
+{
+ /**
+ * @Type("string")
+ */
+ public $name;
+
+ /**
+ * @HandlerCallback(direction="serialization", format="json")
+ */
+ public function toJson()
+ {
+ return $this->name;
+ }
+
+ /**
+ * @HandlerCallback(direction="serialization", format="xml")
+ */
+ public function toXml()
+ {
+ return $this->name;
+ }
+}
diff --git a/tests/JMS/Serializer/Tests/Fixtures/ObjectWithIntListAndIntMap.php b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithIntListAndIntMap.php
new file mode 100644
index 000000000..f5f1e8da8
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithIntListAndIntMap.php
@@ -0,0 +1,20 @@
+") @Serializer\XmlList */
+ private $list;
+
+ /** @Serializer\Type("array") @Serializer\XmlMap */
+ private $map;
+
+ public function __construct(array $list, array $map)
+ {
+ $this->list = $list;
+ $this->map = $map;
+ }
+}
\ No newline at end of file
diff --git a/tests/JMS/Serializer/Tests/Fixtures/ObjectWithNamespacesAndList.php b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithNamespacesAndList.php
new file mode 100644
index 000000000..edacae734
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithNamespacesAndList.php
@@ -0,0 +1,103 @@
+
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace JMS\Serializer\Tests\Fixtures;
+
+use JMS\Serializer\Annotation\SerializedName;
+use JMS\Serializer\Annotation\Type;
+use JMS\Serializer\Annotation\XmlRoot;
+use JMS\Serializer\Annotation\XmlNamespace;
+use JMS\Serializer\Annotation\XmlElement;
+use JMS\Serializer\Annotation\XmlList;
+use JMS\Serializer\Annotation\XmlMap;
+/**
+ * @XmlRoot("ObjectWithNamespacesAndList", namespace="http://example.com/namespace")
+ * @XmlNamespace(uri="http://example.com/namespace")
+ * @XmlNamespace(uri="http://example.com/namespace2", prefix="x")
+ */
+class ObjectWithNamespacesAndList
+{
+ /**
+ * @Type("string")
+ * @SerializedName("name")
+ * @XmlElement(namespace="http://example.com/namespace")
+ */
+ public $name;
+ /**
+ * @Type("string")
+ * @SerializedName("name")
+ * @XmlElement(namespace="http://example.com/namespace2")
+ */
+ public $nameAlternativeB;
+
+ /**
+ * @Type("array")
+ * @SerializedName("phones")
+ * @XmlElement(namespace="http://example.com/namespace2")
+ * @XmlList(inline = false, entry = "phone", namespace="http://example.com/namespace2")
+ */
+ public $phones;
+ /**
+ * @Type("array")
+ * @SerializedName("addresses")
+ * @XmlElement(namespace="http://example.com/namespace2")
+ * @XmlMap(inline = false, entry = "address", keyAttribute = "id", namespace="http://example.com/namespace2")
+ */
+ public $addresses;
+
+ /**
+ * @Type("array")
+ * @SerializedName("phones")
+ * @XmlList(inline = true, entry = "phone", namespace="http://example.com/namespace")
+ */
+ public $phonesAlternativeB;
+ /**
+ * @Type("array")
+ * @SerializedName("addresses")
+ * @XmlMap(inline = true, entry = "address", keyAttribute = "id", namespace="http://example.com/namespace")
+ */
+ public $addressesAlternativeB;
+
+ /**
+ * @Type("array")
+ * @SerializedName("phones")
+ * @XmlList(inline = true, entry = "phone", namespace="http://example.com/namespace2")
+ */
+ public $phonesAlternativeC;
+ /**
+ * @Type("array")
+ * @SerializedName("addresses")
+ * @XmlMap(inline = true, entry = "address", keyAttribute = "id", namespace="http://example.com/namespace2")
+ */
+ public $addressesAlternativeC;
+
+ /**
+ * @Type("array")
+ * @SerializedName("phones")
+ * @XmlList(inline = false, entry = "phone")
+ */
+ public $phonesAlternativeD;
+ /**
+ * @Type("array")
+ * @SerializedName("addresses")
+ * @XmlMap(inline = false, entry = "address", keyAttribute = "id")
+ */
+ public $addressesAlternativeD;
+
+}
+
diff --git a/tests/JMS/Serializer/Tests/Fixtures/ObjectWithObjectProperty.php b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithObjectProperty.php
new file mode 100644
index 000000000..97c910178
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Fixtures/ObjectWithObjectProperty.php
@@ -0,0 +1,53 @@
+
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace JMS\Serializer\Tests\Fixtures;
+
+use JMS\Serializer\Annotation\Type;
+
+
+class ObjectWithObjectProperty
+{
+ /**
+ * @Type("string")
+ */
+ private $foo;
+
+ /**
+ * @Type("JMS\Serializer\Tests\Fixtures\Author")
+ */
+ private $author;
+
+ /**
+ * @return string
+ */
+ public function getFoo()
+ {
+ return $this->foo;
+ }
+
+ /**
+ * @return \JMS\Serializer\Tests\Fixtures\Author
+ */
+ public function getAuthor()
+ {
+ return $this->author;
+ }
+
+
+}
diff --git a/tests/JMS/Serializer/Tests/Fixtures/SimpleObjectProxy.php b/tests/JMS/Serializer/Tests/Fixtures/SimpleObjectProxy.php
index b08b9ffc9..74b85317c 100644
--- a/tests/JMS/Serializer/Tests/Fixtures/SimpleObjectProxy.php
+++ b/tests/JMS/Serializer/Tests/Fixtures/SimpleObjectProxy.php
@@ -18,7 +18,7 @@
namespace JMS\Serializer\Tests\Fixtures;
-use Doctrine\ORM\Proxy\Proxy;
+use Doctrine\Common\Persistence\Proxy;
class SimpleObjectProxy extends SimpleObject implements Proxy
{
diff --git a/tests/JMS/Serializer/Tests/Fixtures/Tag.php b/tests/JMS/Serializer/Tests/Fixtures/Tag.php
new file mode 100644
index 000000000..36ba0a4ef
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Fixtures/Tag.php
@@ -0,0 +1,42 @@
+
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace JMS\Serializer\Tests\Fixtures;
+
+use JMS\Serializer\Annotation as JMS;
+
+
+/**
+ * @JMS\XmlRoot("tag")
+ * @JMS\XmlNamespace(uri="http://purl.org/dc/elements/1.1/", prefix="dc")
+ */
+class Tag {
+
+ /**
+ * @JMS\XmlElement(cdata=false)
+ * @JMS\Type("string")
+ */
+ public $name;
+
+ function __construct($name)
+ {
+ $this->name = $name;
+ }
+
+
+}
\ No newline at end of file
diff --git a/tests/JMS/Serializer/Tests/Fixtures/Timestamp.php b/tests/JMS/Serializer/Tests/Fixtures/Timestamp.php
new file mode 100755
index 000000000..fbc3a9faf
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Fixtures/Timestamp.php
@@ -0,0 +1,39 @@
+
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace JMS\Serializer\Tests\Fixtures;
+
+use JMS\Serializer\Annotation\Type;
+
+class Timestamp
+{
+ /**
+ * @Type("DateTime<'U'>")
+ */
+ private $timestamp;
+
+ public function __construct($timestamp)
+ {
+ $this->timestamp = $timestamp;
+ }
+
+ public function getTimestamp()
+ {
+ return $this->timestamp;
+ }
+}
diff --git a/tests/JMS/Serializer/Tests/Handler/FormErrorHandlerTest.php b/tests/JMS/Serializer/Tests/Handler/FormErrorHandlerTest.php
new file mode 100644
index 000000000..bd384bc76
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Handler/FormErrorHandlerTest.php
@@ -0,0 +1,110 @@
+handler = new FormErrorHandler(new Translator('en'));
+ $this->visitor = new JsonSerializationVisitor(new SerializedNameAnnotationStrategy(new CamelCaseNamingStrategy()));
+ $this->dispatcher = new EventDispatcher();
+ $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
+ }
+
+ protected function tearDown()
+ {
+ $this->handler = null;
+ $this->visitor = null;
+ $this->dispatcher = null;
+ $this->factory = null;
+ }
+
+ public function testSerializeEmptyFormError()
+ {
+ $form = $this->createForm();
+ $json = json_encode($this->handler->serializeFormToJson($this->visitor, $form, array()));
+
+ $this->assertSame('{}', $json);
+ }
+
+ public function testSerializeHasFormError()
+ {
+ $form = $this->createForm();
+ $form->addError(new FormError('error!'));
+ $json = json_encode($this->handler->serializeFormToJson($this->visitor, $form, array()));
+
+ $this->assertSame(json_encode(array(
+ 'errors' => array(
+ 'error!',
+ ),
+ )), $json);
+ }
+
+ /**
+ * @param string $name
+ * @param EventDispatcherInterface $dispatcher
+ * @param string $dataClass
+ *
+ * @return FormBuilder
+ */
+ protected function getBuilder($name = 'name', EventDispatcherInterface $dispatcher = null, $dataClass = null)
+ {
+ return new FormBuilder($name, $dataClass, $dispatcher ?: $this->dispatcher, $this->factory);
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return \PHPUnit_Framework_MockObject_MockObject
+ */
+ protected function getMockForm($name = 'name')
+ {
+ $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
+ $config = $this->getMock('Symfony\Component\Form\FormConfigInterface');
+
+ $form->expects($this->any())
+ ->method('getName')
+ ->will($this->returnValue($name));
+ $form->expects($this->any())
+ ->method('getConfig')
+ ->will($this->returnValue($config));
+
+ return $form;
+ }
+
+ protected function createForm()
+ {
+ return $this->getBuilder()->getForm();
+ }
+}
diff --git a/tests/JMS/Serializer/Tests/Metadata/ClassMetadataTest.php b/tests/JMS/Serializer/Tests/Metadata/ClassMetadataTest.php
index 49cded5d2..150812ee0 100644
--- a/tests/JMS/Serializer/Tests/Metadata/ClassMetadataTest.php
+++ b/tests/JMS/Serializer/Tests/Metadata/ClassMetadataTest.php
@@ -23,30 +23,47 @@
class ClassMetadataTest extends \PHPUnit_Framework_TestCase
{
- public function testSetAccessorOrder()
+ public function getAccessOrderCases()
+ {
+ return [
+ [array('b', 'a'), array('b', 'a')],
+ [array('a', 'b'), array('a', 'b')],
+ [array('b'), array('b', 'a')],
+ [array('a'), array('a', 'b')],
+ [array('foo', 'bar'), array('b', 'a')],
+ ];
+ }
+
+ public function testSerialization()
+ {
+ $meta = new PropertyMetadata('JMS\Serializer\Tests\Metadata\PropertyMetadataOrder', 'b');
+ $restoredMeta = unserialize(serialize($meta));
+ $this->assertEquals($meta, $restoredMeta);
+ }
+
+ /**
+ * @dataProvider getAccessOrderCases
+ */
+ public function testSetAccessorOrderCustom(array $order, array $expected)
{
$metadata = new ClassMetadata('JMS\Serializer\Tests\Metadata\PropertyMetadataOrder');
$metadata->addPropertyMetadata(new PropertyMetadata('JMS\Serializer\Tests\Metadata\PropertyMetadataOrder', 'b'));
$metadata->addPropertyMetadata(new PropertyMetadata('JMS\Serializer\Tests\Metadata\PropertyMetadataOrder', 'a'));
$this->assertEquals(array('b', 'a'), array_keys($metadata->propertyMetadata));
- $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_ALPHABETICAL);
- $this->assertEquals(array('a', 'b'), array_keys($metadata->propertyMetadata));
-
- $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_CUSTOM, array('b', 'a'));
- $this->assertEquals(array('b', 'a'), array_keys($metadata->propertyMetadata));
-
- $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_CUSTOM, array('a', 'b'));
- $this->assertEquals(array('a', 'b'), array_keys($metadata->propertyMetadata));
+ $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_CUSTOM, $order);
+ $this->assertEquals($expected, array_keys($metadata->propertyMetadata));
+ }
- $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_CUSTOM, array('b'));
+ public function testSetAccessorOrderAlphabetical()
+ {
+ $metadata = new ClassMetadata('JMS\Serializer\Tests\Metadata\PropertyMetadataOrder');
+ $metadata->addPropertyMetadata(new PropertyMetadata('JMS\Serializer\Tests\Metadata\PropertyMetadataOrder', 'b'));
+ $metadata->addPropertyMetadata(new PropertyMetadata('JMS\Serializer\Tests\Metadata\PropertyMetadataOrder', 'a'));
$this->assertEquals(array('b', 'a'), array_keys($metadata->propertyMetadata));
- $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_CUSTOM, array('a'));
+ $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_ALPHABETICAL);
$this->assertEquals(array('a', 'b'), array_keys($metadata->propertyMetadata));
-
- $metadata->setAccessorOrder(ClassMetadata::ACCESSOR_ORDER_CUSTOM, array('foo', 'bar'));
- $this->assertEquals(array('b', 'a'), array_keys($metadata->propertyMetadata));
}
/**
@@ -62,8 +79,7 @@ public function testAccessorTypePublicMethod($property, $getterInit, $setterInit
$this->assertEquals($getterName, $metadata->getter);
$this->assertEquals($setterName, $metadata->setter);
- // setter is not supported by setValue(), any idea?
- $object->{$metadata->setter}('x');
+ $metadata->setValue($object, 'x');
$this->assertEquals(sprintf('%1$s:%1$s:x', strtoupper($property)), $metadata->getValue($object));
}
diff --git a/tests/JMS/Serializer/Tests/Metadata/Driver/BaseDriverTest.php b/tests/JMS/Serializer/Tests/Metadata/Driver/BaseDriverTest.php
index 487768bb5..df105bd04 100644
--- a/tests/JMS/Serializer/Tests/Metadata/Driver/BaseDriverTest.php
+++ b/tests/JMS/Serializer/Tests/Metadata/Driver/BaseDriverTest.php
@@ -18,6 +18,7 @@
namespace JMS\Serializer\Tests\Metadata\Driver;
+use JMS\Serializer\GraphNavigator;
use JMS\Serializer\Metadata\ClassMetadata;
use JMS\Serializer\Metadata\PropertyMetadata;
use JMS\Serializer\Metadata\VirtualPropertyMetadata;
@@ -95,6 +96,19 @@ public function testLoadBlogPostMetadata()
$this->assertEquals($p, $m->propertyMetadata['price']);
}
+ public function testXMLListAbsentNode()
+ {
+ $m = $this->getDriver()->loadMetadataForClass(new \ReflectionClass('JMS\Serializer\Tests\Fixtures\ObjectWithAbsentXmlListNode'));
+
+ $this->assertArrayHasKey('absent', $m->propertyMetadata);
+ $this->assertArrayHasKey('present', $m->propertyMetadata);
+ $this->assertArrayHasKey('skipDefault', $m->propertyMetadata);
+
+ $this->assertTrue($m->propertyMetadata['absent']->xmlCollectionSkipWhenEmpty);
+ $this->assertTrue($m->propertyMetadata['skipDefault']->xmlCollectionSkipWhenEmpty);
+ $this->assertFalse($m->propertyMetadata['present']->xmlCollectionSkipWhenEmpty);
+ }
+
public function testVirtualProperty()
{
$m = $this->getDriver()->loadMetadataForClass(new \ReflectionClass('JMS\Serializer\Tests\Fixtures\ObjectWithVirtualProperties'));
@@ -297,30 +311,58 @@ public function testXmlNamespaceInheritanceMetadata()
$p->xmlNamespace = "http://old.foo.example.org";
$p->xmlAttribute = true;
$p->class = 'JMS\Serializer\Tests\Fixtures\SimpleClassObject';
- $this->assertEquals($p, $m->propertyMetadata['foo']);
+ $this->assetMetadataEquals($p, $m->propertyMetadata['foo']);
$p = new PropertyMetadata($m->name, 'bar');
$p->type = array('name' => 'string', 'params' => array());
$p->xmlNamespace = "http://foo.example.org";
$p->class = 'JMS\Serializer\Tests\Fixtures\SimpleClassObject';
- $this->assertEquals($p, $m->propertyMetadata['bar']);
+ $this->assetMetadataEquals($p, $m->propertyMetadata['bar']);
$p = new PropertyMetadata($m->name, 'moo');
$p->type = array('name' => 'string', 'params' => array());
$p->xmlNamespace = "http://better.foo.example.org";
- $this->assertEquals($p, $m->propertyMetadata['moo']);
+ $this->assetMetadataEquals($p, $m->propertyMetadata['moo']);
$p = new PropertyMetadata($m->name, 'baz');
$p->type = array('name' => 'string', 'params' => array());
$p->xmlNamespace = "http://foo.example.org";
- $this->assertEquals($p, $m->propertyMetadata['baz']);
+ $this->assetMetadataEquals($p, $m->propertyMetadata['baz']);
$p = new PropertyMetadata($m->name, 'qux');
$p->type = array('name' => 'string', 'params' => array());
$p->xmlNamespace = "http://new.foo.example.org";
- $this->assertEquals($p, $m->propertyMetadata['qux']);
+ $this->assetMetadataEquals($p, $m->propertyMetadata['qux']);
+ }
+
+ private function assetMetadataEquals(PropertyMetadata $expected, PropertyMetadata $actual)
+ {
+ $expectedVars = get_object_vars($expected);
+ $actualVars = get_object_vars($actual);
+
+ $expectedReflection = (array)$expectedVars['reflection'];
+ $actualReflection = (array)$actualVars['reflection'];
+
+ // HHVM bug with class property
+ unset($expectedVars['reflection'], $actualVars['reflection']);
+ $this->assertEquals($expectedVars, $actualVars);
+
+ // HHVM bug with class property
+ if (isset($expectedReflection['info']) || isset($actualReflection['info'])){
+ $expectedReflection['class'] = $expectedReflection['info']['class'];
+ $actualReflection['class'] = $actualReflection['info']['class'];
+ }
+
+ $this->assertEquals($expectedReflection, $actualReflection);
}
+ public function testHandlerCallbacks()
+ {
+ $m = $this->getDriver()->loadMetadataForClass(new \ReflectionClass('JMS\Serializer\Tests\Fixtures\ObjectWithHandlerCallbacks'));
+
+ $this->assertEquals('toJson', $m->handlerCallbacks[GraphNavigator::DIRECTION_SERIALIZATION]['json']);
+ $this->assertEquals('toXml', $m->handlerCallbacks[GraphNavigator::DIRECTION_SERIALIZATION]['xml']);
+ }
/**
* @return DriverInterface
diff --git a/tests/JMS/Serializer/Tests/Metadata/Driver/php/ObjectWithAbsentXmlListNode.php b/tests/JMS/Serializer/Tests/Metadata/Driver/php/ObjectWithAbsentXmlListNode.php
new file mode 100644
index 000000000..3599ac3f4
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Metadata/Driver/php/ObjectWithAbsentXmlListNode.php
@@ -0,0 +1,23 @@
+xmlCollectionSkipWhenEmpty = true;
+$metadata->addPropertyMetadata($pMetadata);
+
+$pMetadata = new PropertyMetadata($className, 'present');
+$pMetadata->xmlCollectionSkipWhenEmpty = false;
+$metadata->addPropertyMetadata($pMetadata);
+
+$pMetadata = new PropertyMetadata($className, 'skipDefault');
+$metadata->addPropertyMetadata($pMetadata);
+
+
+return $metadata;
diff --git a/tests/JMS/Serializer/Tests/Metadata/Driver/php/ObjectWithHandlerCallbacks.php b/tests/JMS/Serializer/Tests/Metadata/Driver/php/ObjectWithHandlerCallbacks.php
new file mode 100644
index 000000000..5edaa0c67
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Metadata/Driver/php/ObjectWithHandlerCallbacks.php
@@ -0,0 +1,16 @@
+type = 'string';
+$metadata->addPropertyMetadata($pMetadata);
+
+$metadata->addHandlerCallback(GraphNavigator::DIRECTION_SERIALIZATION, 'json', 'toJson');
+$metadata->addHandlerCallback(GraphNavigator::DIRECTION_SERIALIZATION, 'xml', 'toXml');
+
+return $metadata;
diff --git a/tests/JMS/Serializer/Tests/Metadata/Driver/xml/ObjectWithAbsentXmlListNode.xml b/tests/JMS/Serializer/Tests/Metadata/Driver/xml/ObjectWithAbsentXmlListNode.xml
new file mode 100644
index 000000000..5ebeb9aec
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Metadata/Driver/xml/ObjectWithAbsentXmlListNode.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ array
+
+
+
+ array
+
+
+
+ array
+
+
+
diff --git a/tests/JMS/Serializer/Tests/Metadata/Driver/xml/ObjectWithHandlerCallbacks.xml b/tests/JMS/Serializer/Tests/Metadata/Driver/xml/ObjectWithHandlerCallbacks.xml
new file mode 100644
index 000000000..14202907c
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Metadata/Driver/xml/ObjectWithHandlerCallbacks.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/tests/JMS/Serializer/Tests/Metadata/Driver/yml/ObjectWithAbsentXmlListNode.yml b/tests/JMS/Serializer/Tests/Metadata/Driver/yml/ObjectWithAbsentXmlListNode.yml
new file mode 100644
index 000000000..fd4d8e6af
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Metadata/Driver/yml/ObjectWithAbsentXmlListNode.yml
@@ -0,0 +1,14 @@
+JMS\Serializer\Tests\Fixtures\ObjectWithAbsentXmlListNode:
+ properties:
+ absent:
+ type: array
+ xml_list:
+ skip_when_empty: true
+ present:
+ type: array
+ xml_list:
+ skip_when_empty: false
+ skipDefault:
+ type: array
+ xml_list:
+ inline: false
diff --git a/tests/JMS/Serializer/Tests/Metadata/Driver/yml/ObjectWithHandlerCallbacks.yml b/tests/JMS/Serializer/Tests/Metadata/Driver/yml/ObjectWithHandlerCallbacks.yml
new file mode 100644
index 000000000..6c5ad76e9
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Metadata/Driver/yml/ObjectWithHandlerCallbacks.yml
@@ -0,0 +1,8 @@
+JMS\Serializer\Tests\Fixtures\ObjectWithHandlerCallbacks:
+ properties:
+ name:
+ type: string
+ handler_callbacks:
+ serialization:
+ xml: toXml
+ json: toJson
diff --git a/tests/JMS/Serializer/Tests/Serializer/BaseSerializationTest.php b/tests/JMS/Serializer/Tests/Serializer/BaseSerializationTest.php
index 1e0d4f6a4..4dfc0995e 100644
--- a/tests/JMS/Serializer/Tests/Serializer/BaseSerializationTest.php
+++ b/tests/JMS/Serializer/Tests/Serializer/BaseSerializationTest.php
@@ -29,6 +29,10 @@
use JMS\Serializer\Tests\Fixtures\Garage;
use JMS\Serializer\Tests\Fixtures\InlineChildEmpty;
use JMS\Serializer\Tests\Fixtures\NamedDateTimeArraysObject;
+use JMS\Serializer\Tests\Fixtures\ObjectWithEmptyNullableAndEmptyArrays;
+use JMS\Serializer\Tests\Fixtures\ObjectWithIntListAndIntMap;
+use JMS\Serializer\Tests\Fixtures\Tag;
+use JMS\Serializer\Tests\Fixtures\Timestamp;
use JMS\Serializer\Tests\Fixtures\Tree;
use JMS\Serializer\Tests\Fixtures\VehicleInterfaceGarage;
use PhpCollection\Sequence;
@@ -90,6 +94,7 @@
use Metadata\MetadataFactory;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormError;
+use Symfony\Component\Validator\Constraints\Time;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use PhpCollection\Map;
@@ -100,6 +105,10 @@
abstract class BaseSerializationTest extends \PHPUnit_Framework_TestCase
{
protected $factory;
+
+ /**
+ * @var EventDispatcher
+ */
protected $dispatcher;
/** @var Serializer */
@@ -240,6 +249,20 @@ public function testArrayIntegers()
}
}
+ public function testArrayEmpty()
+ {
+ if ('xml' === $this->getFormat()) {
+ $this->markTestSkipped('XML can\'t be tested for empty array');
+ }
+
+ $data = array('array' => []);
+ $this->assertEquals($this->getContent('array_empty'), $this->serialize($data));
+
+ if ($this->hasDeserializer()) {
+ $this->assertEquals($data, $this->deserialize($this->getContent('array_empty'), 'array'));
+ }
+ }
+
public function testArrayFloats()
{
$data = array(1.34, 3.0, 6.42);
@@ -260,6 +283,13 @@ public function testArrayObjects()
}
}
+ public function testArrayListAndMapDifference()
+ {
+ $arrayData = array(0 => 1, 2 => 2, 3 => 3); // Misses key 1
+ $data = new ObjectWithIntListAndIntMap($arrayData, $arrayData);
+
+ $this->assertEquals($this->getContent('array_list_and_map_difference'), $this->serialize($data));
+ }
public function testDateTimeArrays()
{
@@ -351,6 +381,22 @@ public function getDateTime()
);
}
+ public function testTimestamp()
+ {
+ $value = new Timestamp(new \DateTime('2016-02-11 00:00:00', new \DateTimeZone('UTC')));
+ $this->assertEquals($this->getContent('timestamp'), $this->serialize($value));
+
+ if ($this->hasDeserializer()) {
+ $deserialized = $this->deserialize($this->getContent('timestamp'), Timestamp::class);
+ $this->assertEquals($value, $deserialized);
+ $this->assertEquals($value->getTimestamp()->getTimestamp(), $deserialized->getTimestamp()->getTimestamp());
+
+ $deserialized = $this->deserialize($this->getContent('timestamp_prev'), Timestamp::class);
+ $this->assertEquals($value, $deserialized);
+ $this->assertEquals($value->getTimestamp()->getTimestamp(), $deserialized->getTimestamp()->getTimestamp());
+ }
+ }
+
public function testDateInterval()
{
$duration = new \DateInterval('PT45M');
@@ -363,6 +409,9 @@ public function testBlogPost()
$post = new BlogPost('This is a nice title.', $author = new Author('Foo Bar'), new \DateTime('2011-07-30 00:00', new \DateTimeZone('UTC')), new Publisher('Bar Foo'));
$post->addComment($comment = new Comment($author, 'foo'));
+ $post->addTag($tag1 = New Tag("tag1"));
+ $post->addTag($tag2 = New Tag("tag2"));
+
$this->assertEquals($this->getContent('blog_post'), $this->serialize($post));
if ($this->hasDeserializer()) {
@@ -374,6 +423,7 @@ public function testBlogPost()
$this->assertAttributeEquals(new ArrayCollection(array($comment)), 'comments', $deserialized);
$this->assertAttributeEquals(new Sequence(array($comment)), 'comments2', $deserialized);
$this->assertAttributeEquals($author, 'author', $deserialized);
+ $this->assertAttributeEquals(array($tag1, $tag2), 'tag', $deserialized);
}
}
@@ -613,7 +663,7 @@ public function testFormErrorsWithNonFormComponents()
public function testConstraintViolation()
{
- $violation = new ConstraintViolation('Message of violation', array(), null, 'foo', null);
+ $violation = new ConstraintViolation('Message of violation', 'Message of violation', array(), null, 'foo', null);
$this->assertEquals($this->getContent('constraint_violation'), $this->serialize($violation));
}
@@ -621,8 +671,8 @@ public function testConstraintViolation()
public function testConstraintViolationList()
{
$violations = new ConstraintViolationList();
- $violations->add(new ConstraintViolation('Message of violation', array(), null, 'foo', null));
- $violations->add(new ConstraintViolation('Message of another violation', array(), null, 'bar', null));
+ $violations->add(new ConstraintViolation('Message of violation', 'Message of violation', array(), null, 'foo', null));
+ $violations->add(new ConstraintViolation('Message of another violation', 'Message of another violation', array(), null, 'bar', null));
$this->assertEquals($this->getContent('constraint_violation_list'), $this->serialize($violations));
}
@@ -932,6 +982,12 @@ public function testDeserializingIntoExistingObject()
$this->assertAttributeInstanceOf('JMS\Serializer\Tests\Fixtures\Price', 'cost', $deseralizedOrder);
}
+ public function testObjectWithNullableArrays()
+ {
+ $object = new ObjectWithEmptyNullableAndEmptyArrays();
+ $this->assertEquals($this->getContent('nullable_arrays'), $this->serializer->serialize($object, $this->getFormat()));
+ }
+
abstract protected function getContent($key);
abstract protected function getFormat();
diff --git a/tests/JMS/Serializer/Tests/Serializer/ContextTest.php b/tests/JMS/Serializer/Tests/Serializer/ContextTest.php
index 5bbeda5d9..117d406cf 100644
--- a/tests/JMS/Serializer/Tests/Serializer/ContextTest.php
+++ b/tests/JMS/Serializer/Tests/Serializer/ContextTest.php
@@ -147,4 +147,44 @@ public function testSerializationMetadataStack()
$serializer = SerializerBuilder::create()->build();
$serializer->serialize($object, 'json', SerializationContext::create()->addExclusionStrategy($exclusionStrategy));
}
+
+ public function getScalars()
+ {
+ return array(
+ array("string"),
+ array(5),
+ array(5.5),
+ array(array())
+ );
+ }
+
+ /**
+ * @dataProvider getScalars
+ */
+ public function testCanVisitScalars($scalar)
+ {
+ $context = SerializationContext::create();
+
+ $context->startVisiting($scalar);
+ $this->assertFalse($context->isVisiting($scalar));
+ $context->stopVisiting($scalar);
+ }
+
+ public function testSerializeNullOption()
+ {
+ $context = SerializationContext::create();
+ $this->assertNull($context->shouldSerializeNull());
+
+ $context->setSerializeNull(false);
+ $this->assertFalse($context->shouldSerializeNull());
+
+ $context->setSerializeNull(true);
+ $this->assertTrue($context->shouldSerializeNull());
+
+ $context->setSerializeNull("foo");
+ $this->assertTrue($context->shouldSerializeNull());
+
+ $context->setSerializeNull("0");
+ $this->assertFalse($context->shouldSerializeNull());
+ }
}
diff --git a/tests/JMS/Serializer/Tests/Serializer/EventDispatcher/Subscriber/SymfonyValidatorSubscriberTest.php b/tests/JMS/Serializer/Tests/Serializer/EventDispatcher/Subscriber/SymfonyValidatorSubscriberTest.php
index 7081c064e..c7b12ec82 100644
--- a/tests/JMS/Serializer/Tests/Serializer/EventDispatcher/Subscriber/SymfonyValidatorSubscriberTest.php
+++ b/tests/JMS/Serializer/Tests/Serializer/EventDispatcher/Subscriber/SymfonyValidatorSubscriberTest.php
@@ -63,7 +63,7 @@ public function testValidateThrowsExceptionWhenListIsNotEmpty()
$this->validator->expects($this->once())
->method('validate')
->with($obj, array('foo'))
- ->will($this->returnValue(new ConstraintViolationList(array(new ConstraintViolation('foo', array(), 'a', 'b', 'c')))));
+ ->will($this->returnValue(new ConstraintViolationList(array(new ConstraintViolation('foo', 'foo', array(), 'a', 'b', 'c')))));
$context = DeserializationContext::create()->setAttribute('validation_groups', array('foo'));
diff --git a/tests/JMS/Serializer/Tests/Serializer/JsonSerializationTest.php b/tests/JMS/Serializer/Tests/Serializer/JsonSerializationTest.php
index 0e82824db..10ddbb2ef 100644
--- a/tests/JMS/Serializer/Tests/Serializer/JsonSerializationTest.php
+++ b/tests/JMS/Serializer/Tests/Serializer/JsonSerializationTest.php
@@ -46,13 +46,15 @@ protected function getContent($key)
$outputs['array_strings'] = '["foo","bar"]';
$outputs['array_booleans'] = '[true,false]';
$outputs['array_integers'] = '[1,3,4]';
+ $outputs['array_empty'] = '{"array":[]}';
$outputs['array_floats'] = '[1.34,3,6.42]';
$outputs['array_objects'] = '[{"foo":"foo","moo":"bar","camel_case":"boo"},{"foo":"baz","moo":"boo","camel_case":"boo"}]';
+ $outputs['array_list_and_map_difference'] = '{"list":[1,2,3],"map":{"0":1,"2":2,"3":3}}';
$outputs['array_mixed'] = '["foo",1,true,{"foo":"foo","moo":"bar","camel_case":"boo"},[1,3,true]]';
$outputs['array_datetimes_object'] = '{"array_with_default_date_time":["2047-01-01T12:47:47+0000","2013-12-05T00:00:00+0000"],"array_with_formatted_date_time":["01.01.2047 12:47:47","05.12.2013 00:00:00"]}';
$outputs['array_named_datetimes_object'] = '{"named_array_with_formatted_date":{"testdate1":"01.01.2047 12:47:47","testdate2":"05.12.2013 00:00:00"}}';
- $outputs['blog_post'] = '{"id":"what_a_nice_id","title":"This is a nice title.","created_at":"2011-07-30T00:00:00+0000","is_published":false,"etag":"1edf9bf60a32d89afbb85b2be849e3ceed5f5b10","comments":[{"author":{"full_name":"Foo Bar"},"text":"foo"}],"comments2":[{"author":{"full_name":"Foo Bar"},"text":"foo"}],"metadata":{"foo":"bar"},"author":{"full_name":"Foo Bar"},"publisher":{"pub_name":"Bar Foo"}}';
- $outputs['blog_post_unauthored'] = '{"id":"what_a_nice_id","title":"This is a nice title.","created_at":"2011-07-30T00:00:00+0000","is_published":false,"etag":"1edf9bf60a32d89afbb85b2be849e3ceed5f5b10","comments":[],"comments2":[],"metadata":{"foo":"bar"},"author":null,"publisher":null}';
+ $outputs['blog_post'] = '{"id":"what_a_nice_id","title":"This is a nice title.","created_at":"2011-07-30T00:00:00+0000","is_published":false,"etag":"1edf9bf60a32d89afbb85b2be849e3ceed5f5b10","comments":[{"author":{"full_name":"Foo Bar"},"text":"foo"}],"comments2":[{"author":{"full_name":"Foo Bar"},"text":"foo"}],"metadata":{"foo":"bar"},"author":{"full_name":"Foo Bar"},"publisher":{"pub_name":"Bar Foo"},"tag":[{"name":"tag1"},{"name":"tag2"}]}';
+ $outputs['blog_post_unauthored'] = '{"id":"what_a_nice_id","title":"This is a nice title.","created_at":"2011-07-30T00:00:00+0000","is_published":false,"etag":"1edf9bf60a32d89afbb85b2be849e3ceed5f5b10","comments":[],"comments2":[],"metadata":{"foo":"bar"},"author":null,"publisher":null,"tag":null}';
$outputs['price'] = '{"price":3}';
$outputs['currency_aware_price'] = '{"currency":"EUR","amount":2.34}';
$outputs['order'] = '{"cost":{"price":12.34}}';
@@ -76,7 +78,7 @@ protected function getContent($key)
$outputs['groups_foo'] = '{"foo":"foo","foobar":"foobar"}';
$outputs['groups_foobar'] = '{"foo":"foo","foobar":"foobar","bar":"bar"}';
$outputs['groups_default'] = '{"bar":"bar","none":"none"}';
- $outputs['virtual_properties'] = '{"exist_field":"value","test":"other-name","virtual_value":"value","typed_virtual_property":1}';
+ $outputs['virtual_properties'] = '{"exist_field":"value","virtual_value":"value","test":"other-name","typed_virtual_property":1}';
$outputs['virtual_properties_low'] = '{"low":1}';
$outputs['virtual_properties_high'] = '{"high":8}';
$outputs['virtual_properties_all'] = '{"low":1,"high":8}';
@@ -88,11 +90,16 @@ protected function getContent($key)
$outputs['object_when_null'] = '{"text":"foo"}';
$outputs['object_when_null_and_serialized'] = '{"author":null,"text":"foo"}';
$outputs['date_time'] = '"2011-08-30T00:00:00+0000"';
+ $outputs['timestamp'] = '{"timestamp":1455148800}';
+ $outputs['timestamp_prev'] = '{"timestamp":"1455148800"}';
$outputs['date_interval'] = '"PT45M"';
$outputs['car'] = '{"km":5,"type":"car"}';
$outputs['car_without_type'] = '{"km":5}';
$outputs['garage'] = '{"vehicles":[{"km":3,"type":"car"},{"km":1,"type":"moped"}]}';
$outputs['tree'] = '{"tree":{"children":[{"children":[{"children":[],"foo":"bar"}],"foo":"bar"}],"foo":"bar"}}';
+ $outputs['nullable_arrays'] = '{"empty_inline":[],"not_empty_inline":["not_empty_inline"],"empty_not_inline":[],"not_empty_not_inline":["not_empty_not_inline"],"empty_not_inline_skip":[],"not_empty_not_inline_skip":["not_empty_not_inline_skip"]}';
+ $outputs['object_with_object_property_no_array_to_author'] = '{"foo": "bar", "author": "baz"}';
+ $outputs['object_with_object_property'] = '{"foo": "bar", "author": {"full_name": "baz"}}';
}
if (!isset($outputs[$key])) {
@@ -104,7 +111,16 @@ protected function getContent($key)
public function testAddLinksToOutput()
{
+ $this->dispatcher->addListener('serializer.post_serialize', function (Event $event) {
+ $this->assertFalse($event->getVisitor()->hasData('_links'));
+ }, 'JMS\Serializer\Tests\Fixtures\Author', 'json');
+
$this->dispatcher->addSubscriber(new LinkAddingSubscriber());
+
+ $this->dispatcher->addListener('serializer.post_serialize', function (Event $event) {
+ $this->assertTrue($event->getVisitor()->hasData('_links'));
+ }, 'JMS\Serializer\Tests\Fixtures\Author', 'json');
+
$this->handlerRegistry->registerHandler(GraphNavigator::DIRECTION_SERIALIZATION, 'JMS\Serializer\Tests\Fixtures\AuthorList', 'json',
function(VisitorInterface $visitor, AuthorList $data, array $type, Context $context) {
return $visitor->visitArray(iterator_to_array($data), $type, $context);
@@ -134,6 +150,27 @@ function(VisitorInterface $visitor, AuthorList $data, array $type, Context $cont
$this->assertEquals('[{"full_name":"new name"},{"full_name":"new name"}]', $this->serialize($list));
}
+ /**
+ * @expectedException RuntimeException
+ * @expectedExceptionMessage Invalid data "baz"(string), expected "JMS\Serializer\Tests\Fixtures\Author".
+ */
+ public function testDeserializingObjectWithObjectPropertyWithNoArrayToObject()
+ {
+ $content = $this->getContent('object_with_object_property_no_array_to_author');
+ $object = $this->deserialize($content, 'JMS\Serializer\Tests\Fixtures\ObjectWithObjectProperty');
+ $this->assertEquals('bar', $object->getFoo());
+ $this->assertInstanceOf('JMS\Serializer\Tests\Fixtures\Author', $object->getAuthor());
+ }
+
+ public function testDeserializingObjectWithObjectProperty()
+ {
+ $content = $this->getContent('object_with_object_property');
+ $object = $this->deserialize($content, 'JMS\Serializer\Tests\Fixtures\ObjectWithObjectProperty');
+ $this->assertEquals('bar', $object->getFoo());
+ $this->assertInstanceOf('JMS\Serializer\Tests\Fixtures\Author', $object->getAuthor());
+ $this->assertEquals('baz', $object->getAuthor()->getName());
+ }
+
public function getPrimitiveTypes()
{
return array(
@@ -260,4 +297,4 @@ public static function getSubscribedEvents()
array('event' => 'serializer.post_serialize', 'method' => 'onPostSerialize', 'format' => 'json', 'class' => 'JMS\Serializer\Tests\Fixtures\Author'),
);
}
-}
\ No newline at end of file
+}
diff --git a/tests/JMS/Serializer/Tests/Serializer/XmlSerializationTest.php b/tests/JMS/Serializer/Tests/Serializer/XmlSerializationTest.php
index 0a66739f7..01f8fe371 100644
--- a/tests/JMS/Serializer/Tests/Serializer/XmlSerializationTest.php
+++ b/tests/JMS/Serializer/Tests/Serializer/XmlSerializationTest.php
@@ -35,6 +35,7 @@
use JMS\Serializer\Tests\Fixtures\Input;
use JMS\Serializer\Tests\Fixtures\SimpleClassObject;
use JMS\Serializer\Tests\Fixtures\SimpleSubClassObject;
+use JMS\Serializer\Tests\Fixtures\ObjectWithNamespacesAndList;
class XmlSerializationTest extends BaseSerializationTest
{
@@ -159,6 +160,33 @@ public function testVirtualXmlMap()
$this->serialize(new ObjectWithVirtualXmlProperties(), SerializationContext::create()->setGroups(array('map')))
);
}
+ public function testObjectWithNamespacesAndList()
+ {
+ $object = new ObjectWithNamespacesAndList();
+ $object->name = 'name';
+ $object->nameAlternativeB = 'nameB';
+
+ $object->phones = array('111', '222');
+ $object->addresses = array('A'=>'Street 1', 'B'=>'Street 2');
+
+ $object->phonesAlternativeB = array('555', '666');
+ $object->addressesAlternativeB = array('A'=>'Street 5', 'B'=>'Street 6');
+
+ $object->phonesAlternativeC = array('777', '888');
+ $object->addressesAlternativeC = array('A'=>'Street 7', 'B'=>'Street 8');
+
+ $object->phonesAlternativeD = array('999', 'AAA');
+ $object->addressesAlternativeD = array('A'=>'Street 9', 'B'=>'Street A');
+
+ $this->assertEquals(
+ $this->getContent('object_with_namespaces_and_list'),
+ $this->serialize($object, SerializationContext::create())
+ );
+ $this->assertEquals(
+ $object,
+ $this->deserialize($this->getContent('object_with_namespaces_and_list'), get_class($object))
+ );
+ }
public function testArrayKeyValues()
{
diff --git a/tests/JMS/Serializer/Tests/Serializer/xml/array_list_and_map_difference.xml b/tests/JMS/Serializer/Tests/Serializer/xml/array_list_and_map_difference.xml
new file mode 100644
index 000000000..557b0ad0a
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/xml/array_list_and_map_difference.xml
@@ -0,0 +1,13 @@
+
+
+
+ 1
+ 2
+ 3
+
+
+
diff --git a/tests/JMS/Serializer/Tests/Serializer/xml/blog_post.xml b/tests/JMS/Serializer/Tests/Serializer/xml/blog_post.xml
index bea1e161f..0efe2865c 100644
--- a/tests/JMS/Serializer/Tests/Serializer/xml/blog_post.xml
+++ b/tests/JMS/Serializer/Tests/Serializer/xml/blog_post.xml
@@ -23,4 +23,10 @@
+
+ tag1
+
+
+ tag2
+
diff --git a/tests/JMS/Serializer/Tests/Serializer/xml/nullable_arrays.xml b/tests/JMS/Serializer/Tests/Serializer/xml/nullable_arrays.xml
new file mode 100644
index 000000000..d8c16852b
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/xml/nullable_arrays.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/JMS/Serializer/Tests/Serializer/xml/object_with_namespaces_and_list.xml b/tests/JMS/Serializer/Tests/Serializer/xml/object_with_namespaces_and_list.xml
new file mode 100644
index 000000000..a3022bbd7
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/xml/object_with_namespaces_and_list.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/JMS/Serializer/Tests/Serializer/xml/timestamp.xml b/tests/JMS/Serializer/Tests/Serializer/xml/timestamp.xml
new file mode 100755
index 000000000..a9bf077fa
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/xml/timestamp.xml
@@ -0,0 +1,4 @@
+
+
+ 1455148800
+
diff --git a/tests/JMS/Serializer/Tests/Serializer/xml/timestamp_prev.xml b/tests/JMS/Serializer/Tests/Serializer/xml/timestamp_prev.xml
new file mode 100755
index 000000000..a9bf077fa
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/xml/timestamp_prev.xml
@@ -0,0 +1,4 @@
+
+
+ 1455148800
+
diff --git a/tests/JMS/Serializer/Tests/Serializer/xml/virtual_properties.xml b/tests/JMS/Serializer/Tests/Serializer/xml/virtual_properties.xml
index d0b97b63c..237655e83 100644
--- a/tests/JMS/Serializer/Tests/Serializer/xml/virtual_properties.xml
+++ b/tests/JMS/Serializer/Tests/Serializer/xml/virtual_properties.xml
@@ -1,7 +1,7 @@
-
+
1
diff --git a/tests/JMS/Serializer/Tests/Serializer/yml/array_empty.yml b/tests/JMS/Serializer/Tests/Serializer/yml/array_empty.yml
new file mode 100644
index 000000000..d4def9ae3
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/yml/array_empty.yml
@@ -0,0 +1 @@
+array: []
diff --git a/tests/JMS/Serializer/Tests/Serializer/yml/array_list_and_map_difference.yml b/tests/JMS/Serializer/Tests/Serializer/yml/array_list_and_map_difference.yml
new file mode 100644
index 000000000..05d6fde21
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/yml/array_list_and_map_difference.yml
@@ -0,0 +1,8 @@
+list:
+ - 1
+ - 2
+ - 3
+map:
+ 0: 1
+ 2: 2
+ 3: 3
diff --git a/tests/JMS/Serializer/Tests/Serializer/yml/blog_post.yml b/tests/JMS/Serializer/Tests/Serializer/yml/blog_post.yml
index 5f03b96a9..fd557c18f 100644
--- a/tests/JMS/Serializer/Tests/Serializer/yml/blog_post.yml
+++ b/tests/JMS/Serializer/Tests/Serializer/yml/blog_post.yml
@@ -19,3 +19,8 @@ author:
full_name: 'Foo Bar'
publisher:
pub_name: 'Bar Foo'
+tag:
+ -
+ name: tag1
+ -
+ name: tag2
diff --git a/tests/JMS/Serializer/Tests/Serializer/yml/blog_post_unauthored.yml b/tests/JMS/Serializer/Tests/Serializer/yml/blog_post_unauthored.yml
index dcbd17e5d..5e080297a 100644
--- a/tests/JMS/Serializer/Tests/Serializer/yml/blog_post_unauthored.yml
+++ b/tests/JMS/Serializer/Tests/Serializer/yml/blog_post_unauthored.yml
@@ -3,7 +3,10 @@ title: 'This is a nice title.'
created_at: '2011-07-30T00:00:00+0000'
is_published: false
etag: 1edf9bf60a32d89afbb85b2be849e3ceed5f5b10
+comments: []
+comments2: []
metadata:
foo: bar
author: null
publisher: null
+tag: null
diff --git a/tests/JMS/Serializer/Tests/Serializer/yml/nullable_arrays.yml b/tests/JMS/Serializer/Tests/Serializer/yml/nullable_arrays.yml
new file mode 100644
index 000000000..4454d3992
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/yml/nullable_arrays.yml
@@ -0,0 +1,9 @@
+empty_inline: []
+not_empty_inline:
+ - not_empty_inline
+empty_not_inline: []
+not_empty_not_inline:
+ - not_empty_not_inline
+empty_not_inline_skip: []
+not_empty_not_inline_skip:
+ - not_empty_not_inline_skip
diff --git a/tests/JMS/Serializer/Tests/Serializer/yml/timestamp.yml b/tests/JMS/Serializer/Tests/Serializer/yml/timestamp.yml
new file mode 100755
index 000000000..b1c38be9d
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/yml/timestamp.yml
@@ -0,0 +1 @@
+timestamp: 1455148800
diff --git a/tests/JMS/Serializer/Tests/Serializer/yml/timestamp_prev.yml b/tests/JMS/Serializer/Tests/Serializer/yml/timestamp_prev.yml
new file mode 100755
index 000000000..3df27d67a
--- /dev/null
+++ b/tests/JMS/Serializer/Tests/Serializer/yml/timestamp_prev.yml
@@ -0,0 +1 @@
+timestamp: "1455148800"
diff --git a/tests/JMS/Serializer/Tests/Serializer/yml/virtual_properties.yml b/tests/JMS/Serializer/Tests/Serializer/yml/virtual_properties.yml
index 372141efd..7d1c0b2b5 100644
--- a/tests/JMS/Serializer/Tests/Serializer/yml/virtual_properties.yml
+++ b/tests/JMS/Serializer/Tests/Serializer/yml/virtual_properties.yml
@@ -1,4 +1,4 @@
exist_field: value
-test: other-name
virtual_value: value
+test: other-name
typed_virtual_property: 1
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 5d1b9e956..71ce33a6b 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -27,5 +27,4 @@
$loader->add('JMS\Serializer\Tests', __DIR__);
AnnotationRegistry::registerLoader('class_exists');
- AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');
});