Skip to content

Commit

Permalink
Merge tag '2.1.9' into release/2.2.0
Browse files Browse the repository at this point in the history
This is a bugfix release.
This release has:
- Disable the versioning in the legacy data definition if is enable. The versioning comes as feature in a later version. #553
- Add missing select in DefaultDataProvider#getVersion()
- Fix typo in active version retrieval
- Fix versions fetch in DefaultDataProvider
- Fix typo: 'tl_version.formTable' -> 'fromTable'
- Add exception if palettes null in the palette collection #556
- Change operations to fix DBAL error see #549
- Add fallback for id property in tree picker
- Fix the amount for filter all in the default limit element
  • Loading branch information
baumannsven committed Nov 11, 2020
2 parents 4c68c1a + 947c019 commit 475fa98
Show file tree
Hide file tree
Showing 18 changed files with 99 additions and 54 deletions.
26 changes: 14 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dist: xenial

addons:
apt:
packages:
- ant-optional
apt:
packages:
- ant-optional

language: php

Expand All @@ -13,14 +13,16 @@ php:
- "7.2"

env:
- CONTAO_VERSION='contao/core-bundle ~4.9.0'
- CONTAO_VERSION='contao/core-bundle ~4.10.0@dev'
- CONTAO_VERSION='contao/core-bundle ~4.10.0'
- CONTAO_VERSION='contao/core-bundle ~4.9.0'

matrix:
fast_finish: true
allow_failures:
- php: "7.4"
- env: CONTAO_VERSION='contao/core-bundle ~4.10.0@dev'
fast_finish: true
exclude:
- php: "7.1"
env: CONTAO_VERSION='contao/core-bundle ~4.9.0'
- php: "7.1"
env: CONTAO_VERSION='contao/core-bundle ~4.10.0'

before_install:
- echo "memory_limit = -1" > travis.php.ini && phpenv config-add travis.php.ini
Expand All @@ -34,8 +36,8 @@ script: ant -keep-going

# Hack to make things work again - we can not use a shallow repository.
git:
depth: 2147483647
depth: 2147483647

cache:
directories:
- vendor
directories:
- vendor
6 changes: 3 additions & 3 deletions build.default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ phpcpd.excluded=DataDefinition/Palette/Builder/Event \
Event \
# Excluded public sources from phpcs.
phpcs.excluded=deprecated-autoload.php \
src/Resources/public \
src/Resources/contao
phpcs.excluded=deprecated-autoload.php\
,src/Resources/public/*\
,src/Resources/contao/*

autoload-validation.customflags=--add-autoloader=autoload-validation-hack.php

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"ext-pdo": "*"
},
"conflict": {
"menatwork/contao-multicolumnwizard": "<3.4.0"
"menatwork/contao-multicolumnwizard-bundle": "<3.4.9"
},
"require-dev": {
"phpcq/all-tasks": "^1.2",
Expand All @@ -54,6 +54,7 @@
"contao/manager-plugin": "^2.8",
"menatwork/contao-multicolumnwizard-bundle": "^3.4",
"php-http/guzzle6-adapter": "^2.0",
"phpmd/phpmd": "~2.8.2",
"phpmd/phpmd": "~2.8.2"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
* (c) 2013-2020 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,7 +13,7 @@
* @package contao-community-alliance/dc-general
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2013-2019 Contao Community Alliance.
* @copyright 2013-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand All @@ -30,6 +30,8 @@
* Class AbstractReturningPropertyCallbackListener.
*
* Abstract base class for a callback listener.
*
* @SuppressWarnings(PHPMD.LongClassName)
*/
abstract class AbstractReturningPropertyCallbackListener extends AbstractReturningCallbackListener
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
* (c) 2013-2020 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -14,7 +14,7 @@
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
* @author Tristan Lins <tristan.lins@bit3.de>
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2013-2019 Contao Community Alliance.
* @copyright 2013-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand All @@ -28,6 +28,8 @@
* Class PropertyInputFieldGetWizardCallbackListener.
*
* Handle the property wizard callbacks.
*
* @SuppressWarnings(PHPMD.LongClassName)
*/
class PropertyInputFieldGetWizardCallbackListener extends AbstractReturningPropertyCallbackListener
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
* (c) 2013-2020 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,7 +13,7 @@
* @package contao-community-alliance/dc-general
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2013-2019 Contao Community Alliance.
* @copyright 2013-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand All @@ -27,6 +27,8 @@
* Class PropertyInputFieldGetXLabelCallbackListener.
*
* Handle the property wizard callbacks.
*
* @SuppressWarnings(PHPMD.LongClassName)
*/
class PropertyInputFieldGetXLabelCallbackListener extends AbstractReturningPropertyCallbackListener
{
Expand Down
15 changes: 11 additions & 4 deletions src/Contao/Dca/Builder/Legacy/LegacyDcaDataDefinitionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
* (c) 2013-2020 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -16,7 +16,7 @@
* @author David Molineus <david.molineus@netzmacht.de>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2013-2019 Contao Community Alliance.
* @copyright 2013-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand Down Expand Up @@ -546,8 +546,15 @@ protected function parseDataProvider(ContainerInterface $container)
)
);
}
$providerInformation
->setVersioningEnabled((bool) $this->getFromDca('config/enableVersioning'));
$providerInformation->setVersioningEnabled(false);
if (true === (bool) $this->getFromDca('config/enableVersioning')) {
// @codingStandardsIgnoreStart
@\trigger_error(
'Versioning is not supported yet and will get implemented in a future release.',
E_USER_WARNING
);
// @codingStandardsIgnoreEnd
}

