Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken sorting in 1.3.* #118

Open
Tetragramat opened this issue Oct 16, 2014 · 9 comments

Comments

@Tetragramat
Copy link

commented Oct 16, 2014

Hi, sorry for my english.
Sorting do not work in latest versions.
Last working version is 1.2.5
It shows no error.
I do not know how sorting really works, but script never reach method \Knp\Component\Pager\Event\Subscriber\Sortable\Doctrine\ORM\Query\OrderByWalker::walkSelectStatement

@pilot

This comment has been minimized.

Copy link
Contributor

commented Oct 16, 2014

how you use it?

@Tetragramat

This comment has been minimized.

Copy link
Author

commented Oct 17, 2014

controller action:

$paginator = $this->get('knp_paginator');
$options = array(
            'sortFieldWhitelist' => array( 'b.creationDate'),
            'defaultSortFieldName' => 'b.creationDate',
            'defaultSortDirection' => 'desc',
        );
$items = $paginator->paginate($query, $this->get('request')->query->get('page', 1), $this->getUser()->getResultsPerPage(), $options);

twig template:

{{ knp_pagination_sortable(items, 'item.creationDate'|trans, 'b.creationDate') }}
{% for item in items %}
...
{% endfor %}
{{ knp_pagination_render(items) }}
@gondo

This comment has been minimized.

Copy link
Contributor

commented Dec 15, 2014

what is your query?
what error are you getting?

@Tetragramat

This comment has been minimized.

Copy link
Author

commented Dec 15, 2014

I said, there are no errors. Simply nothing. Nothing in php.log. Nothing in dev.log. Nothing while stepping with Zend debugger. Everything looks perfect, except not working sorting.

I will show you everything I can from not working sorting version.

query in url:

?media_type=text%2Fhtml&sort=b.creationDate&direction=desc&page=1

btw. options defaultSortFieldName and defaultSortDirection do not work too. viz. my previous comment.

composer installed:

aequasi/cache-bundle                 dev-master 742239b Creates services in Symfony 2, for cache, that can also be used with doctrines three cache types (metadata, result, and query). It a...
braincrafted/bootstrap-bundle        v2.1.0             BraincraftedBootstrapBundle integrates Bootstrap into Symfony2 by providing templates, Twig extensions, services and commands.
doctrine/annotations                 v1.2.1             Docblock Annotations Parser
doctrine/cache                       v1.3.1             Caching library offering an object-oriented API for many cache backends
doctrine/collections                 v1.2               Collections Abstraction library
doctrine/common                      v2.4.2             Common Library for Doctrine projects
doctrine/data-fixtures               v1.0.0             Data Fixtures for all Doctrine Object Managers
doctrine/dbal                        2.3.5              Database Abstraction Layer
doctrine/doctrine-bundle             v1.2.0             Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle    v2.2.0             Symfony DoctrineFixturesBundle
doctrine/inflector                   v1.0               Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                1.0.4              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       v1.0               Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                         v2.3.6             Object-Relational-Mapper for PHP
friendsofsymfony/oauth-server-bundle 1.4.2              Symfony2 OAuth Server Bundle
friendsofsymfony/oauth2-php          1.1.1              OAuth2 library
friendsofsymfony/rest-bundle         1.4.2              This Bundle provides various tools to rapidly develop RESTful API's with Symfony2
gedmo/doctrine-extensions            v2.3.9             Doctrine2 behavioral extensions
heureka/inflection                   dev-master 0250082 Class for czech inflection of names and words
imagine/imagine                      v0.5.0             Image processing for PHP 5.3
incenteev/composer-parameter-handler v2.1.0             Composer script handling your ignored parameter file
jdorn/sql-formatter                  v1.2.17            a PHP SQL highlighting library
jms/metadata                         1.5.1              Class/method/property metadata management in PHP
jms/parser-lib                       1.0.0              A library for easily creating recursive-descent parsers.
jms/serializer                       0.16.0             Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
jms/serializer-bundle                0.13.0             Allows you to easily serialize, and deserialize data of any complexity
knplabs/knp-components               1.3.1              Knplabs component library
knplabs/knp-menu                     dev-master 52c8ffd An object oriented menu library
knplabs/knp-menu-bundle              dev-master 838c4a0 This bundle provides an integration of the KnpMenu library
knplabs/knp-paginator-bundle         2.3.3              Paginator bundle for Symfony2 to automate pagination and simplify sorting and other features
knplabs/knp-snappy                   0.3.1              PHP5 library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.
knplabs/knp-snappy-bundle            dev-master 7cd7db8 Easily create PDF and images in Symfony2 by converting Twig/HTML templates.
kriswallsmith/assetic                v1.1.3             Asset Management for PHP
liip/functional-test-bundle          1.0.2              This bundles provides additional functional test-cases for Symfony2 applications
liip/imagine-bundle                  v0.21.1            This Bundle assists in imagine manipulation using the imagine library
michelf/php-markdown                 1.4.1              PHP Markdown
monolog/monolog                      1.11.0             Sends your logs to files, sockets, inboxes, databases and various web services
nelmio/api-doc-bundle                2.7.0              Generates documentation for your REST API from annotations
oldsound/rabbitmq-bundle             v1.2.1             Integrates php-amqplib with Symfony2 and RabbitMq
phpcollection/phpcollection          0.4.0              General-Purpose Collection Library for PHP
phpoption/phpoption                  1.4.0              Option Type for PHP
phpunit/php-code-coverage            2.0.13             Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator            1.3.4              FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template            1.2.0              Simple template engine.
phpunit/php-timer                    1.0.5              Utility class for timing
phpunit/php-token-stream             1.3.0              Wrapper around PHP's tokenizer extension.
phpunit/phpunit                      4.3.5              The PHP Unit Testing framework.
phpunit/phpunit-mock-objects         2.3.0              Mock Object library for PHPUnit
psr/log                              1.0.0              Common interface for logging libraries
sebastian/comparator                 1.1.0              Provides the functionality to compare PHP values for equality
sebastian/diff                       1.2.0              Diff implementation
sebastian/environment                1.2.1              Provides functionality to handle HHVM/PHP environments
sebastian/exporter                   1.0.2              Provides the functionality to export PHP variables for visualization
sebastian/version                    1.0.3              Library that helps with managing the version number of Git-hosted PHP projects
sensio/distribution-bundle           v2.3.6             The base bundle for the Symfony Distributions
sensio/framework-extra-bundle        v2.3.4             This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle              v2.3.5             This bundle generates code for you
swiftmailer/swiftmailer              v5.3.1             Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle               v2.3.1             Integrates Assetic into Symfony2
symfony/monolog-bundle               v2.3.0             Symfony MonologBundle
symfony/swiftmailer-bundle           v2.3.8             Symfony SwiftmailerBundle
symfony/symfony                      v2.3.23            The Symfony PHP framework
twbs/bootstrap                       v3.2.0             The most popular front-end framework for developing responsive, mobile first projects on the web.
twig/extensions                      v1.0.1             Common additional features for Twig that do not directly belong in core
twig/twig                            v1.16.2            Twig, the flexible, fast, and secure template language for PHP
videlalvaro/php-amqplib              v2.1.0             This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.
willdurand/jsonp-callback-validator  v1.1.0             JSONP callback validator.
willdurand/negotiation               1.3.4              Content Negotiation tools for PHP provided as a standalone library.

config:

framework:
    #esi:             ~
    translator:      { fallback: %locale% }
    secret:          %secret%
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection: ~
    validation:      { enable_annotations: true }
    templating:
        engines: ['twig']
        assets_version: v1.1
    default_locale:  "%locale%"
    trusted_proxies: ~
    session:         ~
    fragments:       ~
    http_method_override: true

