Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Merge 2ad105a into 6538aa2
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Nov 13, 2018
2 parents 6538aa2 + 2ad105a commit c25b19b
Show file tree
Hide file tree
Showing 82 changed files with 501 additions and 313 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Expand Up @@ -2,3 +2,4 @@
*.md export-ignore
tests/* export-ignore
docs/* export-ignore
tests/Fixtures/App/var* export-ignore
5 changes: 3 additions & 2 deletions .gitignore
Expand Up @@ -2,7 +2,8 @@
/docs/_build
/vendor
.php_cs.cache
.phpunit
composer.lock
phpunit.xml
tests/Resources/app/cache/
tests/Resources/app/logs/
tests/Fixtures/App/var/cache/
tests/Fixtures/App/var/logs/
6 changes: 6 additions & 0 deletions .php_cs.dist
Expand Up @@ -36,6 +36,12 @@ $rules = [
'@PHP56Migration' => true,
'@PHP56Migration:risky' => true,
'@PHPUnit57Migration:risky' => true,
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'compact_nullable_typehint' => true,
// To be tested before insertion:
// 'strict_comparison' => true,
// 'strict_param' => true,
Expand Down
8 changes: 1 addition & 7 deletions .travis.yml
Expand Up @@ -10,8 +10,6 @@ branches:
language: php

php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- nightly
Expand Down Expand Up @@ -43,12 +41,8 @@ matrix:
env: TARGET=docs
- php: '7.2'
env: TARGET=lint
- php: '5.6'
- php: '7.1'
env: COMPOSER_FLAGS="--prefer-lowest"
- php: '7.2'
env: SYMFONY=2.8.*
- php: '7.2'
env: SYMFONY=3.3.*
- php: '7.2'
env: SYMFONY=3.4.*
- php: '7.2'
Expand Down
2 changes: 1 addition & 1 deletion .travis/before_install_test.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -ev

PHP_INI_DIR="$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/"
Expand Down
9 changes: 8 additions & 1 deletion .travis/before_script_test.sh 100644 → 100755
@@ -1,3 +1,10 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -ev

TESTING_SCRIPTS_DIR=vendor/symfony-cmf/testing/bin
CONSOLE=${TESTING_SCRIPTS_DIR}/console

export KERNEL_CLASS="Sonata\\DoctrinePHPCRAdminBundle\\Tests\\Fixtures\\App\\Kernel"
echo '+++ create PHPCR +++'
${CONSOLE} doctrine:phpcr:init:dbal --drop --force -vvv
${CONSOLE} doctrine:phpcr:repository:init -vvv
2 changes: 1 addition & 1 deletion .travis/check_relevant_docs.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -ev

RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.rst')
Expand Down
2 changes: 1 addition & 1 deletion .travis/check_relevant_lint.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -ev

RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.json' '*.yml' '*.xml' '*.xliff' '*.php')
Expand Down
2 changes: 1 addition & 1 deletion .travis/check_relevant_test.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
set -ev

RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.php' '*.yml' '*.xml' '*.twig' '*.js' '*.css' '*.json')
Expand Down
2 changes: 2 additions & 0 deletions UPGRADE-3.0.md
@@ -0,0 +1,2 @@
UPGRADE FROM 2.x to 3.0
=======================
27 changes: 15 additions & 12 deletions composer.json
Expand Up @@ -21,21 +21,22 @@
}
],
"require": {
"php": "^5.6 || ^7.0",
"php": "^7.1",
"doctrine/phpcr-bundle": "^1.3 || ^2.0",
"doctrine/phpcr-odm": "^1.4 || ^2.0",
"doctrine/phpcr-odm": "^1.4.2 || ^2.0",
"sonata-project/admin-bundle": "^3.30.1",
"sonata-project/block-bundle": "^3.11",
"symfony-cmf/resource-rest-bundle": "^1.0.1",
"symfony-cmf/tree-browser-bundle": "^2.0",
"symfony/config": "^2.8 || ^3.2",
"symfony/dependency-injection": "^2.8 || ^3.2",
"symfony/form": "^2.8 || ^3.2",
"symfony/framework-bundle": "^2.8 || ^3.2",
"symfony/http-foundation": "^2.8 || ^3.2",
"symfony/http-kernel": "^2.8 || ^3.2",
"symfony/options-resolver": "^2.8 || ^3.2",
"symfony/property-access": "^2.8 || ^3.2"
"symfony/config": "^2.8 || ^3.2 || ^4.0",
"symfony/dependency-injection": "^2.8 || ^3.2 || ^4.0",
"symfony/finder": "^2.8 || ^3.2 || ^4.0",
"symfony/form": "^2.8 || ^3.2 || ^4.0",
"symfony/framework-bundle": "^2.8 || ^3.2 || ^4.0",
"symfony/http-foundation": "^2.8 || ^3.2 || ^4.0",
"symfony/http-kernel": "^2.8 || ^3.2 || ^4.0",
"symfony/options-resolver": "^2.8 || ^3.2 || ^4.0",
"symfony/property-access": "^2.8 || ^3.2 || ^4.0"
},
"provide": {
"sonata-project/admin-bundle-persistency-layer": "1.0.0"
Expand All @@ -46,12 +47,14 @@
"matthiasnoback/symfony-dependency-injection-test": "^1.1",
"phpcr/phpcr": "^2.1",
"phpcr/phpcr-utils": "^1.4.0",
"sebastian/environment": ">=1.3.4",
"sebastian/exporter": ">=2.0.0",
"sonata-project/core-bundle": "^3.8",
"symfony-cmf/resource": "^1.0",
"symfony-cmf/resource-bundle": "^1.0",
"symfony-cmf/testing": "2.0.*",
"symfony-cmf/testing": "^2.1.8",
"symfony/phpunit-bridge": "^4.0",
"symfony/routing": "^2.8 || ^3.2",
"symfony/routing": "^2.8 || ^3.2 || ^4.0",
"symfony/security-acl": "^2.8 || ^3.0"
},
"config": {
Expand Down
9 changes: 7 additions & 2 deletions docs/reference/document_tree.rst
Expand Up @@ -220,7 +220,7 @@ like this:
.. code-block:: jinja
{% render(controller(
'sonata.admin.doctrine_phpcr.tree_controller:treeAction',
'sonata.admin.doctrine_phpcr.tree_controller::treeAction',
{
'root': basePath ~ "/menu",
'selected': menuNodeId,
Expand All @@ -231,14 +231,19 @@ like this:
.. code-block:: php
<?php echo $view['actions']->render(new ControllerReference(
'sonata.admin.doctrine_phpcr.tree_controller:treeAction',
'sonata.admin.doctrine_phpcr.tree_controller::treeAction',
array(
'root' => $basePath . '/menu',
'selected' => $menuNodeId,
'_locale' => $app->getRequest()->getLocale()
),
)) ?>
.. note::
To use the configuration for Symfony < 3.4 you should use the single colon (:) notation to define controller
actions: ``sonata.admin.doctrine_phpcr.tree_controller:treeAction`` – `jsTree`_

.. _`CmfTreeBrowserBundle`: http://symfony.com/doc/master/cmf/bundles/tree_browser/introduction.html
.. _`cmf-sandbox configuration`: https://github.com/symfony-cmf/cmf-sandbox/blob/master/app/config/config.yml
.. _`jsTree`: http://www.jstree.com/documentation
.. _`Symfony documentation`: https://symfony.com/doc/3.1/controller/service.html#referring-to-the-service
2 changes: 1 addition & 1 deletion docs/requirements.txt
@@ -1,3 +1,3 @@
Sphinx
Sphinx>=1.8
git+https://github.com/fabpot/sphinx-php.git
sphinx_rtd_theme
22 changes: 5 additions & 17 deletions phpunit.xml.dist
Expand Up @@ -11,19 +11,11 @@
syntaxCheck="false"
bootstrap="vendor/symfony-cmf/testing/bootstrap/bootstrap.php"
>
<php>
<server name="KERNEL_DIR" value="tests/Resources/app" />
</php>

<testsuites>
<testsuite name="SonataDoctrinePHPCRAdminBundle Unit Test Suite">
<testsuite name="SonataDoctrinePHPCRAdminBundle Test Suite">
<directory>./tests/Unit</directory>
</testsuite>

<!-- SonataDoctrinePHPCRAdminBundle Integration Test Suite – The name has to be "phpcr" to trigger db listener.-->
<testsuite name="phpcr">
<directory>./tests/WebTest</directory>
<directory>./Tests</directory>
</testsuite>
</testsuites>

Expand All @@ -33,20 +25,16 @@
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
<directory>./Resources</directory>
<directory>./DependencyInjection</directory>
<file>./SonataDoctrinePHPCRAdminBundle.php</file>
<directory>./src/Resources</directory>
<directory>./src/DependencyInjection</directory>
<file>./src/SonataDoctrinePHPCRAdminBundle.php</file>
<directory>./coverage/</directory>
</exclude>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Cmf\Component\Testing\Phpunit\DatabaseTestListener" />
</listeners>

<php>
<ini name="precision" value="8"/>
<env name="KERNEL_CLASS" value="Sonata\DoctrinePHPCRAdminBundle\Tests\Fixtures\App\Kernel" />
</php>

</phpunit>
6 changes: 4 additions & 2 deletions src/Admin/Admin.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -40,7 +42,7 @@ class Admin extends AbstractAdmin
*
* @param string $rootPath
*/
public function setRootPath($rootPath)
public function setRootPath($rootPath): void
{
$this->rootPath = $rootPath;
}
Expand Down Expand Up @@ -131,7 +133,7 @@ public function toString($object)
/**
* @param RouteCollection $collection
*/
protected function configureRoutes(RouteCollection $collection)
protected function configureRoutes(RouteCollection $collection): void
{
foreach (['edit', 'create', 'delete'] as $name) {
if ($collection->has($name)) {
Expand Down
8 changes: 5 additions & 3 deletions src/Admin/FieldDescription.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -29,7 +31,7 @@ public function __construct()
* @throws \InvalidArgumentException if the mapping is no array or of an
* unknown type
*/
public function setAssociationMapping($associationMapping)
public function setAssociationMapping($associationMapping): void
{
if (!\is_array($associationMapping)) {
throw new \InvalidArgumentException('The association mapping must be an array');
Expand Down Expand Up @@ -64,7 +66,7 @@ public function getTargetEntity()
*
* @throws \InvalidArgumentException if the mapping information is not an array
*/
public function setFieldMapping($fieldMapping)
public function setFieldMapping($fieldMapping): void
{
if (!\is_array($fieldMapping)) {
throw new \InvalidArgumentException('The field mapping must be an array');
Expand Down Expand Up @@ -103,7 +105,7 @@ public function getValue($object)
* @throws \InvalidArgumentException if the list of mappings does contain
* something else than arrays
*/
public function setParentAssociationMappings(array $parentAssociationMappings)
public function setParentAssociationMappings(array $parentAssociationMappings): void
{
foreach ($parentAssociationMappings as $parentAssociationMapping) {
if (!\is_array($parentAssociationMapping)) {
Expand Down
10 changes: 6 additions & 4 deletions src/Block/TreeBlockService.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand All @@ -12,15 +14,15 @@
namespace Sonata\DoctrinePHPCRAdminBundle\Block;

use Sonata\AdminBundle\Form\FormMapper;
use Sonata\BlockBundle\Block\BaseBlockService;
use Sonata\BlockBundle\Block\BlockContextInterface;
use Sonata\BlockBundle\Block\Service\AbstractBlockService;
use Sonata\BlockBundle\Model\BlockInterface;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

class TreeBlockService extends BaseBlockService
class TreeBlockService extends AbstractBlockService
{
/**
* @var array
Expand All @@ -43,7 +45,7 @@ public function __construct($name, EngineInterface $templating, array $defaults
*
* NOOP as there is nothing to edit.
*/
public function buildEditForm(FormMapper $form, BlockInterface $block)
public function buildEditForm(FormMapper $form, BlockInterface $block): void
{
// there is nothing to edit here
}
Expand All @@ -62,7 +64,7 @@ public function execute(BlockContextInterface $blockContext, Response $response
/**
* {@inheritdoc}
*/
public function configureSettings(OptionsResolver $resolver)
public function configureSettings(OptionsResolver $resolver): void
{
// the callables are a workaround to make bundle configuration win over the default values
// see https://github.com/sonata-project/SonataDoctrinePhpcrAdminBundle/pull/345
Expand Down
6 changes: 4 additions & 2 deletions src/Builder/DatagridBuilder.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -69,7 +71,7 @@ public function __construct(FormFactory $formFactory, FilterFactoryInterface $fi
/**
* @param PagerInterface $pager
*/
public function setPager(PagerInterface $pager)
public function setPager(PagerInterface $pager): void
{
$this->pager = $pager;
}
Expand All @@ -89,7 +91,7 @@ public function getPager()
/**
* {@inheritdoc}
*/
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription)
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription): void
{
// set default values
$fieldDescription->setAdmin($admin);
Expand Down
6 changes: 4 additions & 2 deletions src/Builder/FormContractor.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
Expand Down Expand Up @@ -39,7 +41,7 @@ public function __construct(FormFactoryInterface $formFactory)
*
* @throws \RuntimeException if the $fieldDescription does not specify a type
*/
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription)
public function fixFieldDescription(AdminInterface $admin, FieldDescriptionInterface $fieldDescription): void
{
$metadata = null;
if ($admin->getModelManager()->hasMetadata($admin->getClass())) {
Expand Down Expand Up @@ -173,7 +175,7 @@ public function getDefaultOptions($type, FieldDescriptionInterface $fieldDescrip
protected function getAssociationAdminException(FieldDescriptionInterface $fieldDescription)
{
$msg = sprintf('The current field `%s` is not linked to an admin. Please create one', $fieldDescription->getName());
if (\in_array($fieldDescription->getMappingType(), [ClassMetadata::MANY_TO_ONE, ClassMetadata::MANY_TO_MANY, 'referrers'])) {
if (\in_array($fieldDescription->getMappingType(), [ClassMetadata::MANY_TO_ONE, ClassMetadata::MANY_TO_MANY, 'referrers'], true)) {
if ($fieldDescription->getTargetEntity()) {
$msg .= " for the target document: `{$fieldDescription->getTargetEntity()}`";
}
Expand Down

0 comments on commit c25b19b

Please sign in to comment.