if (!$container->getBasicDefinition()->getDataProvider()) {
$container->getBasicDefinition()->setDataProvider($providerName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
* (c) 2013-2020 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,7 +13,7 @@
* @package contao-community-alliance/dc-general
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
* @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2013-2019 Contao Community Alliance.
* @copyright 2013-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand All @@ -28,6 +28,8 @@
*
* To utilize this class, you only have to implement the remaining method "populate" and register the populators
* method "process" to the event dispatcher.
*
* @SuppressWarnings(PHPMD.LongClassName)
*/
abstract class AbstractEventDrivenBackendEnvironmentPopulator implements EnvironmentPopulatorInterface
{
Expand Down
11 changes: 7 additions & 4 deletions src/Contao/View/Contao2BackendView/ButtonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,13 @@ public function __construct(EnvironmentInterface $environment)
$this->circularModelIds = [];

// We must only check for CUT operation here as pasting copy'ed parents is allowed.
$cutItems = \array_filter($this->clipboardItems, function ($item) {
/** @var ItemInterface $item */
return $item->getAction() === $item::CUT;
});
$cutItems = \array_filter(
$this->clipboardItems,
function ($item) {
/** @var ItemInterface $item */
return $item->getAction() === $item::CUT;
}
);
$cutModels = $controller->getModelsFromClipboardItems($cutItems);
$collector = new ModelCollector($environment);
foreach ($cutModels as $model) {
Expand Down
10 changes: 6 additions & 4 deletions src/Contao/View/Contao2BackendView/ContaoWidgetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
* (c) 2013-2020 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -19,7 +19,7 @@
* @author Ingolf Steinhardt <info@e-spin.de>
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
* @copyright 2013-2019 Contao Community Alliance.
* @copyright 2013-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand Down Expand Up @@ -49,6 +49,8 @@
* Class ContaoWidgetManager.
*
* This class is responsible for creating widgets and processing data through them.
*
* @SuppressWarnings(PHPMD.LongClassName)
*/
class ContaoWidgetManager
{
Expand Down Expand Up @@ -445,8 +447,8 @@ public function processInput(PropertyValueBag $propertyValues)
$property,
$this->encodeValue($property, $widget->value, $propertyValues)
);
} catch (\Exception $e) {
$widget->addError($e->getMessage());
} catch (\Exception $exception) {
$widget->addError($exception->getMessage());
foreach ($widget->getErrors() as $error) {
$propertyValues->markPropertyValueAsInvalid($property, $error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ private function prepareWidgetAttributes(ModelInterface $model, PropertyInterfac
],
'options' => $this->getOptionsForWidget($property, $model),
'eval' => $propExtra,
// @codingStandardsIgnoreStart
// 'foreignKey' => null
// @codingStandardsIgnoreEnd
];

if (isset($propExtra['reference'])) {
Expand Down
7 changes: 4 additions & 3 deletions src/Contao/View/Contao2BackendView/TreePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,8 @@ protected function parseModel($model, $toggleID)
$this->generateToggleUrl($model)
);

$template = new ContaoBackendViewTemplate('widget_treepicker_entry');
$idProperty = $this->idProperty ?: 'id';
$template = new ContaoBackendViewTemplate('widget_treepicker_entry');
$template
->setTranslator($this->getEnvironment()->getTranslator())
->set('id', $this->strId)
Expand All @@ -1351,8 +1352,8 @@ protected function parseModel($model, $toggleID)
->set('toggleUrl', $this->generateToggleUrl($model))
->set('toggleTitle', $toggleTitle)
->set('toggleScript', $toggleScript)
->set('active', static::optionChecked($model->getProperty($this->idProperty), $this->value))
->set('idProperty', $this->idProperty);
->set('active', static::optionChecked($model->getProperty($idProperty), $this->value))
->set('idProperty', $idProperty);

$level = $model->getMeta(DCGE::TREE_VIEW_LEVEL);
if (($this->minLevel > 0) && ($level < ($this->minLevel - 1))) {
Expand Down
10 changes: 6 additions & 4 deletions src/Data/DefaultDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Ingolf Steinhardt <info@e-spin.de>
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
* @author Alex Wuttke <alex@das-l.de>
* @copyright 2013-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
Expand Down Expand Up @@ -695,6 +696,7 @@ public function fieldExists($columnName)
public function getVersion($mixID, $mixVersion)
{
$queryBuilder = $this->connection->createQueryBuilder();
$queryBuilder->select('*');
$queryBuilder->from('tl_version');
$queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.pid', ':pid'));
$queryBuilder->setParameter(':pid', $mixID);
Expand Down Expand Up @@ -743,8 +745,8 @@ public function getVersions($mixID, $onlyActive = false)
$queryBuilder = $this->connection->createQueryBuilder();
$queryBuilder->select(['tstamp', 'version', 'username', 'active']);
$queryBuilder->from('tl_version');
$queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.formTable', ':formTable'));
$queryBuilder->setParameter(':formTable', $this->source);
$queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.fromTable', ':fromTable'));
$queryBuilder->setParameter(':fromTable', $this->source);
$queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.pid', ':pid'));
$queryBuilder->setParameter(':pid', $mixID);

Expand All @@ -760,7 +762,7 @@ public function getVersions($mixID, $onlyActive = false)
return null;
}

$versions = $statement->fetch(\PDO::FETCH_ASSOC);
$versions = $statement->fetchAll(\PDO::FETCH_ASSOC);

$collection = $this->getEmptyCollection();

Expand Down Expand Up @@ -852,7 +854,7 @@ public function setVersionActive($mixID, $mixVersion)
public function getActiveVersion($mixID)
{
$queryBuilder = $this->connection->createQueryBuilder();
$queryBuilder->select(['select']);
$queryBuilder->select('version');
$queryBuilder->from('tl_version');
$queryBuilder->andWhere($queryBuilder->expr()->eq('tl_version.pid', ':pid'));
$queryBuilder->setParameter(':pid', $mixID);
Expand Down
13 changes: 10 additions & 3 deletions src/Data/DefaultDataProviderDBalUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
* (c) 2013-2020 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -13,7 +13,8 @@
* @package contao-community-alliance/dc-general
* @author Sven Baumann <baumann.sv@gmail.com>
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
* @copyright 2013-2019 Contao Community Alliance.
* @author Ingolf Steinhardt <info@e-spin.de>
* @copyright 2013-2020 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand Down Expand Up @@ -100,6 +101,10 @@ public static function addSorting(ConfigInterface $config, QueryBuilder $queryBu
}

foreach ($config->getSorting() as $sort => $order) {
if (empty($sort)) {
continue;
}

// array could be a simple field list or list of field => direction combinations.
if (!empty($order)) {
$order = strtoupper($order);
Expand Down Expand Up @@ -309,7 +314,9 @@ private static function filterAndOr($operation, QueryBuilder $queryBuilder)
$whereOperation = strtolower($operation['operation']) . 'Where';

foreach ($children as $child) {
$queryBuilder->{$whereOperation}(static::calculateSubFilter($child, $queryBuilder));
if ('' !== $child = static::calculateSubFilter($child, $queryBuilder)) {
$queryBuilder->{$whereOperation}($child);
}
}
}

Expand Down
Loading

0 comments on commit 475fa98

Please sign in to comment.