# Twig Configuration
twig:
    debug:            %kernel.debug%
    strict_variables: %kernel.debug%
    form:
        resources:
            - BraincraftedBootstrapBundle:Form:bootstrap.html.twig

# KNP menu configuration
knp_menu:
    twig:  # use "twig: false" to disable the Twig extension and the TwigRenderer
        template: "NetrealTestBundle::Menu/custom_knp_menu.html.twig"
    templating: false # if true, enables the helper for PHP templates
    default_renderer: twig # The renderer to use, list is also available by default

knp_paginator:
    page_range: 5                      # default page range used in pagination control
    default_options:
        page_name: page                # page query parameter name
        sort_field_name: sort          # sort field query parameter name
        sort_direction_name: direction # sort direction query parameter name
        distinct: true                 # ensure distinct results, useful when ORM queries are using GROUP BY statements
    template:
        pagination: BraincraftedBootstrapBundle:Pagination:bootstrap.html.twig     # sliding pagination controls template
        sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template

# Assetic Configuration
assetic:
    debug:          %kernel.debug%
    use_controller: false
    bundles:        [NetrealTestBundle]
    #java: /usr/bin/java
    filters:
        cssrewrite: [../]
        #closure:
        #    jar: %kernel.root_dir%/Resources/java/compiler.jar
        #yui_css:
        #    jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar

braincrafted_bootstrap:
    less_filter: none
    auto_configure:
        assetic: false
        twig: false
        knp_menu: true
        knp_paginator: true

# Doctrine Configuration
doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8
        # if using pdo_sqlite as your database driver, add the path in parameters.yml
        # e.g. database_path: %kernel.root_dir%/data/data.db3
        # path:     %database_path%

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true
        mappings:
            translatable:
                type: annotation
                alias: Gedmo
                prefix: Gedmo\Translatable\Entity
                # make sure vendor library location is correct
                dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity"
        filters:
            businessGroup_filter:
                class: Netreal\TestBundle\Filter\BusinessGroupFilter
                enabled: true

# Swiftmailer Configuration
swiftmailer:
    transport: %mailer_transport%
    host:      %mailer_host%
    username:  %mailer_user%
    password:  %mailer_password%
    spool:     { type: memory }

old_sound_rabbit_mq:
    connections:
        default: { host: %rabbit_mq_host%, port: %rabbit_mq_port%, user: %rabbit_mq_user%, password: %rabbit_mq_password%, vhost: %rabbit_mq_vhost% }
    producers:
        business_case:
            connection: default
            exchange_options:   {name: 'business-case', type: direct, auto_delete: false, durable: true}
    consumers:
        business_case:
            connection: default
            exchange_options:   {name: 'business-case', type: direct, auto_delete: false, durable: true}
            queue_options:      {name: 'business-case', auto_delete: false}
            callback: netreal_test.consumer.businessCase

monolog:
    handlers:
        permission:
            type: stream
            path: "%kernel.logs_dir%/permission.log"
            channels: permission

liip_imagine:
    filter_sets:
        cache: ~
        my_thumb_120_90:
            quality: 75
            filters:
                thumbnail: { size: [120, 90], mode: outbound }
        my_thumb_400_300:
            quality: 75
            filters:
                thumbnail: { size: [400, 300], mode: outbound }

aequasi_cache:
    instances:
        default:
          persistent: false # Boolean or persistent_id
          namespace: %cache_prefix%
          type: memcached
          hosts:
              - { host: localhost, port: 11211 }
    doctrine:
        enabled: true
        metadata:
            instance: default
            entity_managers:   [ default ]          # the name of your entity_manager connection
            document_managers: [ default ]       # the name of your document_manager connection
        result:
            instance: default
            entity_managers:   [ default, read ]  # you may specify multiple entity_managers
        query:
            instance: default
            entity_managers: [ default ]

sensio_framework_extra:
    view: { annotations: false }
    router: { annotations: true }
    request: { converters: true }
