Skip to content

Commit

Permalink
Merge tag '2.2.0'
Browse files Browse the repository at this point in the history
Stable release 2.2.0
This brings full Contao 4.9 support.

Additionally there have been performance improvements
and various bugfixes.

- With the new interface ITranslatedMetaModel it is now possible to use a translated alias for the settings of the attribute at Alias - until now this had to be an attribute with "unique" values
- with change to interface ITranslatedMetaModel API expects at method widgetToValue the data value which was selected at attribute at alias - so far fixed to id
- widget as readonly now works correctly in the input mask; also in the popup picker
- a filter activated in the attribute settings now also affects the output in the VU - e.g. referenced items are no longer output if a filter limits this analogously to the display in the BE
  • Loading branch information
baumannsven committed Nov 18, 2022
2 parents a07e4ea + 5f6c5b8 commit 289ed0e
Show file tree
Hide file tree
Showing 25 changed files with 860 additions and 258 deletions.
7 changes: 7 additions & 0 deletions .check-author.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ exclude:

mapping:
'Andreas Isaak <[email protected]>': 'Andreas Isaak <[email protected]>'
'Stefan Heimes <[email protected]>': 'Stefan Heimes <[email protected]>'
'Ingolf Steinhardt <[email protected]>':
- 'e-spin <[email protected]>'
- 'zonky <[email protected]>'
- 'zonky2 <[email protected]>'
- 'sandokan <[email protected]>'
- 'e-spin <[email protected]>'
52 changes: 52 additions & 0 deletions .github/workflows/diagnostics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: MetaModels attribute_select

on:
push:
branches-ignore:
- '**-translation'
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.4]
contao: [~4.9.0]

steps:
- name: PHP ${{ matrix.php }} ${{ matrix.contao }} Pull source
uses: actions/checkout@v2
with:
fetch-depth: 0

# see https://github.com/shivammathur/setup-php
- name: PHP ${{ matrix.php }} ${{ matrix.contao }} Setup PHP.
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

- name: PHP ${{ matrix.php }} ${{ matrix.contao }} Cache composer cache directory
uses: actions/cache@v1
env:
cache-name: composer-cache-dir
with:
path: ~/.cache/composer
key: ${{ runner.os }}-build-${{ env.cache-name }}

- name: PHP ${{ matrix.php }} ${{ matrix.contao }} Cache vendor directory
uses: actions/cache@v1
env:
cache-name: composer-vendor
with:
path: vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: PHP ${{ matrix.php }} ${{ matrix.contao }} Install composer dependencies
run: composer update --prefer-dist --no-interaction --no-suggest

