sonata-project / SonataDoctrineORMAdminBundle

Integrate Doctrine ORM into the SonataAdminBundle
https://docs.sonata-project.org/projects/SonataDoctrineORMAdminBundle
MIT License
445 stars 344 forks source link

get-autocomplete-items more is allways true #908

Closed Selion05 closed 5 years ago

Selion05 commented 5 years ago

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.45.2 3.45.2 The missing Symfony Admin Generator
sonata-project/block-bundle              3.14.0 3.14.0 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/core-bundle               3.16.1 3.16.1 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.4.0  2.4.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.1.5  1.1.5  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.8.2  3.8.2  Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/exporter                  2.0.1  2.0.1  Lightweight Exporter library

Symfony packages

$ composer show --latest 'symfony/*'
symfony/asset                v4.2.3  v4.2.3  Symfony Asset Component
symfony/browser-kit          v4.2.3  v4.2.3  Symfony BrowserKit Component
symfony/cache                v4.2.3  v4.2.3  Symfony Cache component with PSR-6, PSR-16, and tags
symfony/config               v4.2.3  v4.2.3  Symfony Config Component
symfony/console              v4.2.3  v4.2.3  Symfony Console Component
symfony/contracts            v1.0.2  v1.0.2  A set of abstractions extracted out of the Symfony components
symfony/css-selector         v4.2.3  v4.2.3  Symfony CssSelector Component
symfony/debug                v4.2.3  v4.2.3  Symfony Debug Component
symfony/debug-bundle         v4.2.3  v4.2.3  Symfony DebugBundle
symfony/debug-pack           v1.0.7  v1.0.7  A debug pack for Symfony projects
symfony/dependency-injection v4.2.3  v4.2.3  Symfony DependencyInjection Component
symfony/doctrine-bridge      v4.2.3  v4.2.3  Symfony Doctrine Bridge
symfony/dom-crawler          v4.2.3  v4.2.3  Symfony DomCrawler Component
symfony/dotenv               v4.2.3  v4.2.3  Registers environment variables from a .env file
symfony/event-dispatcher     v4.2.3  v4.2.3  Symfony EventDispatcher Component
symfony/expression-language  v4.2.3  v4.2.3  Symfony ExpressionLanguage Component
symfony/filesystem           v4.2.3  v4.2.3  Symfony Filesystem Component
symfony/finder               v4.2.3  v4.2.3  Symfony Finder Component
symfony/flex                 v1.2.0  v1.2.0  Composer plugin for Symfony
symfony/form                 v4.2.3  v4.2.3  Symfony Form Component
symfony/framework-bundle     v4.2.3  v4.2.3  Symfony FrameworkBundle
symfony/http-foundation      v4.2.3  v4.2.3  Symfony HttpFoundation Component
symfony/http-kernel          v4.2.3  v4.2.3  Symfony HttpKernel Component
symfony/inflector            v4.2.3  v4.2.3  Symfony Inflector Component
symfony/intl                 v4.2.3  v4.2.3  A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/maker-bundle         v1.11.3 v1.11.3 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget ab...
symfony/monolog-bridge       v4.2.3  v4.2.3  Symfony Monolog Bridge
symfony/monolog-bundle       v3.3.1  v3.3.1  Symfony MonologBundle
symfony/options-resolver     v4.2.3  v4.2.3  Symfony OptionsResolver Component
symfony/orm-pack             v1.0.6  v1.0.6  A pack for the Doctrine ORM
symfony/phpunit-bridge       v4.2.3  v4.2.3  Symfony PHPUnit Bridge
symfony/polyfill-ctype       v1.10.0 v1.10.0 Symfony polyfill for ctype functions
symfony/polyfill-intl-icu    v1.10.0 v1.10.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring    v1.10.0 v1.10.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72       v1.10.0 v1.10.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/process              v4.2.3  v4.2.3  Symfony Process Component
symfony/profiler-pack        v1.0.4  v1.0.4  A pack for the Symfony web profiler
symfony/property-access      v4.2.3  v4.2.3  Symfony PropertyAccess Component
symfony/property-info        v4.2.3  v4.2.3  Symfony Property Info Component
symfony/routing              v4.2.3  v4.2.3  Symfony Routing Component
symfony/security-acl         v3.0.1  v3.0.1  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle      v4.2.3  v4.2.3  Symfony SecurityBundle
symfony/security-core        v4.2.3  v4.2.3  Symfony Security Component - Core Library
symfony/security-csrf        v4.2.3  v4.2.3  Symfony Security Component - CSRF Library
symfony/security-guard       v4.2.3  v4.2.3  Symfony Security Component - Guard
symfony/security-http        v4.2.3  v4.2.3  Symfony Security Component - HTTP Integration
symfony/serializer           v4.2.3  v4.2.3  Symfony Serializer Component
symfony/serializer-pack      v1.0.2  v1.0.2  A pack for the Symfony serializer
symfony/stopwatch            v4.2.3  v4.2.3  Symfony Stopwatch Component
symfony/swiftmailer-bundle   v3.2.5  v3.2.5  Symfony SwiftmailerBundle
symfony/templating           v4.2.3  v4.2.3  Symfony Templating Component
symfony/translation          v4.2.3  v4.2.3  Symfony Translation Component
symfony/twig-bridge          v4.2.3  v4.2.3  Symfony Twig Bridge
symfony/twig-bundle          v4.2.3  v4.2.3  Symfony TwigBundle
symfony/validator            v4.2.3  v4.2.3  Symfony Validator Component
symfony/var-dumper           v4.2.3  v4.2.3  Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter         v4.2.3  v4.2.3  A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-link             v4.2.3  v4.2.3  Symfony WebLink Component
symfony/web-profiler-bundle  v4.2.3  v4.2.3  Symfony WebProfilerBundle
symfony/webpack-encore-pack  v1.0.3  v1.0.3  A pack for Symfony Encore
symfony/workflow             v4.2.3  v4.2.3  Symfony Workflow Component
symfony/yaml                 v4.2.3  v4.2.3  Symfony Yaml Component

PHP version

 $ php -v
PHP 7.2.15 (cli) (built: Feb  9 2019 03:10:54) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.15, Copyright (c) 1999-2018, by Zend Technologies

Subject

https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/473c8a62dd95b5a44666085bcd9ac1276c5c6964/src/Datagrid/Pager.php#L79

ceil returns float while setLastPage expects an int combined with commit b6bc0297d524fdcf361d77a5181508ba58bcf6a5 from admin bundle (strict type checking) yields to more allways being true in get-autocomplete-items

greg0ire commented 5 years ago

See additional explanation here: https://github.com/sonata-project/SonataDoctrineORMAdminBundle/pull/910#discussion_r261342948

fliespl commented 3 years ago

I think this issue is still valid, but with different subject.

        if (0 === $this->getPage() || 0 === $this->getMaxPerPage() || 0 === $this->getNbResults()) {
            $this->setLastPage(0);
        } else {

this sets last page to 0 while ajax asks for page 1 it results with isLastPage()=false ("more"=true) when first page has no results.

VincentLanglet commented 3 years ago

This issue is one year old, and you're saying the subject is different. I recommend you to create your own issue with all the required information. ;)