@julban

This comment has been minimized.

Copy link

commented Apr 27, 2015

Same issues for me, worker with 1.2.5, but 1.3.1 does not work and no error.

@Tetragramat

This comment has been minimized.

Copy link
Author

commented Sep 29, 2015

I think, this is related KnpLabs/KnpPaginatorBundle#277 to this issue

@Tetragramat

This comment has been minimized.

Copy link
Author

commented Apr 27, 2016

Now it's working.
Maybe it does not work with some doctrine version.

aequasi/cache-bundle                   3.0.2              Creates services in Symfony 2, for cache, that can also be used with doctrines three cache types (metadata, result, and query). It also provides functionality for session handler support, and Router support.
behat/transliterator                   v1.1.0             String transliterator
braincrafted/bootstrap-bundle          v2.2.0             BraincraftedBootstrapBundle integrates Bootstrap into Symfony2 by providing templates, Twig extensions, services and commands.
doctrine/annotations                   v1.2.7             Docblock Annotations Parser
doctrine/cache                         v1.6.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                   v1.3.0             Collections Abstraction library
doctrine/common                        v2.6.1             Common Library for Doctrine projects
doctrine/data-fixtures                 v1.1.1             Data Fixtures for all Doctrine Object Managers
doctrine/dbal                          v2.5.4             Database Abstraction Layer
doctrine/doctrine-bundle               1.6.2              Symfony DoctrineBundle
doctrine/doctrine-cache-bundle         1.3.0              Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle      v2.2.1             Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle    1.1.1              Symfony DoctrineMigrationsBundle
doctrine/inflector                     v1.0.1             Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator                  1.0.5              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                         v1.0.1             Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                    1.4.1              Database Schema migrations using Doctrine DBAL
doctrine/orm                           v2.5.4             Object-Relational-Mapper for PHP
escapestudios/symfony2-coding-standard 2.9.1              CodeSniffer ruleset for the Symfony2 coding standard
friendsofsymfony/oauth-server-bundle   1.4.2              Symfony2 OAuth Server Bundle
friendsofsymfony/oauth2-php            1.1.1              OAuth2 library
friendsofsymfony/rest-bundle           1.4.2              This Bundle provides various tools to rapidly develop RESTful API's with Symfony2
funlife/common-breadcrumbs-bundle      dev-master 508c009 
funlife/common-error-reporting         dev-master 623f0c4 Symfony bundle implementing convenient error reporting.
funlife/component-validator            dev-master 1ef2972 Symfony Validator Component Extension
gedmo/doctrine-extensions              v2.4.13            Doctrine2 behavioral extensions
heureka/inflection                     v2.0.4             Czech inflection library
imagine/imagine                        v0.6.3             Image processing for PHP 5.3
incenteev/composer-parameter-handler   v2.1.2             Composer script handling your ignored parameter file
jdorn/sql-formatter                    v1.2.17            a PHP SQL highlighting library
jms/metadata                           1.5.1              Class/method/property metadata management in PHP
jms/parser-lib                         1.0.0              A library for easily creating recursive-descent parsers.
jms/serializer                         0.16.0             Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
jms/serializer-bundle                  0.13.0             Allows you to easily serialize, and deserialize data of any complexity
knplabs/knp-components                 1.3.2              Knplabs component library
knplabs/knp-menu                       v2.1.1             An object oriented menu library
knplabs/knp-menu-bundle                v2.1.1             This bundle provides an integration of the KnpMenu library
knplabs/knp-paginator-bundle           2.5.3              Paginator bundle for Symfony2 to automate pagination and simplify sorting and other features
knplabs/knp-snappy                     0.4.3              PHP5 library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage.
knplabs/knp-snappy-bundle              v1.4               Easily create PDF and images in Symfony2 by converting Twig/HTML templates.
kriswallsmith/assetic                  v1.3.2             Asset Management for PHP
liip/functional-test-bundle            1.0.4              This bundles provides additional functional test-cases for Symfony2 applications
liip/imagine-bundle                    1.5.2              This Bundle assists in imagine manipulation using the imagine library
luxifer/doctrine-functions             1.3.2              Doctrine DQL Functions for Mysql
michelf/php-markdown                   1.6.0              PHP Markdown
monolog/monolog                        1.19.0             Sends your logs to files, sockets, inboxes, databases and various web services
namshi/notificator                     1.1.5              A lightweight library to handle notifications the smart way.
nelmio/api-doc-bundle                  2.11.2             Generates documentation for your REST API from annotations
ocramius/proxy-manager                 1.0.2              A library providing utilities to generate, instantiate and generally operate with Object Proxies
oldsound/rabbitmq-bundle               v1.8.0             Integrates php-amqplib with Symfony2 and RabbitMq
paragonie/random_compat                v1.4.1             PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phpcollection/phpcollection            0.4.0              General-Purpose Collection Library for PHP
phpoption/phpoption                    1.5.0              Option Type for PHP
phpunit/php-code-coverage              2.2.4              Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator              1.3.4              FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template              1.2.1              Simple template engine.
phpunit/php-timer                      1.0.7              Utility class for timing
phpunit/php-token-stream               1.4.8              Wrapper around PHP's tokenizer extension.
phpunit/phpunit                        4.3.5              The PHP Unit Testing framework.
phpunit/phpunit-mock-objects           2.3.8              Mock Object library for PHPUnit
psr/log                                1.0.0              Common interface for logging libraries
sebastian/comparator                   1.2.0              Provides the functionality to compare PHP values for equality
sebastian/diff                         1.4.1              Diff implementation
sebastian/environment                  1.3.5              Provides functionality to handle HHVM/PHP environments
sebastian/exporter                     1.2.1              Provides the functionality to export PHP variables for visualization
sebastian/recursion-context            1.0.2              Provides functionality to recursively process PHP variables
sebastian/version                      1.0.6              Library that helps with managing the version number of Git-hosted PHP projects
sensio/distribution-bundle             v2.3.22            The base bundle for the Symfony Distributions
sensio/framework-extra-bundle          v2.3.4             This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle                v2.5.3             This bundle generates code for you
squizlabs/php_codesniffer              2.6.0              PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
swiftmailer/swiftmailer                v5.4.1             Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle                 v2.8.0             Integrates Assetic into Symfony2
symfony/monolog-bundle                 2.11.1             Symfony MonologBundle
symfony/polyfill-apcu                  v1.1.1             Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-mbstring              v1.1.1             Symfony polyfill for the Mbstring extension
symfony/swiftmailer-bundle             v2.3.11            Symfony SwiftmailerBundle
symfony/symfony                        v2.7.11            The Symfony PHP framework
twbs/bootstrap                         v3.2.0             The most popular front-end framework for developing responsive, mobile first projects on the web.
twig/extensions                        v1.3.0             Common additional features for Twig that do not directly belong in core
twig/twig                              v1.24.0            Twig, the flexible, fast, and secure template language for PHP
videlalvaro/php-amqplib                v2.6.3             Formerly videlalvaro/php-amqplib.  This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.
willdurand/jsonp-callback-validator    v1.1.0             JSONP callback validator.
willdurand/negotiation                 1.5.0              Content Negotiation tools for PHP provided as a standalone library.
zendframework/zend-code                2.6.3              provides facilities to generate arbitrary code using an object oriented interface
zendframework/zend-eventmanager        3.0.1              Trigger and listen to events within a PHP application
@polc

This comment has been minimized.

Copy link
Collaborator

commented Sep 13, 2017

Hello @julban is your problem still occurring?

@julban

This comment has been minimized.

Copy link

commented Sep 13, 2017

Hi @polc , I'm not concerned anymore since I've left the company and its projects a long time ago.
Maybe @rcambien is still interested in this issue and may tell if it's still happening...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.