- name: PHP ${{ matrix.php }} ${{ matrix.contao }} Run tests
run: ant -keep-going
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ vendor/
# build
build/
composer.lock
.phpunit.result.cache
63 changes: 0 additions & 63 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[![Build Status](https://travis-ci.org/MetaModels/attribute_select.svg)](https://travis-ci.org/MetaModels/attribute_select)
[![Build Status](https://github.com/MetaModels/attribute_select/actions/workflows/diagnostics.yml/badge.svg)](https://github.com/MetaModels/attribute_select/actions)
[![Latest Version tagged](http://img.shields.io/github/tag/MetaModels/attribute_select.svg)](https://github.com/MetaModels/attribute_select/tags)
[![Latest Version on Packagist](http://img.shields.io/packagist/v/MetaModels/attribute_select.svg)](https://packagist.org/packages/MetaModels/attribute_select)
[![Installations via composer per month](http://img.shields.io/packagist/dm/MetaModels/attribute_select.svg)](https://packagist.org/packages/MetaModels/attribute_select)

Select
======

The select attribute
The select attribute.
2 changes: 2 additions & 0 deletions build.default.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ phpcs.standard=${basedir}/vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/rule
phpmd.ruleset=${basedir}/vendor/phpcq/coding-standard/phpmd/ruleset.xml

phpcs.excluded=src/Resources/contao/languages

phpcpd.excluded=src/Attribute/MetaModelSelect.php
25 changes: 15 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"nontranslatable"
],
"type": "contao-bundle",
"homepage": "http://now.metamodel.me/",
"homepage": "https://now.metamodel.me/",
"license": "LGPL-3.0-or-later",
"authors": [
{
"name": "Christian Schiffler",
"email": "[email protected]",
"homepage": "http://www.cyberspectrum.de",
"homepage": "https://www.cyberspectrum.de",
"role": "Developer"
},
{
Expand All @@ -27,18 +27,19 @@
"support": {
"email": "[email protected]",
"issues": "https://github.com/MetaModels/attribute_select/issues",
"wiki": "http://de.contaowiki.org/MetaModels",
"wiki": "https://de.contaowiki.org/MetaModels",
"irc": "irc://irc.freenode.org/contao.mm",
"source": "https://github.com/MetaModels/attribute_select"
},
"require": {
"php": "^7.1",
"contao-community-alliance/dc-general": "^2.1.0",
"php": "^7.4",
"contao-community-alliance/contao-polyfill-bundle": "^1.1.0",
"contao/core-bundle": "^4.4.8",
"metamodels/core": "^2.1",
"symfony/dependency-injection": "^3.3 || ^4.0",
"symfony/http-kernel": "^3.3 || ^4.0"
"contao-community-alliance/dc-general": "^2.2",
"contao/core-bundle": "^4.9.0, <4.13.0",
"doctrine/dbal": "^2.11 || ^3.0",
"metamodels/core": "^2.2",
"symfony/dependency-injection": "^4.4.6",
"symfony/http-kernel": "~4.4.13"
},
"require-dev": {
"contao/manager-plugin": "^2.1",
Expand All @@ -61,10 +62,14 @@
"extra": {
"contao-manager-plugin": "MetaModels\\AttributeSelectBundle\\ContaoManager\\Plugin",
"branch-alias": {
"dev-master": "2.1.x-dev"
"dev-feature/2.2.0": "2.2.x-dev"
}
},
"config": {
"allow-plugins": {
"contao-components/installer": false,
"contao/manager-plugin": false
},
"sort-packages": true
}
}
33 changes: 20 additions & 13 deletions src/Attribute/AbstractSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* This file is part of MetaModels/attribute_select.
*
* (c) 2012-2019 The MetaModels team.
* (c) 2012-2022 The MetaModels team.
*
* 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 <[email protected]>
* @author Sven Baumann <[email protected]>
* @author Ingolf Steinhardt <[email protected]>
* @copyright 2012-2019 The MetaModels team.
* @copyright 2012-2022 The MetaModels team.
* @license https://github.com/MetaModels/attribute_select/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
Expand All @@ -28,11 +28,7 @@
use MetaModels\AttributeSelectBundle\FilterRule\FilterRuleSelect;

/**
* This is the abstract base class for handling select attributes.
*
* @package MetaModels
* @subpackage AttributeSelect
* @author Christian Schiffler <[email protected]>
* This is the MetaModelAttribute class for handling select attributes.
*/
abstract class AbstractSelect extends AbstractHybrid
{
Expand Down Expand Up @@ -88,6 +84,16 @@ protected function getIdColumn()
return $this->get('select_id') ?: 'id';
}

/**
* Determine the correct sort direction to use.
*
* @return string
*/
protected function getSortDirection()
{
return $this->get('select_sort');
}

/**
* Determine the correct sorting column to use.
*
Expand Down Expand Up @@ -220,6 +226,7 @@ public function getAttributeSettingNames()
'select_column',
'select_alias',
'select_sorting',
'select_sort',
'select_as_radio',
'includeBlankOption',
'submitOnChange',
Expand Down Expand Up @@ -249,9 +256,9 @@ public function searchFor($strPattern)
public function unsetDataFor($arrIds)
{
$this->connection->createQueryBuilder()
->update($this->getMetaModel()->getTableName())
->set($this->getColName(), 0)
->where('id IN (:ids)')
->update($this->getMetaModel()->getTableName(), 't')
->set('t.' . $this->getColName(), 0)
->where('t.id IN (:ids)')
->setParameter('ids', $arrIds, Connection::PARAM_STR_ARRAY)
->execute();
}
Expand Down Expand Up @@ -279,9 +286,9 @@ public function convertValuesToValueIds($values)
}

return $this->connection->createQueryBuilder()
->select($idColumn)
->from($tableName)
->where($aliasColumn . ' IN (:values)')
->select('t.' . $idColumn)
->from($tableName, 't')
->where('t.' . $aliasColumn . ' IN (:values)')
->setParameter('values', $values, Connection::PARAM_STR_ARRAY)
->execute()
->fetch(\PDO::FETCH_ASSOC);
Expand Down
Loading

0 comments on commit 289ed0e

Please sign in to comment.